| 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_EXTENSION_HELPER_H_ | 5 #ifndef EXTENSIONS_RENDERER_EXTENSION_HELPER_H_ |
| 6 #define EXTENSIONS_RENDERER_EXTENSION_HELPER_H_ | 6 #define EXTENSIONS_RENDERER_EXTENSION_HELPER_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| 11 #include "content/public/common/console_message_level.h" | 11 #include "content/public/common/console_message_level.h" |
| 12 #include "content/public/renderer/render_view_observer.h" | 12 #include "content/public/renderer/render_view_observer.h" |
| 13 #include "content/public/renderer/render_view_observer_tracker.h" | 13 #include "content/public/renderer/render_view_observer_tracker.h" |
| 14 #include "extensions/common/view_type.h" | 14 #include "extensions/common/view_type.h" |
| 15 | 15 |
| 16 class GURL; | 16 class GURL; |
| 17 class SkBitmap; | 17 class SkBitmap; |
| 18 struct ExtensionMsg_ExternalConnectionInfo; | |
| 19 | 18 |
| 20 namespace base { | 19 namespace base { |
| 21 class DictionaryValue; | |
| 22 class ListValue; | 20 class ListValue; |
| 23 } | 21 } |
| 24 | 22 |
| 25 namespace extensions { | 23 namespace extensions { |
| 26 class AutomationApiHelper; | 24 class AutomationApiHelper; |
| 27 class Dispatcher; | 25 class Dispatcher; |
| 28 | 26 |
| 29 struct Message; | |
| 30 | |
| 31 // RenderView-level plumbing for extension features. | 27 // RenderView-level plumbing for extension features. |
| 32 class ExtensionHelper | 28 class ExtensionHelper |
| 33 : public content::RenderViewObserver, | 29 : public content::RenderViewObserver, |
| 34 public content::RenderViewObserverTracker<ExtensionHelper> { | 30 public content::RenderViewObserverTracker<ExtensionHelper> { |
| 35 public: | 31 public: |
| 36 // Returns a list of extension RenderViews that match the given filter | 32 // Returns a list of extension RenderViews that match the given filter |
| 37 // criteria. If |browser_window_id| is not extension_misc::kUnknownWindowId, | 33 // criteria. If |browser_window_id| is not extension_misc::kUnknownWindowId, |
| 38 // the list is restricted to views in that browser window. | 34 // the list is restricted to views in that browser window. |
| 39 static std::vector<content::RenderView*> GetExtensionViews( | 35 static std::vector<content::RenderView*> GetExtensionViews( |
| 40 const std::string& extension_id, | 36 const std::string& extension_id, |
| (...skipping 24 matching lines...) Expand all Loading... |
| 65 void DraggableRegionsChanged(blink::WebFrame* frame) override; | 61 void DraggableRegionsChanged(blink::WebFrame* frame) override; |
| 66 | 62 |
| 67 void OnExtensionResponse(int request_id, bool success, | 63 void OnExtensionResponse(int request_id, bool success, |
| 68 const base::ListValue& response, | 64 const base::ListValue& response, |
| 69 const std::string& error); | 65 const std::string& error); |
| 70 void OnExtensionMessageInvoke(const std::string& extension_id, | 66 void OnExtensionMessageInvoke(const std::string& extension_id, |
| 71 const std::string& module_name, | 67 const std::string& module_name, |
| 72 const std::string& function_name, | 68 const std::string& function_name, |
| 73 const base::ListValue& args, | 69 const base::ListValue& args, |
| 74 bool user_gesture); | 70 bool user_gesture); |
| 75 void OnExtensionDispatchOnConnect( | |
| 76 int target_port_id, | |
| 77 const std::string& channel_name, | |
| 78 const base::DictionaryValue& source_tab, | |
| 79 const ExtensionMsg_ExternalConnectionInfo& info, | |
| 80 const std::string& tls_channel_id); | |
| 81 void OnExtensionDeliverMessage(int target_port_id, | |
| 82 const Message& message); | |
| 83 void OnExtensionDispatchOnDisconnect(int port_id, | |
| 84 const std::string& error_message); | |
| 85 void OnNotifyRendererViewType(ViewType view_type); | 71 void OnNotifyRendererViewType(ViewType view_type); |
| 86 void OnSetTabId(int tab_id); | 72 void OnSetTabId(int tab_id); |
| 87 void OnUpdateBrowserWindowId(int window_id); | 73 void OnUpdateBrowserWindowId(int window_id); |
| 88 void OnAddMessageToConsole(content::ConsoleMessageLevel level, | 74 void OnAddMessageToConsole(content::ConsoleMessageLevel level, |
| 89 const std::string& message); | 75 const std::string& message); |
| 90 void OnAppWindowClosed(); | 76 void OnAppWindowClosed(); |
| 91 void OnSetFrameName(const std::string& name); | 77 void OnSetFrameName(const std::string& name); |
| 92 | 78 |
| 93 Dispatcher* dispatcher_; | 79 Dispatcher* dispatcher_; |
| 94 | 80 |
| 95 // Type of view attached with RenderView. | 81 // Type of view attached with RenderView. |
| 96 ViewType view_type_; | 82 ViewType view_type_; |
| 97 | 83 |
| 98 // Id of the tab which the RenderView is attached to. | 84 // Id of the tab which the RenderView is attached to. |
| 99 int tab_id_; | 85 int tab_id_; |
| 100 | 86 |
| 101 // Id number of browser window which RenderView is attached to. | 87 // Id number of browser window which RenderView is attached to. |
| 102 int browser_window_id_; | 88 int browser_window_id_; |
| 103 | 89 |
| 104 DISALLOW_COPY_AND_ASSIGN(ExtensionHelper); | 90 DISALLOW_COPY_AND_ASSIGN(ExtensionHelper); |
| 105 }; | 91 }; |
| 106 | 92 |
| 107 } // namespace extensions | 93 } // namespace extensions |
| 108 | 94 |
| 109 #endif // EXTENSIONS_RENDERER_EXTENSION_HELPER_H_ | 95 #endif // EXTENSIONS_RENDERER_EXTENSION_HELPER_H_ |
| OLD | NEW |