| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef EXTENSIONS_BROWSER_EXTENSIONS_BROWSER_CLIENT_H_ | 5 #ifndef EXTENSIONS_BROWSER_EXTENSIONS_BROWSER_CLIENT_H_ |
| 6 #define EXTENSIONS_BROWSER_EXTENSIONS_BROWSER_CLIENT_H_ | 6 #define EXTENSIONS_BROWSER_EXTENSIONS_BROWSER_CLIENT_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
| 13 #include "base/memory/scoped_ptr.h" | |
| 14 #include "build/build_config.h" | 13 #include "build/build_config.h" |
| 15 #include "extensions/browser/extension_event_histogram_value.h" | 14 #include "extensions/browser/extension_event_histogram_value.h" |
| 16 #include "extensions/browser/extension_prefs_observer.h" | 15 #include "extensions/browser/extension_prefs_observer.h" |
| 17 #include "extensions/common/view_type.h" | 16 #include "extensions/common/view_type.h" |
| 18 | 17 |
| 19 class ExtensionFunctionRegistry; | 18 class ExtensionFunctionRegistry; |
| 20 class PrefService; | 19 class PrefService; |
| 21 | 20 |
| 22 namespace base { | 21 namespace base { |
| 23 class CommandLine; | 22 class CommandLine; |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 // are not owned by ExtensionPrefs. | 150 // are not owned by ExtensionPrefs. |
| 152 virtual void GetEarlyExtensionPrefsObservers( | 151 virtual void GetEarlyExtensionPrefsObservers( |
| 153 content::BrowserContext* context, | 152 content::BrowserContext* context, |
| 154 std::vector<ExtensionPrefsObserver*>* observers) const = 0; | 153 std::vector<ExtensionPrefsObserver*>* observers) const = 0; |
| 155 | 154 |
| 156 // Returns the ProcessManagerDelegate shared across all BrowserContexts. May | 155 // Returns the ProcessManagerDelegate shared across all BrowserContexts. May |
| 157 // return NULL in tests or for simple embedders. | 156 // return NULL in tests or for simple embedders. |
| 158 virtual ProcessManagerDelegate* GetProcessManagerDelegate() const = 0; | 157 virtual ProcessManagerDelegate* GetProcessManagerDelegate() const = 0; |
| 159 | 158 |
| 160 // Creates a new ExtensionHostDelegate instance. | 159 // Creates a new ExtensionHostDelegate instance. |
| 161 virtual scoped_ptr<ExtensionHostDelegate> CreateExtensionHostDelegate() = 0; | 160 virtual std::unique_ptr<ExtensionHostDelegate> |
| 161 CreateExtensionHostDelegate() = 0; |
| 162 | 162 |
| 163 // Returns true if the client version has updated since the last run. Called | 163 // Returns true if the client version has updated since the last run. Called |
| 164 // once each time the extensions system is loaded per browser_context. The | 164 // once each time the extensions system is loaded per browser_context. The |
| 165 // implementation may wish to use the BrowserContext to record the current | 165 // implementation may wish to use the BrowserContext to record the current |
| 166 // version for later comparison. | 166 // version for later comparison. |
| 167 virtual bool DidVersionUpdate(content::BrowserContext* context) = 0; | 167 virtual bool DidVersionUpdate(content::BrowserContext* context) = 0; |
| 168 | 168 |
| 169 // Permits an external protocol handler to be launched. See | 169 // Permits an external protocol handler to be launched. See |
| 170 // ExternalProtocolHandler::PermitLaunchUrl() in Chrome. | 170 // ExternalProtocolHandler::PermitLaunchUrl() in Chrome. |
| 171 virtual void PermitExternalProtocolHandler() = 0; | 171 virtual void PermitExternalProtocolHandler() = 0; |
| (...skipping 17 matching lines...) Expand all Loading... |
| 189 virtual void RegisterExtensionFunctions( | 189 virtual void RegisterExtensionFunctions( |
| 190 ExtensionFunctionRegistry* registry) const = 0; | 190 ExtensionFunctionRegistry* registry) const = 0; |
| 191 | 191 |
| 192 // Registers Mojo services for a RenderFrame. | 192 // Registers Mojo services for a RenderFrame. |
| 193 virtual void RegisterMojoServices(content::RenderFrameHost* render_frame_host, | 193 virtual void RegisterMojoServices(content::RenderFrameHost* render_frame_host, |
| 194 const Extension* extension) const = 0; | 194 const Extension* extension) const = 0; |
| 195 | 195 |
| 196 // Creates a RuntimeAPIDelegate responsible for handling extensions | 196 // Creates a RuntimeAPIDelegate responsible for handling extensions |
| 197 // management-related events such as update and installation on behalf of the | 197 // management-related events such as update and installation on behalf of the |
| 198 // core runtime API implementation. | 198 // core runtime API implementation. |
| 199 virtual scoped_ptr<RuntimeAPIDelegate> CreateRuntimeAPIDelegate( | 199 virtual std::unique_ptr<RuntimeAPIDelegate> CreateRuntimeAPIDelegate( |
| 200 content::BrowserContext* context) const = 0; | 200 content::BrowserContext* context) const = 0; |
| 201 | 201 |
| 202 // Returns the manager of resource bundles used in extensions. Returns NULL if | 202 // Returns the manager of resource bundles used in extensions. Returns NULL if |
| 203 // the manager doesn't exist. | 203 // the manager doesn't exist. |
| 204 virtual const ComponentExtensionResourceManager* | 204 virtual const ComponentExtensionResourceManager* |
| 205 GetComponentExtensionResourceManager() = 0; | 205 GetComponentExtensionResourceManager() = 0; |
| 206 | 206 |
| 207 // Propagate a event to all the renderers in every browser context. The | 207 // Propagate a event to all the renderers in every browser context. The |
| 208 // implementation must be safe to call from any thread. | 208 // implementation must be safe to call from any thread. |
| 209 virtual void BroadcastEventToRenderers(events::HistogramValue histogram_value, | 209 virtual void BroadcastEventToRenderers( |
| 210 const std::string& event_name, | 210 events::HistogramValue histogram_value, |
| 211 scoped_ptr<base::ListValue> args) = 0; | 211 const std::string& event_name, |
| 212 std::unique_ptr<base::ListValue> args) = 0; |
| 212 | 213 |
| 213 // Returns the embedder's net::NetLog. | 214 // Returns the embedder's net::NetLog. |
| 214 virtual net::NetLog* GetNetLog() = 0; | 215 virtual net::NetLog* GetNetLog() = 0; |
| 215 | 216 |
| 216 // Gets the single ExtensionCache instance shared across the browser process. | 217 // Gets the single ExtensionCache instance shared across the browser process. |
| 217 virtual ExtensionCache* GetExtensionCache() = 0; | 218 virtual ExtensionCache* GetExtensionCache() = 0; |
| 218 | 219 |
| 219 // Indicates whether extension update checks should be allowed. | 220 // Indicates whether extension update checks should be allowed. |
| 220 virtual bool IsBackgroundUpdateAllowed() = 0; | 221 virtual bool IsBackgroundUpdateAllowed() = 0; |
| 221 | 222 |
| 222 // Indicates whether an extension update which specifies its minimum browser | 223 // Indicates whether an extension update which specifies its minimum browser |
| 223 // version as |min_version| can be installed by the client. Not all extensions | 224 // version as |min_version| can be installed by the client. Not all extensions |
| 224 // embedders share the same versioning model, so interpretation of the string | 225 // embedders share the same versioning model, so interpretation of the string |
| 225 // is left up to the embedder. | 226 // is left up to the embedder. |
| 226 virtual bool IsMinBrowserVersionSupported(const std::string& min_version) = 0; | 227 virtual bool IsMinBrowserVersionSupported(const std::string& min_version) = 0; |
| 227 | 228 |
| 228 // Embedders can override this function to handle extension errors. | 229 // Embedders can override this function to handle extension errors. |
| 229 virtual void ReportError(content::BrowserContext* context, | 230 virtual void ReportError(content::BrowserContext* context, |
| 230 scoped_ptr<ExtensionError> error); | 231 std::unique_ptr<ExtensionError> error); |
| 231 | 232 |
| 232 // Returns the ExtensionWebContentsObserver for the given |web_contents|. | 233 // Returns the ExtensionWebContentsObserver for the given |web_contents|. |
| 233 virtual ExtensionWebContentsObserver* GetExtensionWebContentsObserver( | 234 virtual ExtensionWebContentsObserver* GetExtensionWebContentsObserver( |
| 234 content::WebContents* web_contents) = 0; | 235 content::WebContents* web_contents) = 0; |
| 235 | 236 |
| 236 // Cleans up browser-side state associated with a WebView that is being | 237 // Cleans up browser-side state associated with a WebView that is being |
| 237 // destroyed. | 238 // destroyed. |
| 238 virtual void CleanUpWebView(content::BrowserContext* browser_context, | 239 virtual void CleanUpWebView(content::BrowserContext* browser_context, |
| 239 int embedder_process_id, | 240 int embedder_process_id, |
| 240 int view_instance_id) {} | 241 int view_instance_id) {} |
| (...skipping 14 matching lines...) Expand all Loading... |
| 255 // Returns the single instance of |this|. | 256 // Returns the single instance of |this|. |
| 256 static ExtensionsBrowserClient* Get(); | 257 static ExtensionsBrowserClient* Get(); |
| 257 | 258 |
| 258 // Initialize the single instance. | 259 // Initialize the single instance. |
| 259 static void Set(ExtensionsBrowserClient* client); | 260 static void Set(ExtensionsBrowserClient* client); |
| 260 }; | 261 }; |
| 261 | 262 |
| 262 } // namespace extensions | 263 } // namespace extensions |
| 263 | 264 |
| 264 #endif // EXTENSIONS_BROWSER_EXTENSIONS_BROWSER_CLIENT_H_ | 265 #endif // EXTENSIONS_BROWSER_EXTENSIONS_BROWSER_CLIENT_H_ |
| OLD | NEW |