| OLD | NEW |
| 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/chrome_browser_main.h" | 5 #include "chrome/browser/chrome_browser_main.h" |
| 6 | 6 |
| 7 #include <set> | 7 #include <set> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 #include "chrome/common/chrome_switches.h" | 97 #include "chrome/common/chrome_switches.h" |
| 98 #include "chrome/common/crash_keys.h" | 98 #include "chrome/common/crash_keys.h" |
| 99 #include "chrome/common/env_vars.h" | 99 #include "chrome/common/env_vars.h" |
| 100 #include "chrome/common/logging_chrome.h" | 100 #include "chrome/common/logging_chrome.h" |
| 101 #include "chrome/common/net/net_resource_provider.h" | 101 #include "chrome/common/net/net_resource_provider.h" |
| 102 #include "chrome/common/pref_names.h" | 102 #include "chrome/common/pref_names.h" |
| 103 #include "chrome/common/profiling.h" | 103 #include "chrome/common/profiling.h" |
| 104 #include "chrome/installer/util/google_update_settings.h" | 104 #include "chrome/installer/util/google_update_settings.h" |
| 105 #include "components/google/core/browser/google_util.h" | 105 #include "components/google/core/browser/google_util.h" |
| 106 #include "components/language_usage_metrics/language_usage_metrics.h" | 106 #include "components/language_usage_metrics/language_usage_metrics.h" |
| 107 #include "components/metrics/metrics_pref_names.h" | |
| 108 #include "components/metrics/metrics_service.h" | 107 #include "components/metrics/metrics_service.h" |
| 109 #include "components/nacl/browser/nacl_browser.h" | 108 #include "components/nacl/browser/nacl_browser.h" |
| 110 #include "components/nacl/browser/nacl_process_host.h" | 109 #include "components/nacl/browser/nacl_process_host.h" |
| 111 #include "components/rappor/rappor_service.h" | 110 #include "components/rappor/rappor_service.h" |
| 112 #include "components/signin/core/common/profile_management_switches.h" | 111 #include "components/signin/core/common/profile_management_switches.h" |
| 113 #include "components/startup_metric_utils/startup_metric_utils.h" | 112 #include "components/startup_metric_utils/startup_metric_utils.h" |
| 114 #include "components/translate/core/browser/translate_download_manager.h" | 113 #include "components/translate/core/browser/translate_download_manager.h" |
| 115 #include "components/variations/variations_http_header_provider.h" | 114 #include "components/variations/variations_http_header_provider.h" |
| 116 #include "content/public/browser/browser_thread.h" | 115 #include "content/public/browser/browser_thread.h" |
| 117 #include "content/public/browser/notification_observer.h" | 116 #include "content/public/browser/notification_observer.h" |
| (...skipping 476 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 594 bool result = provider->SetDefaultVariationIds( | 593 bool result = provider->SetDefaultVariationIds( |
| 595 command_line->GetSwitchValueASCII(switches::kForceVariationIds)); | 594 command_line->GetSwitchValueASCII(switches::kForceVariationIds)); |
| 596 CHECK(result) << "Invalid --" << switches::kForceVariationIds | 595 CHECK(result) << "Invalid --" << switches::kForceVariationIds |
| 597 << " list specified."; | 596 << " list specified."; |
| 598 } | 597 } |
| 599 chrome_variations::VariationsService* variations_service = | 598 chrome_variations::VariationsService* variations_service = |
| 600 browser_process_->variations_service(); | 599 browser_process_->variations_service(); |
| 601 if (variations_service) | 600 if (variations_service) |
| 602 variations_service->CreateTrialsFromSeed(); | 601 variations_service->CreateTrialsFromSeed(); |
| 603 | 602 |
| 604 // This must be called after the local state is initialized. | 603 // This must be called after |local_state_| is initialized. |
| 605 browser_field_trials_.SetupFieldTrials(local_state_); | 604 browser_field_trials_.SetupFieldTrials( |
| 605 base::Time::FromTimeT(metrics->GetInstallDate()), local_state_); |
| 606 | 606 |
| 607 // Initialize FieldTrialSynchronizer system. This is a singleton and is used | 607 // Initialize FieldTrialSynchronizer system. This is a singleton and is used |
| 608 // for posting tasks via base::Bind. Its deleted when it goes out of scope. | 608 // for posting tasks via base::Bind. Its deleted when it goes out of scope. |
| 609 // Even though base::Bind does AddRef and Release, the object will not be | 609 // Even though base::Bind does AddRef and Release, the object will not be |
| 610 // deleted after the Task is executed. | 610 // deleted after the Task is executed. |
| 611 field_trial_synchronizer_ = new FieldTrialSynchronizer(); | 611 field_trial_synchronizer_ = new FieldTrialSynchronizer(); |
| 612 | 612 |
| 613 // Now that field trials have been created, initializes metrics recording. | 613 // Now that field trials have been created, initializes metrics recording. |
| 614 metrics->InitializeMetricsRecordingState(); | 614 metrics->InitializeMetricsRecordingState(); |
| 615 } | 615 } |
| (...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 930 | 930 |
| 931 #if defined(OS_LINUX) || defined(OS_OPENBSD) || defined(OS_MACOSX) | 931 #if defined(OS_LINUX) || defined(OS_OPENBSD) || defined(OS_MACOSX) |
| 932 // Set the product channel for crash reports. | 932 // Set the product channel for crash reports. |
| 933 base::debug::SetCrashKeyValue(crash_keys::kChannel, | 933 base::debug::SetCrashKeyValue(crash_keys::kChannel, |
| 934 chrome::VersionInfo::GetVersionStringModifier()); | 934 chrome::VersionInfo::GetVersionStringModifier()); |
| 935 #endif | 935 #endif |
| 936 | 936 |
| 937 // Initialize tracking synchronizer system. | 937 // Initialize tracking synchronizer system. |
| 938 tracking_synchronizer_ = new chrome_browser_metrics::TrackingSynchronizer(); | 938 tracking_synchronizer_ = new chrome_browser_metrics::TrackingSynchronizer(); |
| 939 | 939 |
| 940 // Now that all preferences have been registered, set the install date | |
| 941 // for the uninstall metrics if this is our first run. This only actually | |
| 942 // gets used if the user has metrics reporting enabled at uninstall time. | |
| 943 int64 install_date = local_state_->GetInt64(metrics::prefs::kInstallDate); | |
| 944 if (install_date == 0) { | |
| 945 local_state_->SetInt64(metrics::prefs::kInstallDate, | |
| 946 base::Time::Now().ToTimeT()); | |
| 947 } | |
| 948 | |
| 949 #if defined(OS_MACOSX) | 940 #if defined(OS_MACOSX) |
| 950 // Get the Keychain API to register for distributed notifications on the main | 941 // Get the Keychain API to register for distributed notifications on the main |
| 951 // thread, which has a proper CFRunloop, instead of later on the I/O thread, | 942 // thread, which has a proper CFRunloop, instead of later on the I/O thread, |
| 952 // which doesn't. This ensures those notifications will get delivered | 943 // which doesn't. This ensures those notifications will get delivered |
| 953 // properly. See issue 37766. | 944 // properly. See issue 37766. |
| 954 // (Note that the callback mask here is empty. I don't want to register for | 945 // (Note that the callback mask here is empty. I don't want to register for |
| 955 // any callbacks, I just want to initialize the mechanism.) | 946 // any callbacks, I just want to initialize the mechanism.) |
| 956 SecKeychainAddCallback(&KeychainCallback, 0, NULL); | 947 SecKeychainAddCallback(&KeychainCallback, 0, NULL); |
| 957 #endif | 948 #endif |
| 958 | 949 |
| (...skipping 700 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1659 chromeos::CrosSettings::Shutdown(); | 1650 chromeos::CrosSettings::Shutdown(); |
| 1660 #endif | 1651 #endif |
| 1661 #endif | 1652 #endif |
| 1662 } | 1653 } |
| 1663 | 1654 |
| 1664 // Public members: | 1655 // Public members: |
| 1665 | 1656 |
| 1666 void ChromeBrowserMainParts::AddParts(ChromeBrowserMainExtraParts* parts) { | 1657 void ChromeBrowserMainParts::AddParts(ChromeBrowserMainExtraParts* parts) { |
| 1667 chrome_extra_parts_.push_back(parts); | 1658 chrome_extra_parts_.push_back(parts); |
| 1668 } | 1659 } |
| OLD | NEW |