| OLD | NEW |
| 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/file_util.h" | 10 #include "base/file_util.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 #include "chrome/browser/extensions/convert_web_app.h" | 24 #include "chrome/browser/extensions/convert_web_app.h" |
| 25 #include "chrome/browser/extensions/extension_error_reporter.h" | 25 #include "chrome/browser/extensions/extension_error_reporter.h" |
| 26 #include "chrome/browser/extensions/extension_service.h" | 26 #include "chrome/browser/extensions/extension_service.h" |
| 27 #include "chrome/browser/shell_integration.h" | 27 #include "chrome/browser/shell_integration.h" |
| 28 #include "chrome/browser/web_applications/web_app.h" | 28 #include "chrome/browser/web_applications/web_app.h" |
| 29 #include "chrome/common/chrome_notification_types.h" | 29 #include "chrome/common/chrome_notification_types.h" |
| 30 #include "chrome/common/chrome_paths.h" | 30 #include "chrome/common/chrome_paths.h" |
| 31 #include "chrome/common/extensions/extension_constants.h" | 31 #include "chrome/common/extensions/extension_constants.h" |
| 32 #include "chrome/common/extensions/extension_file_util.h" | 32 #include "chrome/common/extensions/extension_file_util.h" |
| 33 #include "content/browser/browser_thread.h" | 33 #include "content/browser/browser_thread.h" |
| 34 #include "content/browser/user_metrics.h" |
| 34 #include "content/common/notification_service.h" | 35 #include "content/common/notification_service.h" |
| 35 #include "grit/chromium_strings.h" | 36 #include "grit/chromium_strings.h" |
| 36 #include "grit/generated_resources.h" | 37 #include "grit/generated_resources.h" |
| 37 #include "grit/theme_resources.h" | 38 #include "grit/theme_resources.h" |
| 38 #include "third_party/skia/include/core/SkBitmap.h" | 39 #include "third_party/skia/include/core/SkBitmap.h" |
| 39 #include "ui/base/l10n/l10n_util.h" | 40 #include "ui/base/l10n/l10n_util.h" |
| 40 #include "ui/base/resource/resource_bundle.h" | 41 #include "ui/base/resource/resource_bundle.h" |
| 41 | 42 |
| 42 namespace { | 43 namespace { |
| 43 | 44 |
| (...skipping 487 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 531 ExtensionErrorReporter::GetInstance()->ReportError(error, false); // quiet | 532 ExtensionErrorReporter::GetInstance()->ReportError(error, false); // quiet |
| 532 | 533 |
| 533 if (client_) | 534 if (client_) |
| 534 client_->OnInstallFailure(error); | 535 client_->OnInstallFailure(error); |
| 535 | 536 |
| 536 NotifyCrxInstallComplete(); | 537 NotifyCrxInstallComplete(); |
| 537 } | 538 } |
| 538 | 539 |
| 539 void CrxInstaller::ReportSuccessFromFileThread() { | 540 void CrxInstaller::ReportSuccessFromFileThread() { |
| 540 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); | 541 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); |
| 542 |
| 543 // Tracking number of extensions installed by users |
| 544 if (install_cause() == extension_misc::INSTALL_CAUSE_USER_DOWNLOAD) { |
| 545 UserMetrics::RecordAction( |
| 546 UserMetricsAction("Extensions.ExtensionInstalled")); |
| 547 } |
| 548 |
| 541 if (!BrowserThread::PostTask( | 549 if (!BrowserThread::PostTask( |
| 542 BrowserThread::UI, FROM_HERE, | 550 BrowserThread::UI, FROM_HERE, |
| 543 NewRunnableMethod(this, | 551 NewRunnableMethod(this, |
| 544 &CrxInstaller::ReportSuccessFromUIThread))) | 552 &CrxInstaller::ReportSuccessFromUIThread))) |
| 545 NOTREACHED(); | 553 NOTREACHED(); |
| 546 } | 554 } |
| 547 | 555 |
| 548 void CrxInstaller::ReportSuccessFromUIThread() { | 556 void CrxInstaller::ReportSuccessFromUIThread() { |
| 549 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 557 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 550 | 558 |
| (...skipping 27 matching lines...) Expand all Loading... |
| 578 // Some users (such as the download shelf) need to know when a | 586 // Some users (such as the download shelf) need to know when a |
| 579 // CRXInstaller is done. Listening for the EXTENSION_* events | 587 // CRXInstaller is done. Listening for the EXTENSION_* events |
| 580 // is problematic because they don't know anything about the | 588 // is problematic because they don't know anything about the |
| 581 // extension before it is unpacked, so they can not filter based | 589 // extension before it is unpacked, so they can not filter based |
| 582 // on the extension. | 590 // on the extension. |
| 583 NotificationService::current()->Notify( | 591 NotificationService::current()->Notify( |
| 584 chrome::NOTIFICATION_CRX_INSTALLER_DONE, | 592 chrome::NOTIFICATION_CRX_INSTALLER_DONE, |
| 585 Source<CrxInstaller>(this), | 593 Source<CrxInstaller>(this), |
| 586 NotificationService::NoDetails()); | 594 NotificationService::NoDetails()); |
| 587 } | 595 } |
| OLD | NEW |