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 <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
12 #include "extensions/browser/extension_prefs_observer.h" | 12 #include "extensions/browser/extension_prefs_observer.h" |
13 | 13 |
14 class ExtensionFunctionRegistry; | 14 class ExtensionFunctionRegistry; |
15 class PrefService; | 15 class PrefService; |
16 | 16 |
17 namespace base { | 17 namespace base { |
18 class CommandLine; | 18 class CommandLine; |
| 19 class FilePath; |
19 } | 20 } |
20 | 21 |
21 namespace content { | 22 namespace content { |
22 class BrowserContext; | 23 class BrowserContext; |
23 class WebContents; | 24 class WebContents; |
24 } | 25 } |
25 | 26 |
| 27 namespace net { |
| 28 class NetworkDelegate; |
| 29 class URLRequest; |
| 30 class URLRequestJob; |
| 31 } |
| 32 |
26 namespace extensions { | 33 namespace extensions { |
27 | 34 |
28 class ApiActivityMonitor; | 35 class ApiActivityMonitor; |
29 class AppSorting; | 36 class AppSorting; |
30 class Extension; | 37 class Extension; |
31 class ExtensionHostDelegate; | 38 class ExtensionHostDelegate; |
32 class ExtensionPrefsObserver; | 39 class ExtensionPrefsObserver; |
33 class ExtensionSystem; | 40 class ExtensionSystem; |
34 class ExtensionSystemProvider; | 41 class ExtensionSystemProvider; |
| 42 class InfoMap; |
35 | 43 |
36 // Interface to allow the extensions module to make browser-process-specific | 44 // Interface to allow the extensions module to make browser-process-specific |
37 // queries of the embedder. Should be Set() once in the browser process. | 45 // queries of the embedder. Should be Set() once in the browser process. |
38 // | 46 // |
39 // NOTE: Methods that do not require knowledge of browser concepts should be | 47 // NOTE: Methods that do not require knowledge of browser concepts should be |
40 // added in ExtensionsClient (extensions/common/extensions_client.h) even if | 48 // added in ExtensionsClient (extensions/common/extensions_client.h) even if |
41 // they are only used in the browser process. | 49 // they are only used in the browser process. |
42 class ExtensionsBrowserClient { | 50 class ExtensionsBrowserClient { |
43 public: | 51 public: |
44 virtual ~ExtensionsBrowserClient() {} | 52 virtual ~ExtensionsBrowserClient() {} |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 virtual bool IsExtensionIncognitoEnabled( | 89 virtual bool IsExtensionIncognitoEnabled( |
82 const std::string& extension_id, | 90 const std::string& extension_id, |
83 content::BrowserContext* context) const = 0; | 91 content::BrowserContext* context) const = 0; |
84 | 92 |
85 // Returns true if |extension| can see events and data from another | 93 // Returns true if |extension| can see events and data from another |
86 // sub-profile (incognito to original profile, or vice versa). | 94 // sub-profile (incognito to original profile, or vice versa). |
87 virtual bool CanExtensionCrossIncognito( | 95 virtual bool CanExtensionCrossIncognito( |
88 const extensions::Extension* extension, | 96 const extensions::Extension* extension, |
89 content::BrowserContext* context) const = 0; | 97 content::BrowserContext* context) const = 0; |
90 | 98 |
| 99 // Returns an URLRequestJob to load an extension resource from the embedder's |
| 100 // resource bundle (.pak) files. Returns NULL if the request is not for a |
| 101 // resource bundle resource or if the embedder does not support this feature. |
| 102 // Used for component extensions. Called on the IO thread. |
| 103 virtual net::URLRequestJob* MaybeCreateResourceBundleRequestJob( |
| 104 net::URLRequest* request, |
| 105 net::NetworkDelegate* network_delegate, |
| 106 const base::FilePath& directory_path, |
| 107 const std::string& content_security_policy, |
| 108 bool send_cors_header) = 0; |
| 109 |
| 110 // Returns true if the embedder wants to allow a chrome-extension:// resource |
| 111 // request coming from renderer A to access a resource in an extension running |
| 112 // in renderer B. For example, Chrome overrides this to provide support for |
| 113 // webview and dev tools. Called on the IO thread. |
| 114 virtual bool AllowCrossRendererResourceLoad(net::URLRequest* request, |
| 115 bool is_incognito, |
| 116 const Extension* extension, |
| 117 InfoMap* extension_info_map) = 0; |
| 118 |
91 // Returns the PrefService associated with |context|. | 119 // Returns the PrefService associated with |context|. |
92 virtual PrefService* GetPrefServiceForContext( | 120 virtual PrefService* GetPrefServiceForContext( |
93 content::BrowserContext* context) = 0; | 121 content::BrowserContext* context) = 0; |
94 | 122 |
95 // Populates a list of ExtensionPrefs observers to be attached to each | 123 // Populates a list of ExtensionPrefs observers to be attached to each |
96 // BrowserContext's ExtensionPrefs upon construction. These observers | 124 // BrowserContext's ExtensionPrefs upon construction. These observers |
97 // are not owned by ExtensionPrefs. | 125 // are not owned by ExtensionPrefs. |
98 virtual void GetEarlyExtensionPrefsObservers( | 126 virtual void GetEarlyExtensionPrefsObservers( |
99 content::BrowserContext* context, | 127 content::BrowserContext* context, |
100 std::vector<ExtensionPrefsObserver*>* observers) const = 0; | 128 std::vector<ExtensionPrefsObserver*>* observers) const = 0; |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 // Returns the single instance of |this|. | 165 // Returns the single instance of |this|. |
138 static ExtensionsBrowserClient* Get(); | 166 static ExtensionsBrowserClient* Get(); |
139 | 167 |
140 // Initialize the single instance. | 168 // Initialize the single instance. |
141 static void Set(ExtensionsBrowserClient* client); | 169 static void Set(ExtensionsBrowserClient* client); |
142 }; | 170 }; |
143 | 171 |
144 } // namespace extensions | 172 } // namespace extensions |
145 | 173 |
146 #endif // EXTENSIONS_BROWSER_EXTENSIONS_BROWSER_CLIENT_H_ | 174 #endif // EXTENSIONS_BROWSER_EXTENSIONS_BROWSER_CLIENT_H_ |
OLD | NEW |