| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "chrome/renderer/extensions/extension_helper.h" | 5 #include "chrome/renderer/extensions/extension_helper.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/json/json_string_value_serializer.h" | 10 #include "base/json/json_string_value_serializer.h" |
| (...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 346 void ExtensionHelper::OnUpdateBrowserWindowId(int window_id) { | 346 void ExtensionHelper::OnUpdateBrowserWindowId(int window_id) { |
| 347 browser_window_id_ = window_id; | 347 browser_window_id_ = window_id; |
| 348 } | 348 } |
| 349 | 349 |
| 350 void ExtensionHelper::OnAddMessageToConsole(ConsoleMessageLevel level, | 350 void ExtensionHelper::OnAddMessageToConsole(ConsoleMessageLevel level, |
| 351 const std::string& message) { | 351 const std::string& message) { |
| 352 console::AddMessage(render_view(), level, message); | 352 console::AddMessage(render_view(), level, message); |
| 353 } | 353 } |
| 354 | 354 |
| 355 void ExtensionHelper::OnAppWindowClosed() { | 355 void ExtensionHelper::OnAppWindowClosed() { |
| 356 v8::HandleScope scope; | 356 v8::HandleScope scope(v8::Isolate::GetCurrent()); |
| 357 v8::Handle<v8::Context> script_context = | 357 v8::Handle<v8::Context> script_context = |
| 358 render_view()->GetWebView()->mainFrame()->mainWorldScriptContext(); | 358 render_view()->GetWebView()->mainFrame()->mainWorldScriptContext(); |
| 359 ChromeV8Context* chrome_v8_context = | 359 ChromeV8Context* chrome_v8_context = |
| 360 dispatcher_->v8_context_set().GetByV8Context(script_context); | 360 dispatcher_->v8_context_set().GetByV8Context(script_context); |
| 361 if (!chrome_v8_context) | 361 if (!chrome_v8_context) |
| 362 return; | 362 return; |
| 363 chrome_v8_context->module_system()->CallModuleMethod( | 363 chrome_v8_context->module_system()->CallModuleMethod( |
| 364 "app.window", "onAppWindowClosed"); | 364 "app.window", "onAppWindowClosed"); |
| 365 } | 365 } |
| 366 | 366 |
| 367 } // namespace extensions | 367 } // namespace extensions |
| OLD | NEW |