OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "base/command_line.h" | 5 #include "base/command_line.h" |
6 #include "base/metrics/histogram.h" | 6 #include "base/metrics/histogram.h" |
7 #include "base/prefs/pref_service.h" | 7 #include "base/prefs/pref_service.h" |
8 #include "chrome/browser/browser_process.h" | 8 #include "chrome/browser/browser_process.h" |
9 #include "chrome/browser/chrome_notification_types.h" | 9 #include "chrome/browser/chrome_notification_types.h" |
10 #include "chrome/browser/chromeos/first_run/first_run_controller.h" | 10 #include "chrome/browser/chromeos/first_run/first_run_controller.h" |
11 #include "chrome/browser/chromeos/profiles/profile_helper.h" | 11 #include "chrome/browser/chromeos/profiles/profile_helper.h" |
12 #include "chrome/browser/extensions/extension_service.h" | 12 #include "chrome/browser/extensions/extension_service.h" |
13 #include "chrome/browser/prefs/pref_service_syncable.h" | 13 #include "chrome/browser/prefs/pref_service_syncable.h" |
| 14 #include "chrome/browser/prefs/pref_service_syncable_util.h" |
14 #include "chrome/browser/profiles/profile_manager.h" | 15 #include "chrome/browser/profiles/profile_manager.h" |
15 #include "chrome/browser/ui/extensions/app_launch_params.h" | 16 #include "chrome/browser/ui/extensions/app_launch_params.h" |
16 #include "chrome/browser/ui/extensions/application_launch.h" | 17 #include "chrome/browser/ui/extensions/application_launch.h" |
17 #include "chrome/common/chrome_switches.h" | 18 #include "chrome/common/chrome_switches.h" |
18 #include "chrome/common/extensions/extension_constants.h" | 19 #include "chrome/common/extensions/extension_constants.h" |
19 #include "chrome/common/pref_names.h" | 20 #include "chrome/common/pref_names.h" |
20 #include "chromeos/chromeos_switches.h" | 21 #include "chromeos/chromeos_switches.h" |
21 #include "components/pref_registry/pref_registry_syncable.h" | 22 #include "components/pref_registry/pref_registry_syncable.h" |
22 #include "components/user_manager/user_manager.h" | 23 #include "components/user_manager/user_manager.h" |
23 #include "content/public/browser/notification_observer.h" | 24 #include "content/public/browser/notification_observer.h" |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 ProfileHelper::Get()->GetUserByProfile(profile_)); | 72 ProfileHelper::Get()->GetUserByProfile(profile_)); |
72 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); | 73 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); |
73 bool launched_in_test = command_line->HasSwitch(::switches::kTestType); | 74 bool launched_in_test = command_line->HasSwitch(::switches::kTestType); |
74 bool launched_in_telemetry = | 75 bool launched_in_telemetry = |
75 command_line->HasSwitch(switches::kOobeSkipPostLogin); | 76 command_line->HasSwitch(switches::kOobeSkipPostLogin); |
76 bool is_user_new = user_manager::UserManager::Get()->IsCurrentUserNew(); | 77 bool is_user_new = user_manager::UserManager::Get()->IsCurrentUserNew(); |
77 bool first_run_forced = command_line->HasSwitch(switches::kForceFirstRunUI); | 78 bool first_run_forced = command_line->HasSwitch(switches::kForceFirstRunUI); |
78 bool first_run_seen = | 79 bool first_run_seen = |
79 profile_->GetPrefs()->GetBoolean(prefs::kFirstRunTutorialShown); | 80 profile_->GetPrefs()->GetBoolean(prefs::kFirstRunTutorialShown); |
80 bool is_pref_synced = | 81 bool is_pref_synced = |
81 PrefServiceSyncable::FromProfile(profile_)->IsPrioritySyncing(); | 82 PrefServiceSyncableFromProfile(profile_)->IsPrioritySyncing(); |
82 bool is_user_ephemeral = user_manager::UserManager::Get() | 83 bool is_user_ephemeral = user_manager::UserManager::Get() |
83 ->IsCurrentUserNonCryptohomeDataEphemeral(); | 84 ->IsCurrentUserNonCryptohomeDataEphemeral(); |
84 if (!launched_in_telemetry && | 85 if (!launched_in_telemetry && |
85 ((is_user_new && !first_run_seen && | 86 ((is_user_new && !first_run_seen && |
86 (is_pref_synced || !is_user_ephemeral) && !launched_in_test) || | 87 (is_pref_synced || !is_user_ephemeral) && !launched_in_test) || |
87 first_run_forced)) { | 88 first_run_forced)) { |
88 LaunchDialogForProfile(profile_); | 89 LaunchDialogForProfile(profile_); |
89 } | 90 } |
90 delete this; | 91 delete this; |
91 } | 92 } |
(...skipping 19 matching lines...) Expand all Loading... |
111 user_manager::UserManager::Get()->GetActiveUser())); | 112 user_manager::UserManager::Get()->GetActiveUser())); |
112 } | 113 } |
113 | 114 |
114 void LaunchTutorial() { | 115 void LaunchTutorial() { |
115 UMA_HISTOGRAM_BOOLEAN("CrosFirstRun.TutorialLaunched", true); | 116 UMA_HISTOGRAM_BOOLEAN("CrosFirstRun.TutorialLaunched", true); |
116 FirstRunController::Start(); | 117 FirstRunController::Start(); |
117 } | 118 } |
118 | 119 |
119 } // namespace first_run | 120 } // namespace first_run |
120 } // namespace chromeos | 121 } // namespace chromeos |
OLD | NEW |