OLD | NEW |
(Empty) | |
| 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. |
| 4 |
| 5 #ifndef CONTENT_BROWSER_PLUGIN_CONTENT_ORIGIN_WHITELIST_H_ |
| 6 #define CONTENT_BROWSER_PLUGIN_CONTENT_ORIGIN_WHITELIST_H_ |
| 7 |
| 8 #include <set> |
| 9 |
| 10 #include "content/public/browser/web_contents_observer.h" |
| 11 #include "url/gurl.h" |
| 12 |
| 13 namespace content { |
| 14 |
| 15 class WebContents; |
| 16 |
| 17 // This class manages the tab-wide list of temporarily whitelisted plugin |
| 18 // content origins that are exempt from power saving. |
| 19 // |
| 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. |
| 24 // |
| 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; |
| 32 |
| 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; |
| 41 |
| 42 void OnPluginContentOriginAllowed(const GURL& content_origin); |
| 43 |
| 44 std::set<GURL> whitelist_; |
| 45 |
| 46 DISALLOW_COPY_AND_ASSIGN(PluginContentOriginWhitelist); |
| 47 }; |
| 48 |
| 49 } // namespace content |
| 50 |
| 51 #endif // CONTENT_BROWSER_PLUGIN_CONTENT_ORIGIN_WHITELIST_H_ |
OLD | NEW |