• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 CEF_LIBCEF_RENDERER_EXTENSIONS_EXTENSIONS_RENDERER_CLIENT_H_
6 #define CEF_LIBCEF_RENDERER_EXTENSIONS_EXTENSIONS_RENDERER_CLIENT_H_
7 
8 #include <memory>
9 #include <string>
10 
11 #include "extensions/renderer/extensions_renderer_client.h"
12 #include "services/service_manager/public/cpp/binder_registry.h"
13 #include "ui/base/page_transition_types.h"
14 
15 class GURL;
16 
17 namespace blink {
18 class WebFrame;
19 class WebLocalFrame;
20 struct WebPluginParams;
21 class WebURL;
22 }  // namespace blink
23 
24 namespace net {
25 class SiteForCookies;
26 }
27 
28 namespace content {
29 class BrowserPluginDelegate;
30 class RenderFrame;
31 struct WebPluginInfo;
32 }  // namespace content
33 
34 namespace guest_view {
35 class GuestViewContainerDispatcher;
36 }
37 
38 namespace url {
39 class Origin;
40 }
41 
42 namespace extensions {
43 
44 class Dispatcher;
45 class DispatcherDelegate;
46 class ResourceRequestPolicy;
47 
48 class CefExtensionsRendererClient : public ExtensionsRendererClient {
49  public:
50   CefExtensionsRendererClient();
51 
52   CefExtensionsRendererClient(const CefExtensionsRendererClient&) = delete;
53   CefExtensionsRendererClient& operator=(const CefExtensionsRendererClient&) =
54       delete;
55 
56   ~CefExtensionsRendererClient() override;
57 
58   // ExtensionsRendererClient implementation.
59   bool IsIncognitoProcess() const override;
60   int GetLowestIsolatedWorldId() const override;
61   extensions::Dispatcher* GetDispatcher() override;
62   void OnExtensionLoaded(const extensions::Extension& extension) override;
63   void OnExtensionUnloaded(
64       const extensions::ExtensionId& extension_id) override;
65   bool ExtensionAPIEnabledForServiceWorkerScript(
66       const GURL& scope,
67       const GURL& script_url) const override;
68 
69   // See AlloyContentRendererClient methods with the same names.
70   void RenderThreadStarted();
71   void RenderFrameCreated(content::RenderFrame* render_frame,
72                           service_manager::BinderRegistry* registry);
73   bool OverrideCreatePlugin(content::RenderFrame* render_frame,
74                             const blink::WebPluginParams& params);
75   void WillSendRequest(blink::WebLocalFrame* frame,
76                        ui::PageTransition transition_type,
77                        const blink::WebURL& url,
78                        const net::SiteForCookies& site_for_cookies,
79                        const url::Origin* initiator_origin,
80                        GURL* new_url);
81   void RunScriptsAtDocumentStart(content::RenderFrame* render_frame);
82   void RunScriptsAtDocumentEnd(content::RenderFrame* render_frame);
83   void RunScriptsAtDocumentIdle(content::RenderFrame* render_frame);
84 
85  private:
86   std::unique_ptr<extensions::Dispatcher> extension_dispatcher_;
87   std::unique_ptr<guest_view::GuestViewContainerDispatcher>
88       guest_view_container_dispatcher_;
89   std::unique_ptr<extensions::ResourceRequestPolicy> resource_request_policy_;
90 };
91 
92 }  // namespace extensions
93 
94 #endif  // CEF_LIBCEF_RENDERER_EXTENSIONS_EXTENSIONS_RENDERER_CLIENT_H_
95