[go: nahoru, domu]

blob: d4566f1829d44c83f70fcfc77a5bc9735b601c4c [file] [log] [blame]
Hiroki Nakagawa6bcbd1902017-06-09 07:13:201// 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 Reformata30d4232018-04-07 15:31:0610#include "third_party/blink/public/platform/web_content_settings_client.h"
Hiroki Nakagawa6bcbd1902017-06-09 07:13:2011#include "url/gurl.h"
12
13namespace IPC {
14class SyncMessageFilter;
15}
16
17namespace content {
18class RenderFrame;
19}
20
21namespace blink {
Hiroki Nakagawa6bcbd1902017-06-09 07:13:2022class WebSecurityOrigin;
23}
24
Nate Chapind55e4f52018-05-10 22:41:0125struct RendererContentSettingRules;
26
Hiroki Nakagawa6bcbd1902017-06-09 07:13:2027// This client is created on the main renderer thread then passed onto the
28// blink's worker thread.
29class WorkerContentSettingsClient : public blink::WebContentSettingsClient {
30 public:
lukaszabedb4b22017-06-23 00:00:1331 explicit WorkerContentSettingsClient(content::RenderFrame* render_frame);
Hiroki Nakagawa6bcbd1902017-06-09 07:13:2032 ~WorkerContentSettingsClient() override;
33
34 // WebContentSettingsClient overrides.
Nate Chapin423d58ab2018-04-10 21:53:4435 std::unique_ptr<blink::WebContentSettingsClient> Clone() override;
Hiroki Nakagawa6bcbd1902017-06-09 07:13:2036 bool RequestFileSystemAccessSync() override;
Joshua Bell7cdaafca2018-10-31 06:27:1137 bool AllowIndexedDB(const blink::WebSecurityOrigin&) override;
Ben Kelly6b2e61c2019-03-14 16:06:2938 bool AllowCacheStorage(const blink::WebSecurityOrigin&) override;
Tsuyoshi Horob552f412017-07-28 02:40:0939 bool AllowRunningInsecureContent(bool allowed_per_settings,
40 const blink::WebSecurityOrigin& context,
41 const blink::WebURL& url) override;
Nate Chapind55e4f52018-05-10 22:41:0142 bool AllowScriptFromSource(bool enabled_per_settings,
43 const blink::WebURL& script_url) override;
Hiroki Nakagawa6bcbd1902017-06-09 07:13:2044
45 private:
Nate Chapin423d58ab2018-04-10 21:53:4446 explicit WorkerContentSettingsClient(
47 const WorkerContentSettingsClient& other);
48
Hiroki Nakagawa6bcbd1902017-06-09 07:13:2049 // 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 Horob552f412017-07-28 02:40:0954 bool allow_running_insecure_content_;
Hiroki Nakagawa6bcbd1902017-06-09 07:13:2055 scoped_refptr<IPC::SyncMessageFilter> sync_message_filter_;
Nate Chapind55e4f52018-05-10 22:41:0156 const RendererContentSettingRules* content_setting_rules_;
Hiroki Nakagawa6bcbd1902017-06-09 07:13:2057
Nate Chapin423d58ab2018-04-10 21:53:4458 DISALLOW_ASSIGN(WorkerContentSettingsClient);
Hiroki Nakagawa6bcbd1902017-06-09 07:13:2059};
60
61#endif // CHROME_RENDERER_WORKER_CONTENT_SETTINGS_CLIENT_H_