Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(52)

Side by Side Diff: chrome/renderer/extensions/extension_helper.cc

Issue 10703111: Cleanup: make ExtensionRequestSender manage its IPC responses directly, rather (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: revert sceopd_observer change Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 pending_app_info_->manifest_url, render_view()->GetWebView()->mainFrame(), 195 pending_app_info_->manifest_url, render_view()->GetWebView()->mainFrame(),
196 WebURLRequest::TargetIsSubresource, 196 WebURLRequest::TargetIsSubresource,
197 base::Bind(&ExtensionHelper::DidDownloadApplicationDefinition, 197 base::Bind(&ExtensionHelper::DidDownloadApplicationDefinition,
198 base::Unretained(this)))); 198 base::Unretained(this))));
199 return true; 199 return true;
200 } 200 }
201 201
202 bool ExtensionHelper::OnMessageReceived(const IPC::Message& message) { 202 bool ExtensionHelper::OnMessageReceived(const IPC::Message& message) {
203 bool handled = true; 203 bool handled = true;
204 IPC_BEGIN_MESSAGE_MAP(ExtensionHelper, message) 204 IPC_BEGIN_MESSAGE_MAP(ExtensionHelper, message)
205 IPC_MESSAGE_HANDLER(ExtensionMsg_Response, OnExtensionResponse)
206 IPC_MESSAGE_HANDLER(ExtensionMsg_MessageInvoke, OnExtensionMessageInvoke) 205 IPC_MESSAGE_HANDLER(ExtensionMsg_MessageInvoke, OnExtensionMessageInvoke)
207 IPC_MESSAGE_HANDLER(ExtensionMsg_DispatchOnConnect, 206 IPC_MESSAGE_HANDLER(ExtensionMsg_DispatchOnConnect,
208 OnExtensionDispatchOnConnect) 207 OnExtensionDispatchOnConnect)
209 IPC_MESSAGE_HANDLER(ExtensionMsg_DeliverMessage, OnExtensionDeliverMessage) 208 IPC_MESSAGE_HANDLER(ExtensionMsg_DeliverMessage, OnExtensionDeliverMessage)
210 IPC_MESSAGE_HANDLER(ExtensionMsg_DispatchOnDisconnect, 209 IPC_MESSAGE_HANDLER(ExtensionMsg_DispatchOnDisconnect,
211 OnExtensionDispatchOnDisconnect) 210 OnExtensionDispatchOnDisconnect)
212 IPC_MESSAGE_HANDLER(ExtensionMsg_ExecuteCode, OnExecuteCode) 211 IPC_MESSAGE_HANDLER(ExtensionMsg_ExecuteCode, OnExecuteCode)
213 IPC_MESSAGE_HANDLER(ExtensionMsg_GetApplicationInfo, OnGetApplicationInfo) 212 IPC_MESSAGE_HANDLER(ExtensionMsg_GetApplicationInfo, OnGetApplicationInfo)
214 IPC_MESSAGE_HANDLER(ExtensionMsg_SetTabId, OnSetTabId) 213 IPC_MESSAGE_HANDLER(ExtensionMsg_SetTabId, OnSetTabId)
215 IPC_MESSAGE_HANDLER(ExtensionMsg_UpdateBrowserWindowId, 214 IPC_MESSAGE_HANDLER(ExtensionMsg_UpdateBrowserWindowId,
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
273 272
274 // Check first if we created a scheduler for the frame, since this function 273 // Check first if we created a scheduler for the frame, since this function
275 // gets called for navigations within the document. 274 // gets called for navigations within the document.
276 if (g_schedulers.Get().count(frame)) 275 if (g_schedulers.Get().count(frame))
277 return; 276 return;
278 277
279 g_schedulers.Get()[frame] = new UserScriptScheduler( 278 g_schedulers.Get()[frame] = new UserScriptScheduler(
280 frame, extension_dispatcher_); 279 frame, extension_dispatcher_);
281 } 280 }
282 281
283 void ExtensionHelper::OnExtensionResponse(int request_id,
284 bool success,
285 const base::ListValue& response,
286 const std::string& error) {
287 extension_dispatcher_->OnExtensionResponse(request_id,
288 success,
289 response,
290 error);
291 }
292
293 void ExtensionHelper::OnExtensionMessageInvoke(const std::string& extension_id, 282 void ExtensionHelper::OnExtensionMessageInvoke(const std::string& extension_id,
294 const std::string& function_name, 283 const std::string& function_name,
295 const base::ListValue& args, 284 const base::ListValue& args,
296 const GURL& event_url, 285 const GURL& event_url,
297 bool user_gesture) { 286 bool user_gesture) {
298 scoped_ptr<WebScopedUserGesture> web_user_gesture; 287 scoped_ptr<WebScopedUserGesture> web_user_gesture;
299 if (user_gesture) { 288 if (user_gesture) {
300 web_user_gesture.reset(new WebScopedUserGesture); 289 web_user_gesture.reset(new WebScopedUserGesture);
301 } 290 }
302 291
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
505 target_level = WebConsoleMessage::LevelWarning; 494 target_level = WebConsoleMessage::LevelWarning;
506 break; 495 break;
507 case content::CONSOLE_MESSAGE_LEVEL_ERROR: 496 case content::CONSOLE_MESSAGE_LEVEL_ERROR:
508 target_level = WebConsoleMessage::LevelError; 497 target_level = WebConsoleMessage::LevelError;
509 break; 498 break;
510 } 499 }
511 render_view()->GetWebView()->mainFrame()->addMessageToConsole( 500 render_view()->GetWebView()->mainFrame()->addMessageToConsole(
512 WebConsoleMessage(target_level, message)); 501 WebConsoleMessage(target_level, message));
513 } 502 }
514 } 503 }
OLDNEW
« no previous file with comments | « chrome/renderer/extensions/extension_helper.h ('k') | chrome/renderer/extensions/extension_request_sender.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698