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 #include "extensions/renderer/extension_frame_helper.h" | 5 #include "extensions/renderer/extension_frame_helper.h" |
6 | 6 |
7 #include "base/metrics/histogram_macros.h" | 7 #include "base/metrics/histogram_macros.h" |
8 #include "base/strings/string_util.h" | 8 #include "base/strings/string_util.h" |
9 #include "base/timer/elapsed_timer.h" | 9 #include "base/timer/elapsed_timer.h" |
10 #include "content/public/renderer/render_frame.h" | 10 #include "content/public/renderer/render_frame.h" |
11 #include "extensions/common/api/messaging/message.h" | 11 #include "extensions/common/api/messaging/message.h" |
12 #include "extensions/common/api/messaging/port_id.h" | 12 #include "extensions/common/api/messaging/port_id.h" |
13 #include "extensions/common/constants.h" | 13 #include "extensions/common/constants.h" |
14 #include "extensions/common/extension_messages.h" | 14 #include "extensions/common/extension_messages.h" |
15 #include "extensions/common/manifest_handlers/background_info.h" | 15 #include "extensions/common/manifest_handlers/background_info.h" |
16 #include "extensions/renderer/console.h" | 16 #include "extensions/renderer/console.h" |
17 #include "extensions/renderer/content_watcher.h" | 17 #include "extensions/renderer/content_watcher.h" |
18 #include "extensions/renderer/dispatcher.h" | 18 #include "extensions/renderer/dispatcher.h" |
19 #include "extensions/renderer/messaging_bindings.h" | 19 #include "extensions/renderer/messaging_bindings.h" |
20 #include "extensions/renderer/script_context.h" | 20 #include "extensions/renderer/script_context.h" |
21 #include "third_party/WebKit/public/platform/WebSecurityOrigin.h" | 21 #include "third_party/WebKit/public/platform/WebSecurityOrigin.h" |
22 #include "third_party/WebKit/public/web/WebConsoleMessage.h" | 22 #include "third_party/WebKit/public/web/WebConsoleMessage.h" |
23 #include "third_party/WebKit/public/web/WebDocument.h" | 23 #include "third_party/WebKit/public/web/WebDocument.h" |
24 #include "third_party/WebKit/public/web/WebLocalFrame.h" | 24 #include "third_party/WebKit/public/web/WebLocalFrame.h" |
25 | 25 |
26 namespace extensions { | 26 namespace extensions { |
27 | 27 |
28 namespace { | 28 namespace { |
29 | 29 |
30 base::LazyInstance<std::set<const ExtensionFrameHelper*>> g_frame_helpers = | 30 base::LazyInstance<std::set<const ExtensionFrameHelper*>>::DestructorAtExit |
31 LAZY_INSTANCE_INITIALIZER; | 31 g_frame_helpers = LAZY_INSTANCE_INITIALIZER; |
32 | 32 |
33 // Returns true if the render frame corresponding with |frame_helper| matches | 33 // Returns true if the render frame corresponding with |frame_helper| matches |
34 // the given criteria. | 34 // the given criteria. |
35 bool RenderFrameMatches(const ExtensionFrameHelper* frame_helper, | 35 bool RenderFrameMatches(const ExtensionFrameHelper* frame_helper, |
36 ViewType match_view_type, | 36 ViewType match_view_type, |
37 int match_window_id, | 37 int match_window_id, |
38 int match_tab_id, | 38 int match_tab_id, |
39 const std::string& match_extension_id) { | 39 const std::string& match_extension_id) { |
40 if (match_view_type != VIEW_TYPE_INVALID && | 40 if (match_view_type != VIEW_TYPE_INVALID && |
41 frame_helper->view_type() != match_view_type) | 41 frame_helper->view_type() != match_view_type) |
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
317 const base::ListValue& args) { | 317 const base::ListValue& args) { |
318 extension_dispatcher_->InvokeModuleSystemMethod( | 318 extension_dispatcher_->InvokeModuleSystemMethod( |
319 render_frame(), extension_id, module_name, function_name, args); | 319 render_frame(), extension_id, module_name, function_name, args); |
320 } | 320 } |
321 | 321 |
322 void ExtensionFrameHelper::OnDestruct() { | 322 void ExtensionFrameHelper::OnDestruct() { |
323 delete this; | 323 delete this; |
324 } | 324 } |
325 | 325 |
326 } // namespace extensions | 326 } // namespace extensions |
OLD | NEW |