| 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 "content/public/common/console_message_level.h" | 10 #include "content/public/common/console_message_level.h" |
| 11 #include "content/public/renderer/render_view_observer.h" | 11 #include "content/public/renderer/render_view_observer.h" |
| 12 #include "content/public/renderer/render_view_observer_tracker.h" | 12 #include "content/public/renderer/render_view_observer_tracker.h" |
| 13 #include "extensions/common/view_type.h" | 13 #include "extensions/common/view_type.h" |
| 14 | 14 |
| 15 class GURL; | 15 class GURL; |
| 16 class SkBitmap; | 16 class SkBitmap; |
| 17 struct ExtensionMsg_ExecuteCode_Params; | |
| 18 struct ExtensionMsg_ExternalConnectionInfo; | 17 struct ExtensionMsg_ExternalConnectionInfo; |
| 19 | 18 |
| 20 namespace base { | 19 namespace base { |
| 21 class DictionaryValue; | 20 class DictionaryValue; |
| 22 class ListValue; | 21 class ListValue; |
| 23 } | 22 } |
| 24 | 23 |
| 25 namespace extensions { | 24 namespace extensions { |
| 26 class Dispatcher; | 25 class Dispatcher; |
| 27 struct Message; | 26 struct Message; |
| (...skipping 19 matching lines...) Expand all Loading... |
| 47 virtual ~ExtensionHelper(); | 46 virtual ~ExtensionHelper(); |
| 48 | 47 |
| 49 int tab_id() const { return tab_id_; } | 48 int tab_id() const { return tab_id_; } |
| 50 int browser_window_id() const { return browser_window_id_; } | 49 int browser_window_id() const { return browser_window_id_; } |
| 51 ViewType view_type() const { return view_type_; } | 50 ViewType view_type() const { return view_type_; } |
| 52 Dispatcher* dispatcher() const { return dispatcher_; } | 51 Dispatcher* dispatcher() const { return dispatcher_; } |
| 53 | 52 |
| 54 private: | 53 private: |
| 55 // RenderViewObserver implementation. | 54 // RenderViewObserver implementation. |
| 56 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; | 55 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; |
| 57 virtual void DidFinishDocumentLoad(blink::WebLocalFrame* frame) OVERRIDE; | |
| 58 virtual void DidFinishLoad(blink::WebLocalFrame* frame) OVERRIDE; | |
| 59 virtual void DidCreateDocumentElement(blink::WebLocalFrame* frame) OVERRIDE; | 56 virtual void DidCreateDocumentElement(blink::WebLocalFrame* frame) OVERRIDE; |
| 60 virtual void DidStartProvisionalLoad(blink::WebLocalFrame* frame) OVERRIDE; | |
| 61 virtual void FrameDetached(blink::WebFrame* frame) OVERRIDE; | |
| 62 virtual void DidMatchCSS( | 57 virtual void DidMatchCSS( |
| 63 blink::WebLocalFrame* frame, | 58 blink::WebLocalFrame* frame, |
| 64 const blink::WebVector<blink::WebString>& newly_matching_selectors, | 59 const blink::WebVector<blink::WebString>& newly_matching_selectors, |
| 65 const blink::WebVector<blink::WebString>& stopped_matching_selectors) | 60 const blink::WebVector<blink::WebString>& stopped_matching_selectors) |
| 66 OVERRIDE; | 61 OVERRIDE; |
| 67 virtual void DidCreateDataSource(blink::WebLocalFrame* frame, | |
| 68 blink::WebDataSource* ds) OVERRIDE; | |
| 69 virtual void DraggableRegionsChanged(blink::WebFrame* frame) OVERRIDE; | 62 virtual void DraggableRegionsChanged(blink::WebFrame* frame) OVERRIDE; |
| 70 | 63 |
| 71 void OnExtensionResponse(int request_id, bool success, | 64 void OnExtensionResponse(int request_id, bool success, |
| 72 const base::ListValue& response, | 65 const base::ListValue& response, |
| 73 const std::string& error); | 66 const std::string& error); |
| 74 void OnExtensionMessageInvoke(const std::string& extension_id, | 67 void OnExtensionMessageInvoke(const std::string& extension_id, |
| 75 const std::string& module_name, | 68 const std::string& module_name, |
| 76 const std::string& function_name, | 69 const std::string& function_name, |
| 77 const base::ListValue& args, | 70 const base::ListValue& args, |
| 78 bool user_gesture); | 71 bool user_gesture); |
| 79 void OnExtensionDispatchOnConnect( | 72 void OnExtensionDispatchOnConnect( |
| 80 int target_port_id, | 73 int target_port_id, |
| 81 const std::string& channel_name, | 74 const std::string& channel_name, |
| 82 const base::DictionaryValue& source_tab, | 75 const base::DictionaryValue& source_tab, |
| 83 const ExtensionMsg_ExternalConnectionInfo& info, | 76 const ExtensionMsg_ExternalConnectionInfo& info, |
| 84 const std::string& tls_channel_id); | 77 const std::string& tls_channel_id); |
| 85 void OnExtensionDeliverMessage(int target_port_id, | 78 void OnExtensionDeliverMessage(int target_port_id, |
| 86 const Message& message); | 79 const Message& message); |
| 87 void OnExtensionDispatchOnDisconnect(int port_id, | 80 void OnExtensionDispatchOnDisconnect(int port_id, |
| 88 const std::string& error_message); | 81 const std::string& error_message); |
| 89 void OnExecuteCode(const ExtensionMsg_ExecuteCode_Params& params); | |
| 90 void OnNotifyRendererViewType(ViewType view_type); | 82 void OnNotifyRendererViewType(ViewType view_type); |
| 91 void OnSetTabId(int tab_id); | 83 void OnSetTabId(int tab_id); |
| 92 void OnUpdateBrowserWindowId(int window_id); | 84 void OnUpdateBrowserWindowId(int window_id); |
| 93 void OnAddMessageToConsole(content::ConsoleMessageLevel level, | 85 void OnAddMessageToConsole(content::ConsoleMessageLevel level, |
| 94 const std::string& message); | 86 const std::string& message); |
| 95 void OnAppWindowClosed(); | 87 void OnAppWindowClosed(); |
| 96 void OnGrantContentScriptPermission(int request_id); | |
| 97 | 88 |
| 98 Dispatcher* dispatcher_; | 89 Dispatcher* dispatcher_; |
| 99 | 90 |
| 100 // Type of view attached with RenderView. | 91 // Type of view attached with RenderView. |
| 101 ViewType view_type_; | 92 ViewType view_type_; |
| 102 | 93 |
| 103 // Id of the tab which the RenderView is attached to. | 94 // Id of the tab which the RenderView is attached to. |
| 104 int tab_id_; | 95 int tab_id_; |
| 105 | 96 |
| 106 // Id number of browser window which RenderView is attached to. | 97 // Id number of browser window which RenderView is attached to. |
| 107 int browser_window_id_; | 98 int browser_window_id_; |
| 108 | 99 |
| 109 DISALLOW_COPY_AND_ASSIGN(ExtensionHelper); | 100 DISALLOW_COPY_AND_ASSIGN(ExtensionHelper); |
| 110 }; | 101 }; |
| 111 | 102 |
| 112 } // namespace extensions | 103 } // namespace extensions |
| 113 | 104 |
| 114 #endif // EXTENSIONS_RENDERER_EXTENSION_HELPER_H_ | 105 #endif // EXTENSIONS_RENDERER_EXTENSION_HELPER_H_ |
| OLD | NEW |