Chromium Code Reviews| 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 #include "extensions/common/extension_id.h" | |
| 9 | |
| 8 namespace extensions { | 10 namespace extensions { |
| 11 class Extension; | |
| 9 class Dispatcher; | 12 class Dispatcher; |
| 10 | 13 |
| 11 // Interface to allow the extensions module to make render-process-specific | 14 // Interface to allow the extensions module to make render-process-specific |
| 12 // queries of the embedder. Should be Set() once in the render process. | 15 // queries of the embedder. Should be Set() once in the render process. |
| 13 // | 16 // |
| 14 // NOTE: Methods that do not require knowledge of renderer concepts should be | 17 // NOTE: Methods that do not require knowledge of renderer concepts should be |
| 15 // added in ExtensionsClient (extensions/common/extensions_client.h) even if | 18 // added in ExtensionsClient (extensions/common/extensions_client.h) even if |
| 16 // they are only used in the renderer process. | 19 // they are only used in the renderer process. |
| 17 class ExtensionsRendererClient { | 20 class ExtensionsRendererClient { |
| 18 public: | 21 public: |
| 19 virtual ~ExtensionsRendererClient() {} | 22 virtual ~ExtensionsRendererClient() {} |
| 20 | 23 |
| 21 // Returns true if the current render process was launched incognito. | 24 // Returns true if the current render process was launched incognito. |
| 22 virtual bool IsIncognitoProcess() const = 0; | 25 virtual bool IsIncognitoProcess() const = 0; |
| 23 | 26 |
| 24 // Returns the lowest isolated world ID available to extensions. | 27 // Returns the lowest isolated world ID available to extensions. |
| 25 // Must be greater than 0. See blink::WebFrame::executeScriptInIsolatedWorld | 28 // Must be greater than 0. See blink::WebFrame::executeScriptInIsolatedWorld |
| 26 // (third_party/WebKit/public/web/WebFrame.h) for additional context. | 29 // (third_party/WebKit/public/web/WebFrame.h) for additional context. |
| 27 virtual int GetLowestIsolatedWorldId() const = 0; | 30 virtual int GetLowestIsolatedWorldId() const = 0; |
| 28 | 31 |
| 29 // Returns the associated Dispatcher. | 32 // Returns the associated Dispatcher. |
| 30 virtual Dispatcher* GetDispatcher() = 0; | 33 virtual Dispatcher* GetDispatcher() = 0; |
| 31 | 34 |
| 35 // Notifies the client when an extension is added or removed. | |
|
nasko
2017/06/30 18:08:10
Loaded/Unloaded? I can have an extension added to
Devlin
2017/07/06 00:40:39
I went back and forth on this, because this is in
| |
| 36 // TODO(devlin): Make a RendererExtensionRegistryObserver? | |
| 37 virtual void OnExtensionAdded(const Extension& extension) {} | |
| 38 virtual void OnExtensionRemoved(const ExtensionId& extension) {} | |
| 39 | |
| 32 // Returns the single instance of |this|. | 40 // Returns the single instance of |this|. |
| 33 static ExtensionsRendererClient* Get(); | 41 static ExtensionsRendererClient* Get(); |
| 34 | 42 |
| 35 // Initialize the single instance. | 43 // Initialize the single instance. |
| 36 static void Set(ExtensionsRendererClient* client); | 44 static void Set(ExtensionsRendererClient* client); |
| 37 }; | 45 }; |
| 38 | 46 |
| 39 } // namespace extensions | 47 } // namespace extensions |
| 40 | 48 |
| 41 #endif // EXTENSIONS_RENDERER_EXTENSIONS_RENDERER_CLIENT_H_ | 49 #endif // EXTENSIONS_RENDERER_EXTENSIONS_RENDERER_CLIENT_H_ |
| OLD | NEW |