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" |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 bool include_tls_channel_id, | 89 bool include_tls_channel_id, |
90 const base::Callback<void(int)>& callback); | 90 const base::Callback<void(int)>& callback); |
91 void RequestTabPortId(const ExtensionMsg_TabTargetConnectionInfo& info, | 91 void RequestTabPortId(const ExtensionMsg_TabTargetConnectionInfo& info, |
92 const std::string& extension_id, | 92 const std::string& extension_id, |
93 const std::string& channel_name, | 93 const std::string& channel_name, |
94 const base::Callback<void(int)>& callback); | 94 const base::Callback<void(int)>& callback); |
95 void RequestNativeAppPortId(const std::string& native_app_name, | 95 void RequestNativeAppPortId(const std::string& native_app_name, |
96 const base::Callback<void(int)>& callback); | 96 const base::Callback<void(int)>& callback); |
97 | 97 |
98 private: | 98 private: |
| 99 struct PendingPortRequest; |
| 100 |
99 // RenderFrameObserver implementation. | 101 // RenderFrameObserver implementation. |
100 void DidCreateDocumentElement() override; | 102 void DidCreateDocumentElement() override; |
101 void DidCreateNewDocument() override; | 103 void DidCreateNewDocument() override; |
102 void DidMatchCSS( | 104 void DidMatchCSS( |
103 const blink::WebVector<blink::WebString>& newly_matching_selectors, | 105 const blink::WebVector<blink::WebString>& newly_matching_selectors, |
104 const blink::WebVector<blink::WebString>& stopped_matching_selectors) | 106 const blink::WebVector<blink::WebString>& stopped_matching_selectors) |
105 override; | 107 override; |
106 void DidCreateScriptContext(v8::Local<v8::Context>, | 108 void DidCreateScriptContext(v8::Local<v8::Context>, |
107 int extension_group, | 109 int extension_group, |
108 int world_id) override; | 110 int world_id) override; |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 // Callbacks to be run at the next RunScriptsAtDocumentStart notification. | 156 // Callbacks to be run at the next RunScriptsAtDocumentStart notification. |
155 std::vector<base::Closure> document_element_created_callbacks_; | 157 std::vector<base::Closure> document_element_created_callbacks_; |
156 | 158 |
157 // Callbacks to be run at the next RunScriptsAtDocumentEnd notification. | 159 // Callbacks to be run at the next RunScriptsAtDocumentEnd notification. |
158 std::vector<base::Closure> document_load_finished_callbacks_; | 160 std::vector<base::Closure> document_load_finished_callbacks_; |
159 | 161 |
160 // Counter for port requests. | 162 // Counter for port requests. |
161 int next_port_request_id_; | 163 int next_port_request_id_; |
162 | 164 |
163 // Map of port requests to callbacks. | 165 // Map of port requests to callbacks. |
164 std::map<int, base::Callback<void(int)>> pending_port_requests_; | 166 std::map<int, std::unique_ptr<PendingPortRequest>> pending_port_requests_; |
165 | 167 |
166 base::WeakPtrFactory<ExtensionFrameHelper> weak_ptr_factory_; | 168 base::WeakPtrFactory<ExtensionFrameHelper> weak_ptr_factory_; |
167 | 169 |
168 DISALLOW_COPY_AND_ASSIGN(ExtensionFrameHelper); | 170 DISALLOW_COPY_AND_ASSIGN(ExtensionFrameHelper); |
169 }; | 171 }; |
170 | 172 |
171 } // namespace extensions | 173 } // namespace extensions |
172 | 174 |
173 #endif // EXTENSIONS_RENDERER_EXTENSION_FRAME_HELPER_H_ | 175 #endif // EXTENSIONS_RENDERER_EXTENSION_FRAME_HELPER_H_ |
OLD | NEW |