Commit f9725c2c authored by skerner@chromium.org's avatar skerner@chromium.org

Add CRX complete notification.

Will be used to show extension unpack progress in the download shelf UI.

BUG=80010
TEST=manual

Review URL: http://codereview.chromium.org/7060014

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@86618 0039d316-1c4b-4281-b951-d872f2087c98
parent cbbb641e
...@@ -2147,6 +2147,10 @@ Other platform defines such as use_titlecase are declared in build/common.gypi. ...@@ -2147,6 +2147,10 @@ Other platform defines such as use_titlecase are declared in build/common.gypi.
desc="Time left until the file download completes and the file is opened."> desc="Time left until the file download completes and the file is opened.">
Opening in <ph name="TIME_REMAINING">$1<ex>5 sec</ex></ph>... Opening in <ph name="TIME_REMAINING">$1<ex>5 sec</ex></ph>...
</message> </message>
<message name="IDS_DOWNLOAD_STATUS_CRX_INSTALL_RUNNING"
desc="Message shown when a CRX has been downloaded and is being unpacked.">
Installing...
</message>
<message name="IDS_DOWNLOAD_STATUS_OPEN_WHEN_COMPLETE" <message name="IDS_DOWNLOAD_STATUS_OPEN_WHEN_COMPLETE"
desc="Status that the file download will be opened when the download completes."> desc="Status that the file download will be opened when the download completes.">
Opening when complete Opening when complete
......
...@@ -525,6 +525,8 @@ void CrxInstaller::ReportFailureFromUIThread(const std::string& error) { ...@@ -525,6 +525,8 @@ void CrxInstaller::ReportFailureFromUIThread(const std::string& error) {
if (client_) if (client_)
client_->OnInstallFailure(error); client_->OnInstallFailure(error);
NotifyCrxInstallComplete();
} }
void CrxInstaller::ReportSuccessFromFileThread() { void CrxInstaller::ReportSuccessFromFileThread() {
...@@ -551,6 +553,20 @@ void CrxInstaller::ReportSuccessFromUIThread() { ...@@ -551,6 +553,20 @@ void CrxInstaller::ReportSuccessFromUIThread() {
frontend_weak_->OnExtensionInstalled(extension_); frontend_weak_->OnExtensionInstalled(extension_);
extension_ = NULL; extension_ = NULL;
NotifyCrxInstallComplete();
// We're done. We don't post any more tasks to ourselves so we are deleted // We're done. We don't post any more tasks to ourselves so we are deleted
// soon. // soon.
} }
void CrxInstaller::NotifyCrxInstallComplete() {
// Some users (such as the download shelf) need to know when a
// CRXInstaller is done. Listening for the EXTENSION_* events
// is problematic because they don't know anything about the
// extension before it is unpacked, so they can not filter based
// on the extension.
NotificationService::current()->Notify(
NotificationType::CRX_INSTALLER_DONE,
Source<CrxInstaller>(this),
NotificationService::NoDetails());
}
...@@ -178,6 +178,7 @@ class CrxInstaller ...@@ -178,6 +178,7 @@ class CrxInstaller
void ReportFailureFromUIThread(const std::string& error); void ReportFailureFromUIThread(const std::string& error);
void ReportSuccessFromFileThread(); void ReportSuccessFromFileThread();
void ReportSuccessFromUIThread(); void ReportSuccessFromUIThread();
void NotifyCrxInstallComplete();
// The file we're installing. // The file we're installing.
FilePath source_file_; FilePath source_file_;
......
...@@ -820,6 +820,10 @@ class NotificationType { ...@@ -820,6 +820,10 @@ class NotificationType {
// Extensions -------------------------------------------------------------- // Extensions --------------------------------------------------------------
// Sent when a CrxInstaller finishes. Source is the CrxInstaller that
// finished. No details.
CRX_INSTALLER_DONE,
// Sent when the known installed extensions have all been loaded. In // Sent when the known installed extensions have all been loaded. In
// testing scenarios this can happen multiple times if extensions are // testing scenarios this can happen multiple times if extensions are
// unloaded and reloaded. The source is a Profile. // unloaded and reloaded. The source is a Profile.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment