| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/json/json_value_serializer.h" | 8 #include "base/json/json_value_serializer.h" |
| 9 #include "base/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
| 10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 190 return; | 190 return; |
| 191 | 191 |
| 192 g_schedulers.Get()[frame] = new UserScriptIdleScheduler( | 192 g_schedulers.Get()[frame] = new UserScriptIdleScheduler( |
| 193 frame, extension_dispatcher_); | 193 frame, extension_dispatcher_); |
| 194 } | 194 } |
| 195 | 195 |
| 196 void ExtensionHelper::OnExtensionResponse(int request_id, | 196 void ExtensionHelper::OnExtensionResponse(int request_id, |
| 197 bool success, | 197 bool success, |
| 198 const std::string& response, | 198 const std::string& response, |
| 199 const std::string& error) { | 199 const std::string& error) { |
| 200 std::string extension_id; |
| 200 ExtensionProcessBindings::HandleResponse( | 201 ExtensionProcessBindings::HandleResponse( |
| 201 extension_dispatcher_->v8_context_set(), request_id, success, | 202 extension_dispatcher_->v8_context_set(), request_id, success, |
| 202 response, error); | 203 response, error, &extension_id); |
| 204 |
| 205 if (CommandLine::ForCurrentProcess()->HasSwitch( |
| 206 switches::kEnableLazyBackgroundPages)) |
| 207 extension_dispatcher_->CheckIdleStatus(extension_id); |
| 203 } | 208 } |
| 204 | 209 |
| 205 void ExtensionHelper::OnExtensionMessageInvoke(const std::string& extension_id, | 210 void ExtensionHelper::OnExtensionMessageInvoke(const std::string& extension_id, |
| 206 const std::string& function_name, | 211 const std::string& function_name, |
| 207 const ListValue& args, | 212 const ListValue& args, |
| 208 const GURL& event_url) { | 213 const GURL& event_url) { |
| 209 extension_dispatcher_->v8_context_set().DispatchChromeHiddenMethod( | 214 extension_dispatcher_->v8_context_set().DispatchChromeHiddenMethod( |
| 210 extension_id, function_name, args, render_view(), event_url); | 215 extension_id, function_name, args, render_view(), event_url); |
| 211 } | 216 } |
| 212 | 217 |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 358 routing_id(), *pending_app_info_)); | 363 routing_id(), *pending_app_info_)); |
| 359 pending_app_info_.reset(NULL); | 364 pending_app_info_.reset(NULL); |
| 360 } | 365 } |
| 361 | 366 |
| 362 void ExtensionHelper::AddErrorToRootConsole(const string16& message) { | 367 void ExtensionHelper::AddErrorToRootConsole(const string16& message) { |
| 363 if (render_view()->GetWebView() && render_view()->GetWebView()->mainFrame()) { | 368 if (render_view()->GetWebView() && render_view()->GetWebView()->mainFrame()) { |
| 364 render_view()->GetWebView()->mainFrame()->addMessageToConsole( | 369 render_view()->GetWebView()->mainFrame()->addMessageToConsole( |
| 365 WebConsoleMessage(WebConsoleMessage::LevelError, message)); | 370 WebConsoleMessage(WebConsoleMessage::LevelError, message)); |
| 366 } | 371 } |
| 367 } | 372 } |
| OLD | NEW |