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

Side by Side Diff: chrome/browser/extensions/tab_helper.cc

Issue 10907104: Support an --install-from-webstore command line switch (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: updated comment Created 8 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) 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/browser/extensions/tab_helper.h" 5 #include "chrome/browser/extensions/tab_helper.h"
6 6
7 #include "chrome/browser/extensions/crx_installer.h" 7 #include "chrome/browser/extensions/crx_installer.h"
8 #include "chrome/browser/extensions/app_notify_channel_ui.h" 8 #include "chrome/browser/extensions/app_notify_channel_ui.h"
9 #include "chrome/browser/extensions/extension_service.h" 9 #include "chrome/browser/extensions/extension_service.h"
10 #include "chrome/browser/extensions/extension_tab_util.h" 10 #include "chrome/browser/extensions/extension_tab_util.h"
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 scoped_refptr<CrxInstaller> installer( 238 scoped_refptr<CrxInstaller> installer(
239 CrxInstaller::Create(extension_service, prompt)); 239 CrxInstaller::Create(extension_service, prompt));
240 installer->InstallWebApp(info); 240 installer->InstallWebApp(info);
241 } 241 }
242 242
243 void TabHelper::OnInlineWebstoreInstall( 243 void TabHelper::OnInlineWebstoreInstall(
244 int install_id, 244 int install_id,
245 int return_route_id, 245 int return_route_id,
246 const std::string& webstore_item_id, 246 const std::string& webstore_item_id,
247 const GURL& requestor_url) { 247 const GURL& requestor_url) {
248 WebstoreInlineInstaller::Callback callback =
249 base::Bind(&TabHelper::OnInlineInstallComplete, base::Unretained(this),
250 install_id, return_route_id);
248 scoped_refptr<WebstoreInlineInstaller> installer(new WebstoreInlineInstaller( 251 scoped_refptr<WebstoreInlineInstaller> installer(new WebstoreInlineInstaller(
249 web_contents(), 252 web_contents(),
250 install_id,
251 return_route_id,
252 webstore_item_id, 253 webstore_item_id,
254 true,
253 requestor_url, 255 requestor_url,
254 this)); 256 callback));
255 installer->BeginInstall(); 257 installer->BeginInstall();
256 } 258 }
257 259
258 void TabHelper::OnGetAppNotifyChannel(const GURL& requestor_url, 260 void TabHelper::OnGetAppNotifyChannel(const GURL& requestor_url,
259 const std::string& client_id, 261 const std::string& client_id,
260 int return_route_id, 262 int return_route_id,
261 int callback_id) { 263 int callback_id) {
262 // Check for permission first. 264 // Check for permission first.
263 Profile* profile = 265 Profile* profile =
264 Profile::FromBrowserContext(web_contents()->GetBrowserContext()); 266 Profile::FromBrowserContext(web_contents()->GetBrowserContext());
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
394 if (!image.IsEmpty()) { 396 if (!image.IsEmpty()) {
395 extension_app_icon_ = *image.ToSkBitmap(); 397 extension_app_icon_ = *image.ToSkBitmap();
396 web_contents()->NotifyNavigationStateChanged(content::INVALIDATE_TYPE_TAB); 398 web_contents()->NotifyNavigationStateChanged(content::INVALIDATE_TYPE_TAB);
397 } 399 }
398 } 400 }
399 401
400 WindowController* TabHelper::GetExtensionWindowController() const { 402 WindowController* TabHelper::GetExtensionWindowController() const {
401 return ExtensionTabUtil::GetWindowControllerOfTab(web_contents()); 403 return ExtensionTabUtil::GetWindowControllerOfTab(web_contents());
402 } 404 }
403 405
404 void TabHelper::OnInlineInstallSuccess(int install_id, int return_route_id) { 406 void TabHelper::OnInlineInstallComplete(int install_id,
405 Send(new ExtensionMsg_InlineWebstoreInstallResponse( 407 int return_route_id,
406 return_route_id, install_id, true, "")); 408 bool success,
407 } 409 const std::string& error) {
408 410 if (success) {
409 void TabHelper::OnInlineInstallFailure(int install_id, 411 Send(new ExtensionMsg_InlineWebstoreInstallResponse(
410 int return_route_id, 412 return_route_id, install_id, true, ""));
411 const std::string& error) { 413 } else {
412 Send(new ExtensionMsg_InlineWebstoreInstallResponse( 414 Send(new ExtensionMsg_InlineWebstoreInstallResponse(
413 return_route_id, install_id, false, error)); 415 return_route_id, install_id, false, error));
416 }
414 } 417 }
415 418
416 WebContents* TabHelper::GetAssociatedWebContents() const { 419 WebContents* TabHelper::GetAssociatedWebContents() const {
417 return web_contents(); 420 return web_contents();
418 } 421 }
419 422
420 void TabHelper::GetApplicationInfo(int32 page_id) { 423 void TabHelper::GetApplicationInfo(int32 page_id) {
421 Send(new ExtensionMsg_GetApplicationInfo(routing_id(), page_id)); 424 Send(new ExtensionMsg_GetApplicationInfo(routing_id(), page_id));
422 } 425 }
423 426
(...skipping 12 matching lines...) Expand all
436 // malware site etc). When this happens, we abort the shortcut update. 439 // malware site etc). When this happens, we abort the shortcut update.
437 NavigationEntry* entry = controller.GetLastCommittedEntry(); 440 NavigationEntry* entry = controller.GetLastCommittedEntry();
438 if (entry) 441 if (entry)
439 GetApplicationInfo(entry->GetPageID()); 442 GetApplicationInfo(entry->GetPageID());
440 else 443 else
441 pending_web_app_action_ = NONE; 444 pending_web_app_action_ = NONE;
442 } 445 }
443 } 446 }
444 447
445 } // namespace extensions 448 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698