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

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

Issue 7741037: Add WebstoreInlineInstaller (downloads store data, shows the install UI, and starts the install). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Put webstore response in the right directory. Created 9 years, 3 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) 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/lazy_instance.h" 8 #include "base/lazy_instance.h"
9 #include "base/message_loop.h" 9 #include "base/message_loop.h"
10 #include "base/utf_string_conversions.h" 10 #include "base/utf_string_conversions.h"
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 WebURLRequest::TargetIsSubresource, 100 WebURLRequest::TargetIsSubresource,
101 NewCallback(this, &ExtensionHelper::DidDownloadApplicationDefinition))); 101 NewCallback(this, &ExtensionHelper::DidDownloadApplicationDefinition)));
102 return true; 102 return true;
103 } 103 }
104 104
105 void ExtensionHelper::InlineWebstoreInstall(std::string webstore_item_id) { 105 void ExtensionHelper::InlineWebstoreInstall(std::string webstore_item_id) {
106 Send(new ExtensionHostMsg_InlineWebstoreInstall( 106 Send(new ExtensionHostMsg_InlineWebstoreInstall(
107 routing_id(), webstore_item_id)); 107 routing_id(), webstore_item_id));
108 } 108 }
109 109
110 void ExtensionHelper::OnInlineWebstoreInstallResponse(
111 bool success,
112 const std::string& error) {
113 // TODO(mihaip): dispatch these as events to the the WebFrame that initiated
114 // the inline install.
115 if (success) {
116 VLOG(1) << "Inline install succeeded.";
117 } else {
118 VLOG(1) << "Inline install failed: " << error;
119 }
120 }
121
110 bool ExtensionHelper::OnMessageReceived(const IPC::Message& message) { 122 bool ExtensionHelper::OnMessageReceived(const IPC::Message& message) {
111 bool handled = true; 123 bool handled = true;
112 IPC_BEGIN_MESSAGE_MAP(ExtensionHelper, message) 124 IPC_BEGIN_MESSAGE_MAP(ExtensionHelper, message)
113 IPC_MESSAGE_HANDLER(ExtensionMsg_Response, OnExtensionResponse) 125 IPC_MESSAGE_HANDLER(ExtensionMsg_Response, OnExtensionResponse)
114 IPC_MESSAGE_HANDLER(ExtensionMsg_MessageInvoke, OnExtensionMessageInvoke) 126 IPC_MESSAGE_HANDLER(ExtensionMsg_MessageInvoke, OnExtensionMessageInvoke)
115 IPC_MESSAGE_HANDLER(ExtensionMsg_ExecuteCode, OnExecuteCode) 127 IPC_MESSAGE_HANDLER(ExtensionMsg_ExecuteCode, OnExecuteCode)
116 IPC_MESSAGE_HANDLER(ExtensionMsg_GetApplicationInfo, OnGetApplicationInfo) 128 IPC_MESSAGE_HANDLER(ExtensionMsg_GetApplicationInfo, OnGetApplicationInfo)
117 IPC_MESSAGE_HANDLER(ExtensionMsg_UpdateBrowserWindowId, 129 IPC_MESSAGE_HANDLER(ExtensionMsg_UpdateBrowserWindowId,
118 OnUpdateBrowserWindowId) 130 OnUpdateBrowserWindowId)
119 IPC_MESSAGE_HANDLER(ExtensionMsg_NotifyRenderViewType, 131 IPC_MESSAGE_HANDLER(ExtensionMsg_NotifyRenderViewType,
120 OnNotifyRendererViewType) 132 OnNotifyRendererViewType)
133 IPC_MESSAGE_HANDLER(ExtensionMsg_InlineWebstoreInstallResponse,
134 OnInlineWebstoreInstallResponse)
121 IPC_MESSAGE_UNHANDLED(handled = false) 135 IPC_MESSAGE_UNHANDLED(handled = false)
122 IPC_END_MESSAGE_MAP() 136 IPC_END_MESSAGE_MAP()
123 return handled; 137 return handled;
124 } 138 }
125 139
126 void ExtensionHelper::DidFinishDocumentLoad(WebFrame* frame) { 140 void ExtensionHelper::DidFinishDocumentLoad(WebFrame* frame) {
127 extension_dispatcher_->user_script_slave()->InjectScripts( 141 extension_dispatcher_->user_script_slave()->InjectScripts(
128 frame, UserScript::DOCUMENT_END); 142 frame, UserScript::DOCUMENT_END);
129 143
130 SchedulerMap::iterator i = g_schedulers.Get().find(frame); 144 SchedulerMap::iterator i = g_schedulers.Get().find(frame);
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
332 routing_id(), *pending_app_info_)); 346 routing_id(), *pending_app_info_));
333 pending_app_info_.reset(NULL); 347 pending_app_info_.reset(NULL);
334 } 348 }
335 349
336 void ExtensionHelper::AddErrorToRootConsole(const string16& message) { 350 void ExtensionHelper::AddErrorToRootConsole(const string16& message) {
337 if (render_view()->webview() && render_view()->webview()->mainFrame()) { 351 if (render_view()->webview() && render_view()->webview()->mainFrame()) {
338 render_view()->webview()->mainFrame()->addMessageToConsole( 352 render_view()->webview()->mainFrame()->addMessageToConsole(
339 WebConsoleMessage(WebConsoleMessage::LevelError, message)); 353 WebConsoleMessage(WebConsoleMessage::LevelError, message));
340 } 354 }
341 } 355 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698