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 <algorithm> | 7 #include <algorithm> |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 1517 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1528 // this computer, or we're being compelled to do so by a command line flag. | 1528 // this computer, or we're being compelled to do so by a command line flag. |
1529 // Note that this be done _after_ the PrefService is initialized and all | 1529 // Note that this be done _after_ the PrefService is initialized and all |
1530 // preferences are registered, since some of the code that the importer | 1530 // preferences are registered, since some of the code that the importer |
1531 // touches reads preferences. | 1531 // touches reads preferences. |
1532 if (is_first_run_) { | 1532 if (is_first_run_) { |
1533 if (!first_run_ui_bypass_) { | 1533 if (!first_run_ui_bypass_) { |
1534 first_run::AutoImport(profile_, | 1534 first_run::AutoImport(profile_, |
1535 master_prefs_->homepage_defined, | 1535 master_prefs_->homepage_defined, |
1536 master_prefs_->do_import_items, | 1536 master_prefs_->do_import_items, |
1537 master_prefs_->dont_import_items, | 1537 master_prefs_->dont_import_items, |
1538 master_prefs_->run_search_engine_experiment, | |
1539 master_prefs_->randomize_search_engine_experiment, | |
1540 master_prefs_->make_chrome_default, | 1538 master_prefs_->make_chrome_default, |
1541 process_singleton_.get()); | 1539 process_singleton_.get()); |
1542 #if defined(OS_POSIX) | 1540 #if defined(OS_POSIX) |
1543 // On Windows, the download is tagged with enable/disable stats so there | 1541 // On Windows, the download is tagged with enable/disable stats so there |
1544 // is no need for this code. | 1542 // is no need for this code. |
1545 | 1543 |
1546 // If stats reporting was turned on by the first run dialog then toggle | 1544 // If stats reporting was turned on by the first run dialog then toggle |
1547 // the pref. | 1545 // the pref. |
1548 if (GoogleUpdateSettings::GetCollectStatsConsent()) | 1546 if (GoogleUpdateSettings::GetCollectStatsConsent()) |
1549 local_state_->SetBoolean(prefs::kMetricsReportingEnabled, true); | 1547 local_state_->SetBoolean(prefs::kMetricsReportingEnabled, true); |
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1834 // |shutdown_watcher_| object is destructed. | 1832 // |shutdown_watcher_| object is destructed. |
1835 shutdown_watcher_->Arm(base::TimeDelta::FromSeconds(90)); | 1833 shutdown_watcher_->Arm(base::TimeDelta::FromSeconds(90)); |
1836 | 1834 |
1837 // Disarm the startup hang detector time bomb if it is still Arm'ed. | 1835 // Disarm the startup hang detector time bomb if it is still Arm'ed. |
1838 startup_watcher_->Disarm(); | 1836 startup_watcher_->Disarm(); |
1839 | 1837 |
1840 for (size_t i = 0; i < chrome_extra_parts_.size(); ++i) | 1838 for (size_t i = 0; i < chrome_extra_parts_.size(); ++i) |
1841 chrome_extra_parts_[i]->PostMainMessageLoopRun(); | 1839 chrome_extra_parts_[i]->PostMainMessageLoopRun(); |
1842 | 1840 |
1843 #if defined(OS_WIN) | 1841 #if defined(OS_WIN) |
1844 // If it's the first run, log the search engine chosen. We wait until | 1842 // Log the search engine chosen on first run. Do this at shutdown, after any |
1845 // shutdown because otherwise we can't be sure the user has finished | 1843 // changes are made from the first run bubble link, etc. |
1846 // selecting a search engine through the dialog reached from the first run | |
1847 // bubble link. | |
1848 if (record_search_engine_) { | 1844 if (record_search_engine_) { |
1849 TemplateURLService* url_service = | 1845 TemplateURLService* url_service = |
1850 TemplateURLServiceFactory::GetForProfile(profile_); | 1846 TemplateURLServiceFactory::GetForProfile(profile_); |
1851 const TemplateURL* default_search_engine = | 1847 const TemplateURL* default_search_engine = |
1852 url_service->GetDefaultSearchProvider(); | 1848 url_service->GetDefaultSearchProvider(); |
1853 // The default engine can be NULL if the administrator has disabled | 1849 // The default engine can be NULL if the administrator has disabled |
1854 // default search. | 1850 // default search. |
1855 SearchEngineType search_engine_type = | 1851 SearchEngineType search_engine_type = |
1856 default_search_engine ? default_search_engine->search_engine_type() : | 1852 default_search_engine ? default_search_engine->search_engine_type() : |
1857 SEARCH_ENGINE_OTHER; | 1853 SEARCH_ENGINE_OTHER; |
1858 // Record the search engine chosen. | 1854 // Record the search engine chosen. |
1859 if (master_prefs_->run_search_engine_experiment) { | 1855 UMA_HISTOGRAM_ENUMERATION("Chrome.SearchSelectExempt", |
1860 UMA_HISTOGRAM_ENUMERATION( | 1856 search_engine_type, |
1861 "Chrome.SearchSelectExperiment", | 1857 SEARCH_ENGINE_MAX); |
1862 search_engine_type, | |
1863 SEARCH_ENGINE_MAX); | |
1864 // If the selection has been randomized, also record the winner by slot. | |
1865 if (master_prefs_->randomize_search_engine_experiment) { | |
1866 size_t engine_pos = url_service->GetSearchEngineDialogSlot(); | |
1867 if (engine_pos < 4) { | |
1868 std::string experiment_type = "Chrome.SearchSelectExperimentSlot"; | |
1869 // Nicer in UMA if slots are 1-based. | |
1870 experiment_type.push_back('1' + engine_pos); | |
1871 UMA_HISTOGRAM_ENUMERATION( | |
1872 experiment_type, | |
1873 search_engine_type, | |
1874 SEARCH_ENGINE_MAX); | |
1875 } else { | |
1876 NOTREACHED() << "Invalid search engine selection slot."; | |
1877 } | |
1878 } | |
1879 } else { | |
1880 UMA_HISTOGRAM_ENUMERATION( | |
1881 "Chrome.SearchSelectExempt", | |
1882 search_engine_type, | |
1883 SEARCH_ENGINE_MAX); | |
1884 } | |
1885 } | 1858 } |
1886 #endif | 1859 #endif |
1887 | 1860 |
1888 // Some tests don't set parameters.ui_task, so they started translate | 1861 // Some tests don't set parameters.ui_task, so they started translate |
1889 // language fetch that was never completed so we need to cleanup here | 1862 // language fetch that was never completed so we need to cleanup here |
1890 // otherwise it will be done by the destructor in a wrong thread. | 1863 // otherwise it will be done by the destructor in a wrong thread. |
1891 if (parameters().ui_task == NULL && translate_manager_ != NULL) | 1864 if (parameters().ui_task == NULL && translate_manager_ != NULL) |
1892 translate_manager_->CleanupPendingUlrFetcher(); | 1865 translate_manager_->CleanupPendingUlrFetcher(); |
1893 | 1866 |
1894 if (notify_result_ == ProcessSingleton::PROCESS_NONE) | 1867 if (notify_result_ == ProcessSingleton::PROCESS_NONE) |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1954 if (base::win::GetVersion() <= base::win::VERSION_XP) | 1927 if (base::win::GetVersion() <= base::win::VERSION_XP) |
1955 uma_name += "_XP"; | 1928 uma_name += "_XP"; |
1956 | 1929 |
1957 uma_name += "_PreRead"; | 1930 uma_name += "_PreRead"; |
1958 uma_name += pre_read == "1" ? "Enabled" : "Disabled"; | 1931 uma_name += pre_read == "1" ? "Enabled" : "Disabled"; |
1959 AddPreReadHistogramTime(uma_name.c_str(), time); | 1932 AddPreReadHistogramTime(uma_name.c_str(), time); |
1960 } | 1933 } |
1961 #endif | 1934 #endif |
1962 #endif | 1935 #endif |
1963 } | 1936 } |
OLD | NEW |