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 #include "extensions/renderer/extension_helper.h" | 5 #include "extensions/renderer/extension_helper.h" |
6 | 6 |
7 #include "content/public/renderer/render_view.h" | 7 #include "content/public/renderer/render_view.h" |
8 #include "content/public/renderer/render_view_visitor.h" | 8 #include "content/public/renderer/render_view_visitor.h" |
9 #include "extensions/common/api/messaging/message.h" | 9 #include "extensions/common/api/messaging/message.h" |
10 #include "extensions/common/constants.h" | 10 #include "extensions/common/constants.h" |
(...skipping 29 matching lines...) Expand all Loading... |
40 int browser_window_id, | 40 int browser_window_id, |
41 ViewType view_type) | 41 ViewType view_type) |
42 : extension_id_(extension_id), | 42 : extension_id_(extension_id), |
43 browser_window_id_(browser_window_id), | 43 browser_window_id_(browser_window_id), |
44 view_type_(view_type) { | 44 view_type_(view_type) { |
45 } | 45 } |
46 | 46 |
47 std::vector<content::RenderView*> views() { return views_; } | 47 std::vector<content::RenderView*> views() { return views_; } |
48 | 48 |
49 // Returns false to terminate the iteration. | 49 // Returns false to terminate the iteration. |
50 virtual bool Visit(content::RenderView* render_view) OVERRIDE { | 50 virtual bool Visit(content::RenderView* render_view) override { |
51 ExtensionHelper* helper = ExtensionHelper::Get(render_view); | 51 ExtensionHelper* helper = ExtensionHelper::Get(render_view); |
52 if (!ViewTypeMatches(helper->view_type(), view_type_)) | 52 if (!ViewTypeMatches(helper->view_type(), view_type_)) |
53 return true; | 53 return true; |
54 | 54 |
55 GURL url = render_view->GetWebView()->mainFrame()->document().url(); | 55 GURL url = render_view->GetWebView()->mainFrame()->document().url(); |
56 if (!url.SchemeIs(kExtensionScheme)) | 56 if (!url.SchemeIs(kExtensionScheme)) |
57 return true; | 57 return true; |
58 const std::string& extension_id = url.host(); | 58 const std::string& extension_id = url.host(); |
59 if (extension_id != extension_id_) | 59 if (extension_id != extension_id_) |
60 return true; | 60 return true; |
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
256 render_view()->GetWebView()->mainFrame()->mainWorldScriptContext(); | 256 render_view()->GetWebView()->mainFrame()->mainWorldScriptContext(); |
257 ScriptContext* script_context = | 257 ScriptContext* script_context = |
258 dispatcher_->script_context_set().GetByV8Context(v8_context); | 258 dispatcher_->script_context_set().GetByV8Context(v8_context); |
259 if (!script_context) | 259 if (!script_context) |
260 return; | 260 return; |
261 script_context->module_system()->CallModuleMethod("app.window", | 261 script_context->module_system()->CallModuleMethod("app.window", |
262 "onAppWindowClosed"); | 262 "onAppWindowClosed"); |
263 } | 263 } |
264 | 264 |
265 } // namespace extensions | 265 } // namespace extensions |
OLD | NEW |