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/browser/extensions/api/webstore_private/webstore_private_api.cc

Issue 16295003: Update chrome/ to use scoped_refptr<T>::get() rather than implicit "operator T*" (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased Created 7 years, 6 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/api/webstore_private/webstore_private_api.h" 5 #include "chrome/browser/extensions/api/webstore_private/webstore_private_api.h"
6 6
7 #include "apps/app_launcher.h" 7 #include "apps/app_launcher.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/lazy_instance.h" 10 #include "base/lazy_instance.h"
(...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after
409 409
410 std::string error; 410 std::string error;
411 dummy_extension_ = ExtensionInstallPrompt::GetLocalizedExtensionForDisplay( 411 dummy_extension_ = ExtensionInstallPrompt::GetLocalizedExtensionForDisplay(
412 parsed_manifest_.get(), 412 parsed_manifest_.get(),
413 Extension::FROM_WEBSTORE, 413 Extension::FROM_WEBSTORE,
414 id, 414 id,
415 localized_name_, 415 localized_name_,
416 std::string(), 416 std::string(),
417 &error); 417 &error);
418 418
419 if (!dummy_extension_) { 419 if (!dummy_extension_.get()) {
420 OnWebstoreParseFailure(id_, WebstoreInstallHelper::Delegate::MANIFEST_ERROR, 420 OnWebstoreParseFailure(id_,
421 WebstoreInstallHelper::Delegate::MANIFEST_ERROR,
421 kInvalidManifestError); 422 kInvalidManifestError);
422 return; 423 return;
423 } 424 }
424 425
425 SigninManagerBase* signin_manager = 426 SigninManagerBase* signin_manager =
426 SigninManagerFactory::GetForProfile(profile()); 427 SigninManagerFactory::GetForProfile(profile());
427 if (dummy_extension_->is_platform_app() && 428 if (dummy_extension_->is_platform_app() &&
428 signin_manager->GetAuthenticatedUsername().empty() && 429 signin_manager->GetAuthenticatedUsername().empty() &&
429 signin_manager->AuthInProgress()) { 430 signin_manager->AuthInProgress()) {
430 signin_tracker_.reset(new SigninTracker(profile(), this)); 431 signin_tracker_.reset(new SigninTracker(profile(), this));
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
483 SigninCompletedOrNotNeeded(); 484 SigninCompletedOrNotNeeded();
484 } 485 }
485 486
486 void BeginInstallWithManifestFunction::SigninCompletedOrNotNeeded() { 487 void BeginInstallWithManifestFunction::SigninCompletedOrNotNeeded() {
487 content::WebContents* web_contents = GetAssociatedWebContents(); 488 content::WebContents* web_contents = GetAssociatedWebContents();
488 if (!web_contents) // The browser window has gone away. 489 if (!web_contents) // The browser window has gone away.
489 return; 490 return;
490 install_prompt_.reset(new ExtensionInstallPrompt(web_contents)); 491 install_prompt_.reset(new ExtensionInstallPrompt(web_contents));
491 install_prompt_->ConfirmWebstoreInstall( 492 install_prompt_->ConfirmWebstoreInstall(
492 this, 493 this,
493 dummy_extension_, 494 dummy_extension_.get(),
494 &icon_, 495 &icon_,
495 ExtensionInstallPrompt::GetDefaultShowDialogCallback()); 496 ExtensionInstallPrompt::GetDefaultShowDialogCallback());
496 // Control flow finishes up in InstallUIProceed or InstallUIAbort. 497 // Control flow finishes up in InstallUIProceed or InstallUIAbort.
497 } 498 }
498 499
499 void BeginInstallWithManifestFunction::InstallUIProceed() { 500 void BeginInstallWithManifestFunction::InstallUIProceed() {
500 // This gets cleared in CrxInstaller::ConfirmInstall(). TODO(asargent) - in 501 // This gets cleared in CrxInstaller::ConfirmInstall(). TODO(asargent) - in
501 // the future we may also want to add time-based expiration, where a whitelist 502 // the future we may also want to add time-based expiration, where a whitelist
502 // entry is only valid for some number of minutes. 503 // entry is only valid for some number of minutes.
503 scoped_ptr<WebstoreInstaller::Approval> approval( 504 scoped_ptr<WebstoreInstaller::Approval> approval(
504 WebstoreInstaller::Approval::CreateWithNoInstallPrompt( 505 WebstoreInstaller::Approval::CreateWithNoInstallPrompt(
505 profile(), id_, parsed_manifest_.Pass())); 506 profile(), id_, parsed_manifest_.Pass()));
506 approval->use_app_installed_bubble = use_app_installed_bubble_; 507 approval->use_app_installed_bubble = use_app_installed_bubble_;
507 approval->enable_launcher = enable_launcher_; 508 approval->enable_launcher = enable_launcher_;
508 approval->installing_icon = gfx::ImageSkia::CreateFrom1xBitmap(icon_); 509 approval->installing_icon = gfx::ImageSkia::CreateFrom1xBitmap(icon_);
509 g_pending_approvals.Get().PushApproval(approval.Pass()); 510 g_pending_approvals.Get().PushApproval(approval.Pass());
510 511
511 SetResultCode(ERROR_NONE); 512 SetResultCode(ERROR_NONE);
512 SendResponse(true); 513 SendResponse(true);
513 514
514 // The Permissions_Install histogram is recorded from the ExtensionService 515 // The Permissions_Install histogram is recorded from the ExtensionService
515 // for all extension installs, so we only need to record the web store 516 // for all extension installs, so we only need to record the web store
516 // specific histogram here. 517 // specific histogram here.
517 ExtensionService::RecordPermissionMessagesHistogram( 518 ExtensionService::RecordPermissionMessagesHistogram(
518 dummy_extension_, "Extensions.Permissions_WebStoreInstall"); 519 dummy_extension_.get(), "Extensions.Permissions_WebStoreInstall");
519 520
520 // Matches the AddRef in RunImpl(). 521 // Matches the AddRef in RunImpl().
521 Release(); 522 Release();
522 } 523 }
523 524
524 void BeginInstallWithManifestFunction::InstallUIAbort(bool user_initiated) { 525 void BeginInstallWithManifestFunction::InstallUIAbort(bool user_initiated) {
525 error_ = kUserCancelledError; 526 error_ = kUserCancelledError;
526 SetResultCode(USER_CANCELLED); 527 SetResultCode(USER_CANCELLED);
527 g_pending_installs.Get().EraseInstall(profile_, id_); 528 g_pending_installs.Get().EraseInstall(profile_, id_);
528 SendResponse(false); 529 SendResponse(false);
529 530
530 // The web store install histograms are a subset of the install histograms. 531 // The web store install histograms are a subset of the install histograms.
531 // We need to record both histograms here since CrxInstaller::InstallUIAbort 532 // We need to record both histograms here since CrxInstaller::InstallUIAbort
532 // is never called for web store install cancellations. 533 // is never called for web store install cancellations.
533 std::string histogram_name = user_initiated ? 534 std::string histogram_name = user_initiated ?
534 "Extensions.Permissions_WebStoreInstallCancel" : 535 "Extensions.Permissions_WebStoreInstallCancel" :
535 "Extensions.Permissions_WebStoreInstallAbort"; 536 "Extensions.Permissions_WebStoreInstallAbort";
536 ExtensionService::RecordPermissionMessagesHistogram( 537 ExtensionService::RecordPermissionMessagesHistogram(dummy_extension_.get(),
537 dummy_extension_, histogram_name.c_str()); 538 histogram_name.c_str());
538 539
539 histogram_name = user_initiated ? 540 histogram_name = user_initiated ?
540 "Extensions.Permissions_InstallCancel" : 541 "Extensions.Permissions_InstallCancel" :
541 "Extensions.Permissions_InstallAbort"; 542 "Extensions.Permissions_InstallAbort";
542 ExtensionService::RecordPermissionMessagesHistogram( 543 ExtensionService::RecordPermissionMessagesHistogram(dummy_extension_.get(),
543 dummy_extension_, histogram_name.c_str()); 544 histogram_name.c_str());
544 545
545 // Matches the AddRef in RunImpl(). 546 // Matches the AddRef in RunImpl().
546 Release(); 547 Release();
547 } 548 }
548 549
549 CompleteInstallFunction::CompleteInstallFunction() {} 550 CompleteInstallFunction::CompleteInstallFunction() {}
550 551
551 CompleteInstallFunction::~CompleteInstallFunction() {} 552 CompleteInstallFunction::~CompleteInstallFunction() {}
552 553
553 bool CompleteInstallFunction::RunImpl() { 554 bool CompleteInstallFunction::RunImpl() {
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
720 &GetIsLauncherEnabledFunction::OnIsLauncherCheckCompleted, this)); 721 &GetIsLauncherEnabledFunction::OnIsLauncherCheckCompleted, this));
721 return true; 722 return true;
722 } 723 }
723 724
724 void GetIsLauncherEnabledFunction::OnIsLauncherCheckCompleted(bool is_enabled) { 725 void GetIsLauncherEnabledFunction::OnIsLauncherCheckCompleted(bool is_enabled) {
725 SetResult(Value::CreateBooleanValue(is_enabled)); 726 SetResult(Value::CreateBooleanValue(is_enabled));
726 SendResponse(true); 727 SendResponse(true);
727 } 728 }
728 729
729 } // namespace extensions 730 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698