| 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 "base/lazy_instance.h" | 7 #include "base/lazy_instance.h" |
| 8 #include "content/public/renderer/render_view.h" | 8 #include "content/public/renderer/render_view.h" |
| 9 #include "content/public/renderer/render_view_visitor.h" | 9 #include "content/public/renderer/render_view_visitor.h" |
| 10 #include "extensions/common/api/messaging/message.h" | 10 #include "extensions/common/api/messaging/message.h" |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 OnExtensionDispatchOnDisconnect) | 151 OnExtensionDispatchOnDisconnect) |
| 152 IPC_MESSAGE_HANDLER(ExtensionMsg_ExecuteCode, OnExecuteCode) | 152 IPC_MESSAGE_HANDLER(ExtensionMsg_ExecuteCode, OnExecuteCode) |
| 153 IPC_MESSAGE_HANDLER(ExtensionMsg_SetTabId, OnSetTabId) | 153 IPC_MESSAGE_HANDLER(ExtensionMsg_SetTabId, OnSetTabId) |
| 154 IPC_MESSAGE_HANDLER(ExtensionMsg_UpdateBrowserWindowId, | 154 IPC_MESSAGE_HANDLER(ExtensionMsg_UpdateBrowserWindowId, |
| 155 OnUpdateBrowserWindowId) | 155 OnUpdateBrowserWindowId) |
| 156 IPC_MESSAGE_HANDLER(ExtensionMsg_NotifyRenderViewType, | 156 IPC_MESSAGE_HANDLER(ExtensionMsg_NotifyRenderViewType, |
| 157 OnNotifyRendererViewType) | 157 OnNotifyRendererViewType) |
| 158 IPC_MESSAGE_HANDLER(ExtensionMsg_AddMessageToConsole, | 158 IPC_MESSAGE_HANDLER(ExtensionMsg_AddMessageToConsole, |
| 159 OnAddMessageToConsole) | 159 OnAddMessageToConsole) |
| 160 IPC_MESSAGE_HANDLER(ExtensionMsg_AppWindowClosed, | 160 IPC_MESSAGE_HANDLER(ExtensionMsg_AppWindowClosed, |
| 161 OnAppWindowClosed); | 161 OnAppWindowClosed) |
| 162 IPC_MESSAGE_HANDLER(ExtensionMsg_GrantContentScriptPermission, |
| 163 OnGrantContentScriptPermission) |
| 162 IPC_MESSAGE_UNHANDLED(handled = false) | 164 IPC_MESSAGE_UNHANDLED(handled = false) |
| 163 IPC_END_MESSAGE_MAP() | 165 IPC_END_MESSAGE_MAP() |
| 164 return handled; | 166 return handled; |
| 165 } | 167 } |
| 166 | 168 |
| 167 void ExtensionHelper::DidFinishDocumentLoad(WebLocalFrame* frame) { | 169 void ExtensionHelper::DidFinishDocumentLoad(WebLocalFrame* frame) { |
| 168 dispatcher_->user_script_slave()->InjectScripts( | 170 dispatcher_->user_script_slave()->InjectScripts( |
| 169 frame, UserScript::DOCUMENT_END); | 171 frame, UserScript::DOCUMENT_END); |
| 170 | 172 |
| 171 SchedulerMap::iterator i = g_schedulers.Get().find(frame); | 173 SchedulerMap::iterator i = g_schedulers.Get().find(frame); |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 339 v8::Handle<v8::Context> v8_context = | 341 v8::Handle<v8::Context> v8_context = |
| 340 render_view()->GetWebView()->mainFrame()->mainWorldScriptContext(); | 342 render_view()->GetWebView()->mainFrame()->mainWorldScriptContext(); |
| 341 ScriptContext* script_context = | 343 ScriptContext* script_context = |
| 342 dispatcher_->script_context_set().GetByV8Context(v8_context); | 344 dispatcher_->script_context_set().GetByV8Context(v8_context); |
| 343 if (!script_context) | 345 if (!script_context) |
| 344 return; | 346 return; |
| 345 script_context->module_system()->CallModuleMethod("app.window", | 347 script_context->module_system()->CallModuleMethod("app.window", |
| 346 "onAppWindowClosed"); | 348 "onAppWindowClosed"); |
| 347 } | 349 } |
| 348 | 350 |
| 351 void ExtensionHelper::OnGrantContentScriptPermission(int request_id) { |
| 352 dispatcher_->user_script_slave()->OnContentScriptGrantedPermission( |
| 353 render_view(), request_id); |
| 354 } |
| 355 |
| 349 } // namespace extensions | 356 } // namespace extensions |
| OLD | NEW |