| 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 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 } | 103 } |
| 104 | 104 |
| 105 // static | 105 // static |
| 106 content::RenderView* ExtensionHelper::GetBackgroundPage( | 106 content::RenderView* ExtensionHelper::GetBackgroundPage( |
| 107 const std::string& extension_id) { | 107 const std::string& extension_id) { |
| 108 ViewAccumulator accumulator(extension_id, extension_misc::kUnknownWindowId, | 108 ViewAccumulator accumulator(extension_id, extension_misc::kUnknownWindowId, |
| 109 VIEW_TYPE_EXTENSION_BACKGROUND_PAGE); | 109 VIEW_TYPE_EXTENSION_BACKGROUND_PAGE); |
| 110 content::RenderView::ForEach(&accumulator); | 110 content::RenderView::ForEach(&accumulator); |
| 111 CHECK_LE(accumulator.views().size(), 1u); | 111 CHECK_LE(accumulator.views().size(), 1u); |
| 112 if (accumulator.views().size() == 0) | 112 if (accumulator.views().size() == 0) |
| 113 return NULL; | 113 return nullptr; |
| 114 return accumulator.views()[0]; | 114 return accumulator.views()[0]; |
| 115 } | 115 } |
| 116 | 116 |
| 117 ExtensionHelper::ExtensionHelper(content::RenderView* render_view, | 117 ExtensionHelper::ExtensionHelper(content::RenderView* render_view, |
| 118 Dispatcher* dispatcher) | 118 Dispatcher* dispatcher) |
| 119 : content::RenderViewObserver(render_view), | 119 : content::RenderViewObserver(render_view), |
| 120 content::RenderViewObserverTracker<ExtensionHelper>(render_view), | 120 content::RenderViewObserverTracker<ExtensionHelper>(render_view), |
| 121 dispatcher_(dispatcher), | 121 dispatcher_(dispatcher), |
| 122 view_type_(VIEW_TYPE_INVALID), | 122 view_type_(VIEW_TYPE_INVALID), |
| 123 tab_id_(-1), | 123 tab_id_(-1), |
| (...skipping 132 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 |