Hiroki Nakagawa | 6bcbd190 | 2017-06-09 07:13:20 | [diff] [blame] | 1 | // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | #ifndef CHROME_RENDERER_WORKER_CONTENT_SETTINGS_CLIENT_H_ |
| 6 | #define CHROME_RENDERER_WORKER_CONTENT_SETTINGS_CLIENT_H_ |
| 7 | |
| 8 | #include "base/macros.h" |
| 9 | #include "base/memory/ref_counted.h" |
Blink Reformat | a30d423 | 2018-04-07 15:31:06 | [diff] [blame] | 10 | #include "third_party/blink/public/platform/web_content_settings_client.h" |
Hiroki Nakagawa | 6bcbd190 | 2017-06-09 07:13:20 | [diff] [blame] | 11 | #include "url/gurl.h" |
| 12 | |
| 13 | namespace IPC { |
| 14 | class SyncMessageFilter; |
| 15 | } |
| 16 | |
| 17 | namespace content { |
| 18 | class RenderFrame; |
| 19 | } |
| 20 | |
| 21 | namespace blink { |
Hiroki Nakagawa | 6bcbd190 | 2017-06-09 07:13:20 | [diff] [blame] | 22 | class WebSecurityOrigin; |
| 23 | } |
| 24 | |
Nate Chapin | d55e4f5 | 2018-05-10 22:41:01 | [diff] [blame] | 25 | struct RendererContentSettingRules; |
| 26 | |
Hiroki Nakagawa | 6bcbd190 | 2017-06-09 07:13:20 | [diff] [blame] | 27 | // This client is created on the main renderer thread then passed onto the |
| 28 | // blink's worker thread. |
| 29 | class WorkerContentSettingsClient : public blink::WebContentSettingsClient { |
| 30 | public: |
lukasza | bedb4b2 | 2017-06-23 00:00:13 | [diff] [blame] | 31 | explicit WorkerContentSettingsClient(content::RenderFrame* render_frame); |
Hiroki Nakagawa | 6bcbd190 | 2017-06-09 07:13:20 | [diff] [blame] | 32 | ~WorkerContentSettingsClient() override; |
| 33 | |
| 34 | // WebContentSettingsClient overrides. |
Nate Chapin | 423d58ab | 2018-04-10 21:53:44 | [diff] [blame] | 35 | std::unique_ptr<blink::WebContentSettingsClient> Clone() override; |
Hiroki Nakagawa | 6bcbd190 | 2017-06-09 07:13:20 | [diff] [blame] | 36 | bool RequestFileSystemAccessSync() override; |
Joshua Bell | 7cdaafca | 2018-10-31 06:27:11 | [diff] [blame] | 37 | bool AllowIndexedDB(const blink::WebSecurityOrigin&) override; |
Ben Kelly | 6b2e61c | 2019-03-14 16:06:29 | [diff] [blame] | 38 | bool AllowCacheStorage(const blink::WebSecurityOrigin&) override; |
Tsuyoshi Horo | b552f41 | 2017-07-28 02:40:09 | [diff] [blame] | 39 | bool AllowRunningInsecureContent(bool allowed_per_settings, |
| 40 | const blink::WebSecurityOrigin& context, |
| 41 | const blink::WebURL& url) override; |
Nate Chapin | d55e4f5 | 2018-05-10 22:41:01 | [diff] [blame] | 42 | bool AllowScriptFromSource(bool enabled_per_settings, |
| 43 | const blink::WebURL& script_url) override; |
Hiroki Nakagawa | 6bcbd190 | 2017-06-09 07:13:20 | [diff] [blame] | 44 | |
| 45 | private: |
Nate Chapin | 423d58ab | 2018-04-10 21:53:44 | [diff] [blame] | 46 | explicit WorkerContentSettingsClient( |
| 47 | const WorkerContentSettingsClient& other); |
| 48 | |
Hiroki Nakagawa | 6bcbd190 | 2017-06-09 07:13:20 | [diff] [blame] | 49 | // Loading document context for this worker. |
| 50 | const int routing_id_; |
| 51 | bool is_unique_origin_; |
| 52 | GURL document_origin_url_; |
| 53 | GURL top_frame_origin_url_; |
Tsuyoshi Horo | b552f41 | 2017-07-28 02:40:09 | [diff] [blame] | 54 | bool allow_running_insecure_content_; |
Hiroki Nakagawa | 6bcbd190 | 2017-06-09 07:13:20 | [diff] [blame] | 55 | scoped_refptr<IPC::SyncMessageFilter> sync_message_filter_; |
Nate Chapin | d55e4f5 | 2018-05-10 22:41:01 | [diff] [blame] | 56 | const RendererContentSettingRules* content_setting_rules_; |
Hiroki Nakagawa | 6bcbd190 | 2017-06-09 07:13:20 | [diff] [blame] | 57 | |
Nate Chapin | 423d58ab | 2018-04-10 21:53:44 | [diff] [blame] | 58 | DISALLOW_ASSIGN(WorkerContentSettingsClient); |
Hiroki Nakagawa | 6bcbd190 | 2017-06-09 07:13:20 | [diff] [blame] | 59 | }; |
| 60 | |
| 61 | #endif // CHROME_RENDERER_WORKER_CONTENT_SETTINGS_CLIENT_H_ |