Upstream version 7.36.149.0
[platform/framework/web/crosswalk.git] / src / extensions / browser / extensions_browser_client.h
index 2e3d26d..9356aa6 100644 (file)
@@ -9,12 +9,14 @@
 #include <vector>
 
 #include "base/memory/scoped_ptr.h"
+#include "extensions/browser/extension_prefs_observer.h"
 
 class ExtensionFunctionRegistry;
 class PrefService;
 
 namespace base {
 class CommandLine;
+class FilePath;
 }
 
 namespace content {
@@ -22,14 +24,23 @@ class BrowserContext;
 class WebContents;
 }
 
+namespace net {
+class NetworkDelegate;
+class URLRequest;
+class URLRequestJob;
+}
+
 namespace extensions {
 
 class ApiActivityMonitor;
 class AppSorting;
 class Extension;
 class ExtensionHostDelegate;
+class ExtensionPrefsObserver;
 class ExtensionSystem;
 class ExtensionSystemProvider;
+class InfoMap;
+class RuntimeAPIDelegate;
 
 // Interface to allow the extensions module to make browser-process-specific
 // queries of the embedder. Should be Set() once in the browser process.
@@ -86,10 +97,41 @@ class ExtensionsBrowserClient {
       const extensions::Extension* extension,
       content::BrowserContext* context) const = 0;
 
+  // Returns true if |request| corresponds to a resource request from a
+  // <webview>.
+  virtual bool IsWebViewRequest(net::URLRequest* request) const = 0;
+
+  // Returns an URLRequestJob to load an extension resource from the embedder's
+  // resource bundle (.pak) files. Returns NULL if the request is not for a
+  // resource bundle resource or if the embedder does not support this feature.
+  // Used for component extensions. Called on the IO thread.
+  virtual net::URLRequestJob* MaybeCreateResourceBundleRequestJob(
+      net::URLRequest* request,
+      net::NetworkDelegate* network_delegate,
+      const base::FilePath& directory_path,
+      const std::string& content_security_policy,
+      bool send_cors_header) = 0;
+
+  // Returns true if the embedder wants to allow a chrome-extension:// resource
+  // request coming from renderer A to access a resource in an extension running
+  // in renderer B. For example, Chrome overrides this to provide support for
+  // webview and dev tools. Called on the IO thread.
+  virtual bool AllowCrossRendererResourceLoad(net::URLRequest* request,
+                                              bool is_incognito,
+                                              const Extension* extension,
+                                              InfoMap* extension_info_map) = 0;
+
   // Returns the PrefService associated with |context|.
   virtual PrefService* GetPrefServiceForContext(
       content::BrowserContext* context) = 0;
 
+  // Populates a list of ExtensionPrefs observers to be attached to each
+  // BrowserContext's ExtensionPrefs upon construction. These observers
+  // are not owned by ExtensionPrefs.
+  virtual void GetEarlyExtensionPrefsObservers(
+      content::BrowserContext* context,
+      std::vector<ExtensionPrefsObserver*>* observers) const = 0;
+
   // Returns true if loading background pages should be deferred.
   virtual bool DeferLoadingBackgroundHosts(
       content::BrowserContext* context) const = 0;
@@ -106,10 +148,6 @@ class ExtensionsBrowserClient {
   // version for later comparison.
   virtual bool DidVersionUpdate(content::BrowserContext* context) = 0;
 
-  // Permits an external protocol handler to be launched. See
-  // ExternalProtocolHandler::PermitLaunchUrl() in Chrome.
-  virtual void PermitExternalProtocolHandler() = 0;
-
   // Creates a new AppSorting instance.
   virtual scoped_ptr<AppSorting> CreateAppSorting() = 0;
 
@@ -129,6 +167,12 @@ class ExtensionsBrowserClient {
   virtual void RegisterExtensionFunctions(
       ExtensionFunctionRegistry* registry) const = 0;
 
+  // Creates a RuntimeAPIDelegate responsible for handling extensions
+  // management-related events such as update and installation on behalf of the
+  // core runtime API implementation.
+  virtual scoped_ptr<RuntimeAPIDelegate> CreateRuntimeAPIDelegate(
+      content::BrowserContext* context) const = 0;
+
   // Returns the single instance of |this|.
   static ExtensionsBrowserClient* Get();