Decouple Cache Storage messaging from Service Worker/Embedded Worker
[chromium-blink-merge.git] / content / browser / plugin_content_origin_whitelist.h
blob25311d242eb669d8b101f87d5851037a8ff96f21
1 // Copyright 2014 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.
5 #ifndef CONTENT_BROWSER_PLUGIN_CONTENT_ORIGIN_WHITELIST_H_
6 #define CONTENT_BROWSER_PLUGIN_CONTENT_ORIGIN_WHITELIST_H_
8 #include <set>
10 #include "content/public/browser/web_contents_observer.h"
11 #include "url/gurl.h"
13 namespace content {
15 class WebContents;
17 // This class manages the tab-wide list of temporarily whitelisted plugin
18 // content origins that are exempt from power saving.
20 // RenderFrames report content origins that should be whitelisted via IPC.
21 // This class aggregates those origins and broadcasts the total list to all
22 // RenderFrames owned by the tab (WebContents). This class also sends these
23 // origins to any newly created RenderFrames.
25 // Tab-wide whitelists are cleared by top-level navigation. RenderFrames that
26 // persist across top level navigations are responsible for clearing their own
27 // whitelists.
28 class PluginContentOriginWhitelist : public WebContentsObserver {
29 public:
30 explicit PluginContentOriginWhitelist(WebContents* web_contents);
31 ~PluginContentOriginWhitelist() override;
33 private:
34 // WebContentsObserver implementation.
35 void RenderFrameCreated(RenderFrameHost* render_frame_host) override;
36 bool OnMessageReceived(const IPC::Message& message,
37 RenderFrameHost* render_frame_host) override;
38 void DidNavigateMainFrame(
39 const LoadCommittedDetails& details,
40 const FrameNavigateParams& params) override;
42 void OnPluginContentOriginAllowed(const GURL& content_origin);
44 std::set<GURL> whitelist_;
46 DISALLOW_COPY_AND_ASSIGN(PluginContentOriginWhitelist);
49 } // namespace content
51 #endif // CONTENT_BROWSER_PLUGIN_CONTENT_ORIGIN_WHITELIST_H_