Chromium Code Reviews| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 26 #include "base/logging.h" | 26 #include "base/logging.h" |
| 27 #include "base/memory/ptr_util.h" | 27 #include "base/memory/ptr_util.h" |
| 28 #include "base/metrics/field_trial.h" | 28 #include "base/metrics/field_trial.h" |
| 29 #include "base/metrics/histogram_macros.h" | 29 #include "base/metrics/histogram_macros.h" |
| 30 #include "base/path_service.h" | 30 #include "base/path_service.h" |
| 31 #include "base/profiler/scoped_tracker.h" | 31 #include "base/profiler/scoped_tracker.h" |
| 32 #include "base/run_loop.h" | 32 #include "base/run_loop.h" |
| 33 #include "base/strings/string_number_conversions.h" | 33 #include "base/strings/string_number_conversions.h" |
| 34 #include "base/strings/string_piece.h" | 34 #include "base/strings/string_piece.h" |
| 35 #include "base/strings/string_split.h" | 35 #include "base/strings/string_split.h" |
| 36 #include "base/strings/string_util.h" | |
| 36 #include "base/strings/sys_string_conversions.h" | 37 #include "base/strings/sys_string_conversions.h" |
| 37 #include "base/strings/utf_string_conversions.h" | 38 #include "base/strings/utf_string_conversions.h" |
| 38 #include "base/sys_info.h" | 39 #include "base/sys_info.h" |
| 39 #include "base/task_scheduler/scheduler_worker_pool_params.h" | 40 #include "base/task_scheduler/scheduler_worker_pool_params.h" |
| 40 #include "base/task_scheduler/switches.h" | 41 #include "base/task_scheduler/switches.h" |
| 41 #include "base/task_scheduler/task_scheduler.h" | 42 #include "base/task_scheduler/task_scheduler.h" |
| 42 #include "base/task_scheduler/task_traits.h" | 43 #include "base/task_scheduler/task_traits.h" |
| 43 #include "base/threading/platform_thread.h" | 44 #include "base/threading/platform_thread.h" |
| 44 #include "base/time/default_tick_clock.h" | 45 #include "base/time/default_tick_clock.h" |
| 45 #include "base/time/time.h" | 46 #include "base/time/time.h" |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 198 #include "chromeos/settings/cros_settings_names.h" | 199 #include "chromeos/settings/cros_settings_names.h" |
| 199 #endif // defined(OS_CHROMEOS) | 200 #endif // defined(OS_CHROMEOS) |
| 200 | 201 |
| 201 // TODO(port): several win-only methods have been pulled out of this, but | 202 // TODO(port): several win-only methods have been pulled out of this, but |
| 202 // BrowserMain() as a whole needs to be broken apart so that it's usable by | 203 // BrowserMain() as a whole needs to be broken apart so that it's usable by |
| 203 // other platforms. For now, it's just a stub. This is a serious work in | 204 // other platforms. For now, it's just a stub. This is a serious work in |
| 204 // progress and should not be taken as an indication of a real refactoring. | 205 // progress and should not be taken as an indication of a real refactoring. |
| 205 | 206 |
| 206 #if defined(OS_WIN) | 207 #if defined(OS_WIN) |
| 207 #include "base/trace_event/trace_event_etw_export_win.h" | 208 #include "base/trace_event/trace_event_etw_export_win.h" |
| 209 #include "base/win/win_util.h" | |
| 208 #include "base/win/windows_version.h" | 210 #include "base/win/windows_version.h" |
| 209 #include "chrome/app/file_pre_reader_win.h" | 211 #include "chrome/app/file_pre_reader_win.h" |
| 210 #include "chrome/browser/chrome_browser_main_win.h" | 212 #include "chrome/browser/chrome_browser_main_win.h" |
| 211 #include "chrome/browser/component_updater/caps_installer_win.h" | 213 #include "chrome/browser/component_updater/caps_installer_win.h" |
| 212 #include "chrome/browser/component_updater/sw_reporter_installer_win.h" | 214 #include "chrome/browser/component_updater/sw_reporter_installer_win.h" |
| 213 #include "chrome/browser/downgrade/user_data_downgrade.h" | 215 #include "chrome/browser/downgrade/user_data_downgrade.h" |
| 214 #include "chrome/browser/first_run/try_chrome_dialog_view.h" | 216 #include "chrome/browser/first_run/try_chrome_dialog_view.h" |
| 215 #include "chrome/browser/first_run/upgrade_util_win.h" | 217 #include "chrome/browser/first_run/upgrade_util_win.h" |
| 216 #include "chrome/browser/metrics/chrome_metrics_service_accessor.h" | 218 #include "chrome/browser/metrics/chrome_metrics_service_accessor.h" |
| 217 #include "chrome/browser/ui/network_profile_bubble.h" | 219 #include "chrome/browser/ui/network_profile_bubble.h" |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 283 | 285 |
| 284 #if defined(OS_WIN) || defined(OS_MACOSX) || \ | 286 #if defined(OS_WIN) || defined(OS_MACOSX) || \ |
| 285 (defined(OS_LINUX) && !defined(OS_CHROMEOS)) | 287 (defined(OS_LINUX) && !defined(OS_CHROMEOS)) |
| 286 #include "chrome/browser/metrics/desktop_engagement/desktop_engagement_service.h " | 288 #include "chrome/browser/metrics/desktop_engagement/desktop_engagement_service.h " |
| 287 #endif | 289 #endif |
| 288 | 290 |
| 289 using content::BrowserThread; | 291 using content::BrowserThread; |
| 290 | 292 |
| 291 namespace { | 293 namespace { |
| 292 | 294 |
| 295 // feature used to remove AutoImport on first run is default-off | |
| 296 const base::Feature kDisableFirstRunAutoImport{ | |
| 297 "DisableFirstRunAutoImport", base::FEATURE_DISABLED_BY_DEFAULT}; | |
|
Ilya Sherman
2016/08/22 21:10:45
Please define this feature in https://cs.chromium.
gcomanici
2016/08/23 16:31:59
Done.
| |
| 298 | |
| 293 // A provider of Geolocation services to override AccessTokenStore. | 299 // A provider of Geolocation services to override AccessTokenStore. |
| 294 class ChromeGeolocationDelegate : public device::GeolocationDelegate { | 300 class ChromeGeolocationDelegate : public device::GeolocationDelegate { |
| 295 public: | 301 public: |
| 296 ChromeGeolocationDelegate() = default; | 302 ChromeGeolocationDelegate() = default; |
| 297 | 303 |
| 298 scoped_refptr<device::AccessTokenStore> CreateAccessTokenStore() final { | 304 scoped_refptr<device::AccessTokenStore> CreateAccessTokenStore() final { |
| 299 return new ChromeAccessTokenStore(); | 305 return new ChromeAccessTokenStore(); |
| 300 } | 306 } |
| 301 | 307 |
| 302 private: | 308 private: |
| (...skipping 1488 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1791 // (requires supporting early exit). | 1797 // (requires supporting early exit). |
| 1792 PostProfileInit(); | 1798 PostProfileInit(); |
| 1793 | 1799 |
| 1794 #if !defined(OS_ANDROID) && !defined(OS_CHROMEOS) | 1800 #if !defined(OS_ANDROID) && !defined(OS_CHROMEOS) |
| 1795 // Show the First Run UI if this is the first time Chrome has been run on | 1801 // Show the First Run UI if this is the first time Chrome has been run on |
| 1796 // this computer, or we're being compelled to do so by a command line flag. | 1802 // this computer, or we're being compelled to do so by a command line flag. |
| 1797 // Note that this be done _after_ the PrefService is initialized and all | 1803 // Note that this be done _after_ the PrefService is initialized and all |
| 1798 // preferences are registered, since some of the code that the importer | 1804 // preferences are registered, since some of the code that the importer |
| 1799 // touches reads preferences. | 1805 // touches reads preferences. |
| 1800 if (first_run::IsChromeFirstRun()) { | 1806 if (first_run::IsChromeFirstRun()) { |
| 1801 first_run::AutoImport(profile_, | 1807 // By default, autoImport is performed on first run. |
|
Ilya Sherman
2016/08/22 21:10:45
nit: Please try to be consist about how autoImport
| |
| 1802 master_prefs_->homepage_defined, | 1808 bool perform_autoImport_on_first_run = true; |
|
Ilya Sherman
2016/08/22 21:10:45
nit: s/autoImport/auto_import
Ilya Sherman
2016/08/22 21:10:45
nit: I'd drop the "_on_first_run" suffix, since th
gcomanici
2016/08/23 16:31:59
Done.
| |
| 1803 master_prefs_->do_import_items, | 1809 // Part of a field trial that is designed to turn off the AutoImport feature |
| 1804 master_prefs_->dont_import_items, | 1810 // for Windows users (on first run). |
| 1805 master_prefs_->import_bookmarks_path); | 1811 // The feature keeps running for enterprise. |
| 1812 #if defined(OS_WIN) | |
|
Ilya Sherman
2016/08/22 21:10:45
Please control the platform via the field trial's
gcomanici
2016/08/23 16:31:59
Done.
| |
| 1813 base::FieldTrial* trial = | |
| 1814 base::FieldTrialList::Find("DisableFirstRunAutoImport"); | |
|
Ilya Sherman
2016/08/22 21:10:45
There's no need to call this when using the Featur
gcomanici
2016/08/23 16:31:59
Acknowledged.
| |
| 1815 perform_autoImport_on_first_run = !trial || | |
| 1816 !base::FeatureList::IsEnabled(kDisableFirstRunAutoImport) || | |
| 1817 base::win::IsEnrolledToDomain(); | |
|
Ilya Sherman
2016/08/22 21:10:45
Please make the IsEnrolledToDomain() check first.
gcomanici
2016/08/23 16:31:59
Done.
| |
| 1818 #endif | |
|
Ilya Sherman
2016/08/22 21:10:45
The indentation looks off for these lines. Please
gcomanici
2016/08/23 16:31:59
Acknowledged.
| |
| 1819 if (perform_autoImport_on_first_run) { | |
| 1820 first_run::AutoImport(profile_, master_prefs_->homepage_defined, | |
| 1821 master_prefs_->do_import_items, | |
| 1822 master_prefs_->dont_import_items, | |
| 1823 master_prefs_->import_bookmarks_path); | |
| 1824 } | |
| 1806 | 1825 |
| 1807 // Note: this can pop the first run consent dialog on linux. | 1826 // Note: this can pop the first run consent dialog on linux. |
| 1808 first_run::DoPostImportTasks(profile_, | 1827 first_run::DoPostImportTasks(profile_, |
| 1809 master_prefs_->make_chrome_default_for_user); | 1828 master_prefs_->make_chrome_default_for_user); |
| 1810 | 1829 |
| 1811 if (!master_prefs_->suppress_first_run_default_browser_prompt) { | 1830 if (!master_prefs_->suppress_first_run_default_browser_prompt) { |
| 1812 browser_creator_->set_show_main_browser_window( | 1831 browser_creator_->set_show_main_browser_window( |
| 1813 !chrome::ShowFirstRunDefaultBrowserPrompt(profile_)); | 1832 !chrome::ShowFirstRunDefaultBrowserPrompt(profile_)); |
| 1814 } else { | 1833 } else { |
| 1815 browser_creator_->set_is_default_browser_dialog_suppressed(true); | 1834 browser_creator_->set_is_default_browser_dialog_suppressed(true); |
| (...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2209 chromeos::CrosSettings::Shutdown(); | 2228 chromeos::CrosSettings::Shutdown(); |
| 2210 #endif // defined(OS_CHROMEOS) | 2229 #endif // defined(OS_CHROMEOS) |
| 2211 #endif // defined(OS_ANDROID) | 2230 #endif // defined(OS_ANDROID) |
| 2212 } | 2231 } |
| 2213 | 2232 |
| 2214 // Public members: | 2233 // Public members: |
| 2215 | 2234 |
| 2216 void ChromeBrowserMainParts::AddParts(ChromeBrowserMainExtraParts* parts) { | 2235 void ChromeBrowserMainParts::AddParts(ChromeBrowserMainExtraParts* parts) { |
| 2217 chrome_extra_parts_.push_back(parts); | 2236 chrome_extra_parts_.push_back(parts); |
| 2218 } | 2237 } |
| OLD | NEW |