| 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_RENDERER_EXTENSION_FRAME_HELPER_H_ | 5 #ifndef EXTENSIONS_RENDERER_EXTENSION_FRAME_HELPER_H_ |
| 6 #define EXTENSIONS_RENDERER_EXTENSION_FRAME_HELPER_H_ | 6 #define EXTENSIONS_RENDERER_EXTENSION_FRAME_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" |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 // isn't one in this process. | 46 // isn't one in this process. |
| 47 static content::RenderFrame* GetBackgroundPageFrame( | 47 static content::RenderFrame* GetBackgroundPageFrame( |
| 48 const std::string& extension_id); | 48 const std::string& extension_id); |
| 49 | 49 |
| 50 // Returns true if the given |context| is for any frame in the extension's | 50 // Returns true if the given |context| is for any frame in the extension's |
| 51 // event page. | 51 // event page. |
| 52 // TODO(devlin): This isn't really used properly, and should probably be | 52 // TODO(devlin): This isn't really used properly, and should probably be |
| 53 // deleted. | 53 // deleted. |
| 54 static bool IsContextForEventPage(const ScriptContext* context); | 54 static bool IsContextForEventPage(const ScriptContext* context); |
| 55 | 55 |
| 56 // Returns the RenderFrame for the given |context|, or null if one cannot be |
| 57 // found. |
| 58 static content::RenderFrame* RenderFrameForContext( |
| 59 const ScriptContext* context); |
| 60 |
| 56 ViewType view_type() const { return view_type_; } | 61 ViewType view_type() const { return view_type_; } |
| 57 int tab_id() const { return tab_id_; } | 62 int tab_id() const { return tab_id_; } |
| 58 int browser_window_id() const { return browser_window_id_; } | 63 int browser_window_id() const { return browser_window_id_; } |
| 59 const std::string& tab_extension_owner_id() const { | 64 const std::string& tab_extension_owner_id() const { |
| 60 return tab_extension_owner_id_; | 65 return tab_extension_owner_id_; |
| 61 } | 66 } |
| 62 | 67 |
| 63 private: | 68 private: |
| 64 // RenderFrameObserver implementation. | 69 // RenderFrameObserver implementation. |
| 65 void DidCreateScriptContext(v8::Local<v8::Context>, | 70 void DidCreateScriptContext(v8::Local<v8::Context>, |
| 66 int extension_group, | 71 int extension_group, |
| 67 int world_id) override; | 72 int world_id) override; |
| 68 void WillReleaseScriptContext(v8::Local<v8::Context>, int world_id) override; | 73 void WillReleaseScriptContext(v8::Local<v8::Context>, int world_id) override; |
| 69 bool OnMessageReceived(const IPC::Message& message) override; | 74 bool OnMessageReceived(const IPC::Message& message) override; |
| 70 | 75 |
| 71 // IPC handlers. | 76 // IPC handlers. |
| 72 void OnAddMessageToConsole(content::ConsoleMessageLevel level, | |
| 73 const std::string& message); | |
| 74 void OnExtensionDispatchOnConnect( | 77 void OnExtensionDispatchOnConnect( |
| 75 int target_port_id, | 78 int target_port_id, |
| 76 const std::string& channel_name, | 79 const std::string& channel_name, |
| 77 const ExtensionMsg_TabConnectionInfo& source, | 80 const ExtensionMsg_TabConnectionInfo& source, |
| 78 const ExtensionMsg_ExternalConnectionInfo& info, | 81 const ExtensionMsg_ExternalConnectionInfo& info, |
| 79 const std::string& tls_channel_id); | 82 const std::string& tls_channel_id); |
| 80 void OnExtensionDeliverMessage(int target_port_id, | 83 void OnExtensionDeliverMessage(int target_port_id, |
| 81 const Message& message); | 84 const Message& message); |
| 82 void OnExtensionDispatchOnDisconnect(int port_id, | 85 void OnExtensionDispatchOnDisconnect(int port_id, |
| 83 const std::string& error_message); | 86 const std::string& error_message); |
| (...skipping 21 matching lines...) Expand all Loading... |
| 105 std::string tab_extension_owner_id_; | 108 std::string tab_extension_owner_id_; |
| 106 | 109 |
| 107 Dispatcher* extension_dispatcher_; | 110 Dispatcher* extension_dispatcher_; |
| 108 | 111 |
| 109 DISALLOW_COPY_AND_ASSIGN(ExtensionFrameHelper); | 112 DISALLOW_COPY_AND_ASSIGN(ExtensionFrameHelper); |
| 110 }; | 113 }; |
| 111 | 114 |
| 112 } // namespace extensions | 115 } // namespace extensions |
| 113 | 116 |
| 114 #endif // EXTENSIONS_RENDERER_EXTENSION_FRAME_HELPER_H_ | 117 #endif // EXTENSIONS_RENDERER_EXTENSION_FRAME_HELPER_H_ |
| OLD | NEW |