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

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

Issue 8086002: Add metrics to help measure effects of installing default apps in a profile. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Addressing review comments Created 9 years, 2 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) 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"
11 #include "base/lazy_instance.h" 11 #include "base/lazy_instance.h"
12 #include "base/metrics/field_trial.h"
12 #include "base/metrics/histogram.h" 13 #include "base/metrics/histogram.h"
13 #include "base/path_service.h" 14 #include "base/path_service.h"
14 #include "base/scoped_temp_dir.h" 15 #include "base/scoped_temp_dir.h"
15 #include "base/stl_util.h" 16 #include "base/stl_util.h"
16 #include "base/stringprintf.h" 17 #include "base/stringprintf.h"
17 #include "base/task.h" 18 #include "base/task.h"
18 #include "base/threading/thread_restrictions.h" 19 #include "base/threading/thread_restrictions.h"
19 #include "base/time.h" 20 #include "base/time.h"
20 #include "base/utf_string_conversions.h" 21 #include "base/utf_string_conversions.h"
21 #include "base/version.h" 22 #include "base/version.h"
22 #include "chrome/browser/browser_process.h" 23 #include "chrome/browser/browser_process.h"
23 #include "chrome/browser/extensions/convert_user_script.h" 24 #include "chrome/browser/extensions/convert_user_script.h"
24 #include "chrome/browser/extensions/convert_web_app.h" 25 #include "chrome/browser/extensions/convert_web_app.h"
26 #include "chrome/browser/extensions/default_apps_trial.h"
25 #include "chrome/browser/extensions/extension_error_reporter.h" 27 #include "chrome/browser/extensions/extension_error_reporter.h"
26 #include "chrome/browser/extensions/extension_service.h" 28 #include "chrome/browser/extensions/extension_service.h"
27 #include "chrome/browser/shell_integration.h" 29 #include "chrome/browser/shell_integration.h"
28 #include "chrome/browser/web_applications/web_app.h" 30 #include "chrome/browser/web_applications/web_app.h"
29 #include "chrome/common/chrome_notification_types.h" 31 #include "chrome/common/chrome_notification_types.h"
30 #include "chrome/common/chrome_paths.h" 32 #include "chrome/common/chrome_paths.h"
31 #include "chrome/common/extensions/extension_constants.h" 33 #include "chrome/common/extensions/extension_constants.h"
32 #include "chrome/common/extensions/extension_file_util.h" 34 #include "chrome/common/extensions/extension_file_util.h"
33 #include "content/browser/browser_thread.h" 35 #include "content/browser/browser_thread.h"
34 #include "content/browser/user_metrics.h" 36 #include "content/browser/user_metrics.h"
(...skipping 500 matching lines...) Expand 10 before | Expand all | Expand 10 after
535 client_->OnInstallFailure(error); 537 client_->OnInstallFailure(error);
536 538
537 NotifyCrxInstallComplete(); 539 NotifyCrxInstallComplete();
538 } 540 }
539 541
540 void CrxInstaller::ReportSuccessFromFileThread() { 542 void CrxInstaller::ReportSuccessFromFileThread() {
541 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); 543 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
542 544
543 // Tracking number of extensions installed by users 545 // Tracking number of extensions installed by users
544 if (install_cause() == extension_misc::INSTALL_CAUSE_USER_DOWNLOAD) { 546 if (install_cause() == extension_misc::INSTALL_CAUSE_USER_DOWNLOAD) {
545 UserMetrics::RecordAction( 547 UMA_HISTOGRAM_ENUMERATION("Extensions.ExtensionInstalled", 1, 2);
546 UserMetricsAction("Extensions.ExtensionInstalled")); 548
549 static bool default_apps_trial_exists =
550 base::FieldTrialList::TrialExists(kDefaultAppsTrial_Name);
551 if (default_apps_trial_exists) {
552 UMA_HISTOGRAM_ENUMERATION(
553 base::FieldTrial::MakeName("Extensions.ExtensionInstalled",
554 kDefaultAppsTrial_Name),
555 1, 2);
556 }
547 } 557 }
548 558
549 if (!BrowserThread::PostTask( 559 if (!BrowserThread::PostTask(
550 BrowserThread::UI, FROM_HERE, 560 BrowserThread::UI, FROM_HERE,
551 NewRunnableMethod(this, 561 NewRunnableMethod(this,
552 &CrxInstaller::ReportSuccessFromUIThread))) 562 &CrxInstaller::ReportSuccessFromUIThread)))
553 NOTREACHED(); 563 NOTREACHED();
554 } 564 }
555 565
556 void CrxInstaller::ReportSuccessFromUIThread() { 566 void CrxInstaller::ReportSuccessFromUIThread() {
(...skipping 29 matching lines...) Expand all
586 // Some users (such as the download shelf) need to know when a 596 // Some users (such as the download shelf) need to know when a
587 // CRXInstaller is done. Listening for the EXTENSION_* events 597 // CRXInstaller is done. Listening for the EXTENSION_* events
588 // is problematic because they don't know anything about the 598 // is problematic because they don't know anything about the
589 // extension before it is unpacked, so they can not filter based 599 // extension before it is unpacked, so they can not filter based
590 // on the extension. 600 // on the extension.
591 NotificationService::current()->Notify( 601 NotificationService::current()->Notify(
592 chrome::NOTIFICATION_CRX_INSTALLER_DONE, 602 chrome::NOTIFICATION_CRX_INSTALLER_DONE,
593 Source<CrxInstaller>(this), 603 Source<CrxInstaller>(this),
594 NotificationService::NoDetails()); 604 NotificationService::NoDetails());
595 } 605 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/extensions/extension_service.cc » ('j') | chrome/browser/ui/webui/ntp/new_tab_page_handler.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698