OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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_RENDERER_EXTENSIONS_RENDERER_CLIENT_H_ | 5 #ifndef EXTENSIONS_RENDERER_EXTENSIONS_RENDERER_CLIENT_H_ |
6 #define EXTENSIONS_RENDERER_EXTENSIONS_RENDERER_CLIENT_H_ | 6 #define EXTENSIONS_RENDERER_EXTENSIONS_RENDERER_CLIENT_H_ |
7 | 7 |
| 8 class ResourceBundleSourceMap; |
| 9 |
8 namespace extensions { | 10 namespace extensions { |
9 | 11 |
| 12 class ModuleSystem; |
| 13 class ScriptContext; |
| 14 |
10 // Interface to allow the extensions module to make render-process-specific | 15 // Interface to allow the extensions module to make render-process-specific |
11 // queries of the embedder. Should be Set() once in the render process. | 16 // queries of the embedder. Should be Set() once in the render process. |
12 // | 17 // |
13 // NOTE: Methods that do not require knowledge of renderer concepts should be | 18 // NOTE: Methods that do not require knowledge of renderer concepts should be |
14 // added in ExtensionsClient (extensions/common/extensions_client.h) even if | 19 // added in ExtensionsClient (extensions/common/extensions_client.h) even if |
15 // they are only used in the renderer process. | 20 // they are only used in the renderer process. |
16 class ExtensionsRendererClient { | 21 class ExtensionsRendererClient { |
17 public: | 22 public: |
18 virtual ~ExtensionsRendererClient() {} | 23 virtual ~ExtensionsRendererClient() {} |
19 | 24 |
20 // Returns true if the current render process was launched incognito. | 25 // Returns true if the current render process was launched incognito. |
21 virtual bool IsIncognitoProcess() const = 0; | 26 virtual bool IsIncognitoProcess() const = 0; |
22 | 27 |
23 // Returns the lowest isolated world ID available to extensions. | 28 // Returns the lowest isolated world ID available to extensions. |
24 // Must be greater than 0. See blink::WebFrame::executeScriptInIsolatedWorld | 29 // Must be greater than 0. See blink::WebFrame::executeScriptInIsolatedWorld |
25 // (third_party/WebKit/public/web/WebFrame.h) for additional context. | 30 // (third_party/WebKit/public/web/WebFrame.h) for additional context. |
26 virtual int GetLowestIsolatedWorldId() const = 0; | 31 virtual int GetLowestIsolatedWorldId() const = 0; |
27 | 32 |
| 33 // Registers additional native C++ code handlers for JS API functions. |
| 34 virtual void RegisterNativeHandlers(ModuleSystem* module_system, |
| 35 ScriptContext* context) = 0; |
| 36 |
| 37 // Registers additional JS source code resources for API implementations. |
| 38 virtual void PopulateSourceMap(ResourceBundleSourceMap* source_map) = 0; |
| 39 |
28 // Returns the single instance of |this|. | 40 // Returns the single instance of |this|. |
29 static ExtensionsRendererClient* Get(); | 41 static ExtensionsRendererClient* Get(); |
30 | 42 |
31 // Initialize the single instance. | 43 // Initialize the single instance. |
32 static void Set(ExtensionsRendererClient* client); | 44 static void Set(ExtensionsRendererClient* client); |
33 }; | 45 }; |
34 | 46 |
35 } // namespace extensions | 47 } // namespace extensions |
36 | 48 |
37 #endif // EXTENSIONS_RENDERER_EXTENSIONS_RENDERER_CLIENT_H_ | 49 #endif // EXTENSIONS_RENDERER_EXTENSIONS_RENDERER_CLIENT_H_ |
OLD | NEW |