| 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 "base/macros.h" | 10 #include "base/macros.h" |
| 11 #include "base/memory/weak_ptr.h" | 11 #include "base/memory/weak_ptr.h" |
| 12 #include "content/public/common/console_message_level.h" | 12 #include "content/public/common/console_message_level.h" |
| 13 #include "content/public/renderer/render_frame_observer.h" | 13 #include "content/public/renderer/render_frame_observer.h" |
| 14 #include "content/public/renderer/render_frame_observer_tracker.h" | 14 #include "content/public/renderer/render_frame_observer_tracker.h" |
| 15 #include "extensions/common/view_type.h" | 15 #include "extensions/common/view_type.h" |
| 16 | 16 |
| 17 struct ExtensionMsg_ExternalConnectionInfo; | 17 struct ExtensionMsg_ExternalConnectionInfo; |
| 18 struct ExtensionMsg_TabConnectionInfo; | 18 struct ExtensionMsg_TabConnectionInfo; |
| 19 struct ExtensionMsg_TabTargetConnectionInfo; |
| 19 | 20 |
| 20 namespace base { | 21 namespace base { |
| 21 class ListValue; | 22 class ListValue; |
| 22 } | 23 } |
| 23 | 24 |
| 24 namespace extensions { | 25 namespace extensions { |
| 25 | 26 |
| 26 class Dispatcher; | 27 class Dispatcher; |
| 27 struct Message; | 28 struct Message; |
| 28 class ScriptContext; | 29 class ScriptContext; |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 | 81 |
| 81 // Schedule a callback, to be run at the next RunScriptsAtDocumentEnd call. | 82 // Schedule a callback, to be run at the next RunScriptsAtDocumentEnd call. |
| 82 void ScheduleAtDocumentEnd(const base::Closure& callback); | 83 void ScheduleAtDocumentEnd(const base::Closure& callback); |
| 83 | 84 |
| 84 // Sends a message to the browser requesting a port id. |callback| will be | 85 // Sends a message to the browser requesting a port id. |callback| will be |
| 85 // invoked with the global port id when the browser responds. | 86 // invoked with the global port id when the browser responds. |
| 86 void RequestPortId(const ExtensionMsg_ExternalConnectionInfo& info, | 87 void RequestPortId(const ExtensionMsg_ExternalConnectionInfo& info, |
| 87 const std::string& channel_name, | 88 const std::string& channel_name, |
| 88 bool include_tls_channel_id, | 89 bool include_tls_channel_id, |
| 89 const base::Callback<void(int)>& callback); | 90 const base::Callback<void(int)>& callback); |
| 91 void RequestTabPortId(const ExtensionMsg_TabTargetConnectionInfo& info, |
| 92 const std::string& extension_id, |
| 93 const std::string& channel_name, |
| 94 const base::Callback<void(int)>& callback); |
| 95 void RequestNativeAppPortId(const std::string& native_app_name, |
| 96 const base::Callback<void(int)>& callback); |
| 90 | 97 |
| 91 private: | 98 private: |
| 92 // RenderFrameObserver implementation. | 99 // RenderFrameObserver implementation. |
| 93 void DidCreateDocumentElement() override; | 100 void DidCreateDocumentElement() override; |
| 94 void DidCreateNewDocument() override; | 101 void DidCreateNewDocument() override; |
| 95 void DidMatchCSS( | 102 void DidMatchCSS( |
| 96 const blink::WebVector<blink::WebString>& newly_matching_selectors, | 103 const blink::WebVector<blink::WebString>& newly_matching_selectors, |
| 97 const blink::WebVector<blink::WebString>& stopped_matching_selectors) | 104 const blink::WebVector<blink::WebString>& stopped_matching_selectors) |
| 98 override; | 105 override; |
| 99 void DidCreateScriptContext(v8::Local<v8::Context>, | 106 void DidCreateScriptContext(v8::Local<v8::Context>, |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 157 std::map<int, base::Callback<void(int)>> pending_port_requests_; | 164 std::map<int, base::Callback<void(int)>> pending_port_requests_; |
| 158 | 165 |
| 159 base::WeakPtrFactory<ExtensionFrameHelper> weak_ptr_factory_; | 166 base::WeakPtrFactory<ExtensionFrameHelper> weak_ptr_factory_; |
| 160 | 167 |
| 161 DISALLOW_COPY_AND_ASSIGN(ExtensionFrameHelper); | 168 DISALLOW_COPY_AND_ASSIGN(ExtensionFrameHelper); |
| 162 }; | 169 }; |
| 163 | 170 |
| 164 } // namespace extensions | 171 } // namespace extensions |
| 165 | 172 |
| 166 #endif // EXTENSIONS_RENDERER_EXTENSION_FRAME_HELPER_H_ | 173 #endif // EXTENSIONS_RENDERER_EXTENSION_FRAME_HELPER_H_ |
| OLD | NEW |