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

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

Issue 8725013: Improve ExtensionBrowserTest. Part of moving ExtensionService to use ExtensionSet. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix tests Created 9 years 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/browser/extensions/crx_installer.h" 5 #include "chrome/browser/extensions/crx_installer.h"
6 6
7 #include <map> 7 #include <map>
8 #include <set> 8 #include <set>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 441 matching lines...) Expand 10 before | Expand all | Expand 10 after
452 extension_, histogram_name.c_str()); 452 extension_, histogram_name.c_str());
453 453
454 // Kill the theme loading bubble. 454 // Kill the theme loading bubble.
455 content::NotificationService* service = 455 content::NotificationService* service =
456 content::NotificationService::current(); 456 content::NotificationService::current();
457 service->Notify(chrome::NOTIFICATION_NO_THEME_DETECTED, 457 service->Notify(chrome::NOTIFICATION_NO_THEME_DETECTED,
458 content::Source<CrxInstaller>(this), 458 content::Source<CrxInstaller>(this),
459 content::NotificationService::NoDetails()); 459 content::NotificationService::NoDetails());
460 Release(); // balanced in ConfirmInstall(). 460 Release(); // balanced in ConfirmInstall().
461 461
462 NotifyCrxInstallComplete(); 462 NotifyCrxInstallComplete(NULL);
463 463
464 // We're done. Since we don't post any more tasks to ourself, our ref count 464 // We're done. Since we don't post any more tasks to ourself, our ref count
465 // should go to zero and we die. The destructor will clean up the temp dir. 465 // should go to zero and we die. The destructor will clean up the temp dir.
466 } 466 }
467 467
468 void CrxInstaller::CompleteInstall() { 468 void CrxInstaller::CompleteInstall() {
469 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); 469 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
470 470
471 if (!current_version_.empty()) { 471 if (!current_version_.empty()) {
472 scoped_ptr<Version> current_version( 472 scoped_ptr<Version> current_version(
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
533 // This isn't really necessary, it is only used because unit tests expect to 533 // This isn't really necessary, it is only used because unit tests expect to
534 // see errors get reported via this interface. 534 // see errors get reported via this interface.
535 // 535 //
536 // TODO(aa): Need to go through unit tests and clean them up too, probably get 536 // TODO(aa): Need to go through unit tests and clean them up too, probably get
537 // rid of this line. 537 // rid of this line.
538 ExtensionErrorReporter::GetInstance()->ReportError(error, false); // quiet 538 ExtensionErrorReporter::GetInstance()->ReportError(error, false); // quiet
539 539
540 if (client_) 540 if (client_)
541 client_->OnInstallFailure(error); 541 client_->OnInstallFailure(error);
542 542
543 NotifyCrxInstallComplete(); 543 NotifyCrxInstallComplete(NULL);
544 } 544 }
545 545
546 void CrxInstaller::ReportSuccessFromFileThread() { 546 void CrxInstaller::ReportSuccessFromFileThread() {
547 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); 547 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
548 548
549 // Tracking number of extensions installed by users 549 // Tracking number of extensions installed by users
550 if (install_cause() == extension_misc::INSTALL_CAUSE_USER_DOWNLOAD) { 550 if (install_cause() == extension_misc::INSTALL_CAUSE_USER_DOWNLOAD) {
551 UMA_HISTOGRAM_ENUMERATION("Extensions.ExtensionInstalled", 1, 2); 551 UMA_HISTOGRAM_ENUMERATION("Extensions.ExtensionInstalled", 1, 2);
552 552
553 static bool default_apps_trial_exists = 553 static bool default_apps_trial_exists =
(...skipping 26 matching lines...) Expand all
580 // the install (client_ is non NULL), or we are allowed to install this 580 // the install (client_ is non NULL), or we are allowed to install this
581 // silently. We only track granted permissions for INTERNAL extensions. 581 // silently. We only track granted permissions for INTERNAL extensions.
582 if ((client_ || allow_silent_install_) && 582 if ((client_ || allow_silent_install_) &&
583 extension_->location() == Extension::INTERNAL) 583 extension_->location() == Extension::INTERNAL)
584 frontend_weak_->GrantPermissions(extension_); 584 frontend_weak_->GrantPermissions(extension_);
585 585
586 // Tell the frontend about the installation and hand off ownership of 586 // Tell the frontend about the installation and hand off ownership of
587 // extension_ to it. 587 // extension_ to it.
588 frontend_weak_->OnExtensionInstalled(extension_, is_gallery_install(), 588 frontend_weak_->OnExtensionInstalled(extension_, is_gallery_install(),
589 page_index_); 589 page_index_);
590
591 NotifyCrxInstallComplete(extension_.get());
592
590 extension_ = NULL; 593 extension_ = NULL;
591 594
592 NotifyCrxInstallComplete();
593
594 // We're done. We don't post any more tasks to ourselves so we are deleted 595 // We're done. We don't post any more tasks to ourselves so we are deleted
595 // soon. 596 // soon.
596 } 597 }
597 598
598 void CrxInstaller::NotifyCrxInstallComplete() { 599 void CrxInstaller::NotifyCrxInstallComplete(const Extension* extension) {
599 // Some users (such as the download shelf) need to know when a 600 // Some users (such as the download shelf) need to know when a
600 // CRXInstaller is done. Listening for the EXTENSION_* events 601 // CRXInstaller is done. Listening for the EXTENSION_* events
601 // is problematic because they don't know anything about the 602 // is problematic because they don't know anything about the
602 // extension before it is unpacked, so they can not filter based 603 // extension before it is unpacked, so they cannot filter based
603 // on the extension. 604 // on the extension.
604 content::NotificationService::current()->Notify( 605 content::NotificationService::current()->Notify(
605 chrome::NOTIFICATION_CRX_INSTALLER_DONE, 606 chrome::NOTIFICATION_CRX_INSTALLER_DONE,
606 content::Source<CrxInstaller>(this), 607 content::Source<CrxInstaller>(this),
607 content::NotificationService::NoDetails()); 608 content::Details<const Extension>(extension));
608 } 609 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/crx_installer.h ('k') | chrome/browser/extensions/crx_installer_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698