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/first_run/first_run.h" | 5 #include "chrome/browser/first_run/first_run.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 27 matching lines...) Expand all Loading... | |
38 #include "chrome/browser/search_engines/template_url_service_factory.h" | 38 #include "chrome/browser/search_engines/template_url_service_factory.h" |
39 #include "chrome/browser/shell_integration.h" | 39 #include "chrome/browser/shell_integration.h" |
40 #include "chrome/browser/signin/signin_manager_factory.h" | 40 #include "chrome/browser/signin/signin_manager_factory.h" |
41 #include "chrome/browser/ui/browser.h" | 41 #include "chrome/browser/ui/browser.h" |
42 #include "chrome/browser/ui/browser_finder.h" | 42 #include "chrome/browser/ui/browser_finder.h" |
43 #include "chrome/browser/ui/chrome_pages.h" | 43 #include "chrome/browser/ui/chrome_pages.h" |
44 #include "chrome/browser/ui/global_error/global_error_service.h" | 44 #include "chrome/browser/ui/global_error/global_error_service.h" |
45 #include "chrome/browser/ui/global_error/global_error_service_factory.h" | 45 #include "chrome/browser/ui/global_error/global_error_service_factory.h" |
46 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 46 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
47 #include "chrome/browser/ui/webui/ntp/new_tab_ui.h" | 47 #include "chrome/browser/ui/webui/ntp/new_tab_ui.h" |
48 #include "chrome/common/channel_info.h" | |
49 #include "chrome/common/chrome_constants.h" | 48 #include "chrome/common/chrome_constants.h" |
50 #include "chrome/common/chrome_paths.h" | 49 #include "chrome/common/chrome_paths.h" |
51 #include "chrome/common/chrome_switches.h" | 50 #include "chrome/common/chrome_switches.h" |
52 #include "chrome/common/pref_names.h" | 51 #include "chrome/common/pref_names.h" |
53 #include "chrome/common/url_constants.h" | 52 #include "chrome/common/url_constants.h" |
54 #include "chrome/grit/locale_settings.h" | 53 #include "chrome/grit/locale_settings.h" |
55 #include "chrome/installer/util/master_preferences.h" | 54 #include "chrome/installer/util/master_preferences.h" |
56 #include "chrome/installer/util/master_preferences_constants.h" | 55 #include "chrome/installer/util/master_preferences_constants.h" |
57 #include "chrome/installer/util/util_constants.h" | 56 #include "chrome/installer/util/util_constants.h" |
58 #include "components/pref_registry/pref_registry_syncable.h" | 57 #include "components/pref_registry/pref_registry_syncable.h" |
59 #include "components/prefs/pref_service.h" | 58 #include "components/prefs/pref_service.h" |
60 #include "components/search_engines/template_url_service.h" | 59 #include "components/search_engines/template_url_service.h" |
61 #include "components/signin/core/browser/signin_manager.h" | 60 #include "components/signin/core/browser/signin_manager.h" |
62 #include "components/signin/core/browser/signin_tracker.h" | 61 #include "components/signin/core/browser/signin_tracker.h" |
63 #include "components/version_info/version_info.h" | |
64 #include "content/public/browser/navigation_entry.h" | 62 #include "content/public/browser/navigation_entry.h" |
65 #include "content/public/browser/notification_observer.h" | 63 #include "content/public/browser/notification_observer.h" |
66 #include "content/public/browser/notification_registrar.h" | 64 #include "content/public/browser/notification_registrar.h" |
67 #include "content/public/browser/notification_service.h" | 65 #include "content/public/browser/notification_service.h" |
68 #include "content/public/browser/notification_types.h" | 66 #include "content/public/browser/notification_types.h" |
69 #include "content/public/browser/user_metrics.h" | 67 #include "content/public/browser/user_metrics.h" |
70 #include "content/public/browser/web_contents.h" | 68 #include "content/public/browser/web_contents.h" |
71 #include "extensions/browser/extension_system.h" | 69 #include "extensions/browser/extension_system.h" |
72 #include "extensions/common/one_shot_event.h" | 70 #include "extensions/common/one_shot_event.h" |
73 #include "google_apis/gaia/gaia_auth_util.h" | 71 #include "google_apis/gaia/gaia_auth_util.h" |
(...skipping 573 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
647 return internal::g_first_run == internal::FIRST_RUN_TRUE; | 645 return internal::g_first_run == internal::FIRST_RUN_TRUE; |
648 } | 646 } |
649 | 647 |
650 #if defined(OS_MACOSX) | 648 #if defined(OS_MACOSX) |
651 bool IsFirstRunSuppressed(const base::CommandLine& command_line) { | 649 bool IsFirstRunSuppressed(const base::CommandLine& command_line) { |
652 return command_line.HasSwitch(switches::kNoFirstRun); | 650 return command_line.HasSwitch(switches::kNoFirstRun); |
653 } | 651 } |
654 #endif | 652 #endif |
655 | 653 |
656 bool IsMetricsReportingOptIn() { | 654 bool IsMetricsReportingOptIn() { |
657 #if defined(OS_CHROMEOS) | 655 // Metrics reporting is opt-out by default for all platforms and channels. |
656 // However, user will have chance to modify metrics reporting state during | |
657 // FRE. | |
sky
2016/08/26 16:05:34
FRE may be obvious to you, but I suspect most engi
| |
658 return false; | 658 return false; |
659 #elif defined(OS_ANDROID) | |
660 #error This file shouldn not be compiled on Android. | |
661 #elif defined(OS_MACOSX) | |
662 return chrome::GetChannel() != version_info::Channel::CANARY; | |
663 #elif defined(OS_LINUX) || defined(OS_BSD) || defined(OS_SOLARIS) | |
664 // Treat BSD and SOLARIS like Linux to not break those builds, although these | |
665 // platforms are not officially supported by Chrome. | |
666 return true; | |
667 #elif defined(OS_WIN) | |
668 // TODO(jwd): Get this data directly from the download page. | |
669 // Metrics reporting for Windows is initially enabled on the download page. If | |
670 // it's opt-in or out can change without changes to Chrome. We should get this | |
671 // information directly from the download page for it to be accurate. | |
672 return chrome::GetChannel() == version_info::Channel::STABLE; | |
673 #else | |
674 #error Unsupported platform. | |
675 #endif | |
676 } | 659 } |
677 | 660 |
678 void CreateSentinelIfNeeded() { | 661 void CreateSentinelIfNeeded() { |
679 if (IsChromeFirstRun()) | 662 if (IsChromeFirstRun()) |
680 internal::CreateSentinel(); | 663 internal::CreateSentinel(); |
681 } | 664 } |
682 | 665 |
683 std::string GetPingDelayPrefName() { | 666 std::string GetPingDelayPrefName() { |
684 return base::StringPrintf("%s.%s", | 667 return base::StringPrintf("%s.%s", |
685 installer::master_preferences::kDistroDict, | 668 installer::master_preferences::kDistroDict, |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
858 SetShouldDoPersonalDataManagerFirstRun(); | 841 SetShouldDoPersonalDataManagerFirstRun(); |
859 | 842 |
860 internal::DoPostImportPlatformSpecificTasks(profile); | 843 internal::DoPostImportPlatformSpecificTasks(profile); |
861 } | 844 } |
862 | 845 |
863 uint16_t auto_import_state() { | 846 uint16_t auto_import_state() { |
864 return g_auto_import_state; | 847 return g_auto_import_state; |
865 } | 848 } |
866 | 849 |
867 } // namespace first_run | 850 } // namespace first_run |
OLD | NEW |