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/chromeos/login/user_manager_impl.h" | 5 #include "chrome/browser/chromeos/login/user_manager_impl.h" |
6 | 6 |
7 #include "ash/shell.h" | 7 #include "ash/shell.h" |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/chromeos/chromeos_version.h" | 9 #include "base/chromeos/chromeos_version.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
12 #include "base/file_path.h" | 12 #include "base/file_path.h" |
13 #include "base/file_util.h" | 13 #include "base/file_util.h" |
14 #include "base/logging.h" | 14 #include "base/logging.h" |
15 #include "base/rand_util.h" | 15 #include "base/rand_util.h" |
16 #include "base/utf_string_conversions.h" | 16 #include "base/utf_string_conversions.h" |
17 #include "base/values.h" | 17 #include "base/values.h" |
18 #include "chrome/browser/browser_process.h" | 18 #include "chrome/browser/browser_process.h" |
19 #include "chrome/browser/chromeos/cros/cert_library.h" | 19 #include "chrome/browser/chromeos/cros/cert_library.h" |
20 #include "chrome/browser/chromeos/cros/cros_library.h" | 20 #include "chrome/browser/chromeos/cros/cros_library.h" |
21 #include "chrome/browser/chromeos/input_method/input_method_manager.h" | 21 #include "chrome/browser/chromeos/input_method/input_method_manager.h" |
22 #include "chrome/browser/chromeos/login/login_display.h" | 22 #include "chrome/browser/chromeos/login/login_display.h" |
23 #include "chrome/browser/chromeos/login/remove_user_delegate.h" | 23 #include "chrome/browser/chromeos/login/remove_user_delegate.h" |
24 #include "chrome/browser/chromeos/login/user_image_manager_impl.h" | 24 #include "chrome/browser/chromeos/login/user_image_manager_impl.h" |
25 #include "chrome/browser/chromeos/login/wizard_controller.h" | 25 #include "chrome/browser/chromeos/login/wizard_controller.h" |
26 #include "chrome/browser/chromeos/settings/cros_settings.h" | 26 #include "chrome/browser/chromeos/settings/cros_settings.h" |
27 #include "chrome/browser/first_run/first_run.h" | |
27 #include "chrome/browser/policy/browser_policy_connector.h" | 28 #include "chrome/browser/policy/browser_policy_connector.h" |
28 #include "chrome/browser/prefs/pref_service.h" | 29 #include "chrome/browser/prefs/pref_service.h" |
29 #include "chrome/browser/prefs/scoped_user_pref_update.h" | 30 #include "chrome/browser/prefs/scoped_user_pref_update.h" |
30 #include "chrome/browser/profiles/profile_manager.h" | 31 #include "chrome/browser/profiles/profile_manager.h" |
32 #include "chrome/browser/rlz/rlz.h" | |
31 #include "chrome/browser/sync/profile_sync_service.h" | 33 #include "chrome/browser/sync/profile_sync_service.h" |
32 #include "chrome/browser/sync/profile_sync_service_factory.h" | 34 #include "chrome/browser/sync/profile_sync_service_factory.h" |
33 #include "chrome/common/chrome_notification_types.h" | 35 #include "chrome/common/chrome_notification_types.h" |
34 #include "chrome/common/chrome_switches.h" | 36 #include "chrome/common/chrome_switches.h" |
35 #include "chrome/common/pref_names.h" | 37 #include "chrome/common/pref_names.h" |
36 #include "chromeos/cryptohome/async_method_caller.h" | 38 #include "chromeos/cryptohome/async_method_caller.h" |
37 #include "content/public/browser/browser_thread.h" | 39 #include "content/public/browser/browser_thread.h" |
38 #include "content/public/browser/notification_service.h" | 40 #include "content/public/browser/notification_service.h" |
39 #include "google_apis/gaia/google_service_auth_error.h" | 41 #include "google_apis/gaia/google_service_auth_error.h" |
40 | 42 |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
204 user_image_manager_->UserLoggedIn(email, is_current_user_new_); | 206 user_image_manager_->UserLoggedIn(email, is_current_user_new_); |
205 | 207 |
206 if (!browser_restart) { | 208 if (!browser_restart) { |
207 // For GAIA login flow, logged in user wallpaper may not be loaded. | 209 // For GAIA login flow, logged in user wallpaper may not be loaded. |
208 WallpaperManager::Get()->EnsureLoggedInUserWallpaperLoaded(); | 210 WallpaperManager::Get()->EnsureLoggedInUserWallpaperLoaded(); |
209 } | 211 } |
210 | 212 |
211 // Make sure we persist new user data to Local State. | 213 // Make sure we persist new user data to Local State. |
212 prefs->CommitPendingWrite(); | 214 prefs->CommitPendingWrite(); |
213 | 215 |
216 #if defined(ENABLE_RLZ) | |
217 // Init the RLZ library. | |
218 Profile* profile = ProfileManager::GetDefaultProfile(); | |
Nikita (slow)
2012/11/19 12:27:35
This should be moved to LoginUtils::OnProfileCreat
Ivan Korotkov
2012/11/19 14:00:40
Done.
| |
219 int ping_delay = profile->GetPrefs()->GetInteger( | |
220 first_run::GetPingDelayPrefName().c_str()); | |
221 RLZTracker::InitRlzFromProfileDelayed( | |
222 profile, is_current_user_new_, ping_delay); | |
223 #endif | |
224 | |
214 NotifyOnLogin(); | 225 NotifyOnLogin(); |
215 } | 226 } |
216 | 227 |
217 void UserManagerImpl::DemoUserLoggedIn() { | 228 void UserManagerImpl::DemoUserLoggedIn() { |
218 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 229 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
219 is_current_user_new_ = true; | 230 is_current_user_new_ = true; |
220 is_current_user_ephemeral_ = true; | 231 is_current_user_ephemeral_ = true; |
221 logged_in_user_ = CreateUser(kDemoUser, /* is_ephemeral= */ true); | 232 logged_in_user_ = CreateUser(kDemoUser, /* is_ephemeral= */ true); |
222 user_image_manager_->UserLoggedIn(kDemoUser, /* user_is_new= */ true); | 233 user_image_manager_->UserLoggedIn(kDemoUser, /* user_is_new= */ true); |
223 WallpaperManager::Get()->SetInitialUserWallpaper(kDemoUser, false); | 234 WallpaperManager::Get()->SetInitialUserWallpaper(kDemoUser, false); |
(...skipping 523 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
747 DictionaryPrefUpdate prefs_display_email_update(prefs, kUserDisplayEmail); | 758 DictionaryPrefUpdate prefs_display_email_update(prefs, kUserDisplayEmail); |
748 prefs_display_email_update->RemoveWithoutPathExpansion(email, NULL); | 759 prefs_display_email_update->RemoveWithoutPathExpansion(email, NULL); |
749 | 760 |
750 if (user_to_remove != users_.end()) { | 761 if (user_to_remove != users_.end()) { |
751 delete *user_to_remove; | 762 delete *user_to_remove; |
752 users_.erase(user_to_remove); | 763 users_.erase(user_to_remove); |
753 } | 764 } |
754 } | 765 } |
755 | 766 |
756 } // namespace chromeos | 767 } // namespace chromeos |
OLD | NEW |