OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/existing_user_controller.h" | 5 #include "chrome/browser/chromeos/login/existing_user_controller.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
9 #include "base/stringprintf.h" | 9 #include "base/stringprintf.h" |
10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
(...skipping 13 matching lines...) Expand all Loading... |
24 #include "chrome/browser/chromeos/login/wizard_controller.h" | 24 #include "chrome/browser/chromeos/login/wizard_controller.h" |
25 #include "chrome/browser/chromeos/status/status_area_view.h" | 25 #include "chrome/browser/chromeos/status/status_area_view.h" |
26 #include "chrome/browser/chromeos/user_cros_settings_provider.h" | 26 #include "chrome/browser/chromeos/user_cros_settings_provider.h" |
27 #include "chrome/browser/google/google_util.h" | 27 #include "chrome/browser/google/google_util.h" |
28 #include "chrome/browser/prefs/pref_service.h" | 28 #include "chrome/browser/prefs/pref_service.h" |
29 #include "chrome/browser/profiles/profile_manager.h" | 29 #include "chrome/browser/profiles/profile_manager.h" |
30 #include "chrome/browser/ui/views/window.h" | 30 #include "chrome/browser/ui/views/window.h" |
31 #include "chrome/common/chrome_switches.h" | 31 #include "chrome/common/chrome_switches.h" |
32 #include "chrome/common/net/gaia/google_service_auth_error.h" | 32 #include "chrome/common/net/gaia/google_service_auth_error.h" |
33 #include "chrome/common/pref_names.h" | 33 #include "chrome/common/pref_names.h" |
| 34 #include "content/common/content_notification_types.h" |
34 #include "content/common/notification_service.h" | 35 #include "content/common/notification_service.h" |
35 #include "content/common/notification_type.h" | |
36 #include "grit/generated_resources.h" | 36 #include "grit/generated_resources.h" |
37 #include "ui/base/l10n/l10n_util.h" | 37 #include "ui/base/l10n/l10n_util.h" |
38 #include "views/widget/widget.h" | 38 #include "views/widget/widget.h" |
39 | 39 |
40 namespace chromeos { | 40 namespace chromeos { |
41 | 41 |
42 namespace { | 42 namespace { |
43 | 43 |
44 // Url for setting up sync authentication. | 44 // Url for setting up sync authentication. |
45 const char kSettingsSyncLoginURL[] = "chrome://settings/personal"; | 45 const char kSettingsSyncLoginURL[] = "chrome://settings/personal"; |
(...skipping 27 matching lines...) Expand all Loading... |
73 host_(host), | 73 host_(host), |
74 num_login_attempts_(0), | 74 num_login_attempts_(0), |
75 user_settings_(new UserCrosSettingsProvider), | 75 user_settings_(new UserCrosSettingsProvider), |
76 method_factory_(this) { | 76 method_factory_(this) { |
77 DCHECK(current_controller_ == NULL); | 77 DCHECK(current_controller_ == NULL); |
78 current_controller_ = this; | 78 current_controller_ = this; |
79 | 79 |
80 login_display_ = host_->CreateLoginDisplay(this); | 80 login_display_ = host_->CreateLoginDisplay(this); |
81 | 81 |
82 registrar_.Add(this, | 82 registrar_.Add(this, |
83 NotificationType::LOGIN_USER_IMAGE_CHANGED, | 83 chrome::LOGIN_USER_IMAGE_CHANGED, |
84 NotificationService::AllSources()); | 84 NotificationService::AllSources()); |
85 } | 85 } |
86 | 86 |
87 void ExistingUserController::Init(const UserVector& users) { | 87 void ExistingUserController::Init(const UserVector& users) { |
88 UserVector filtered_users; | 88 UserVector filtered_users; |
89 if (UserCrosSettingsProvider::cached_show_users_on_signin()) { | 89 if (UserCrosSettingsProvider::cached_show_users_on_signin()) { |
90 for (size_t i = 0; i < users.size(); ++i) | 90 for (size_t i = 0; i < users.size(); ++i) |
91 // TODO(xiyuan): Clean user profile whose email is not in whitelist. | 91 // TODO(xiyuan): Clean user profile whose email is not in whitelist. |
92 if (UserCrosSettingsProvider::cached_allow_new_user() || | 92 if (UserCrosSettingsProvider::cached_allow_new_user() || |
93 UserCrosSettingsProvider::IsEmailInCachedWhitelist( | 93 UserCrosSettingsProvider::IsEmailInCachedWhitelist( |
(...skipping 13 matching lines...) Expand all Loading... |
107 LoginUtils::Get()->PrewarmAuthentication(); | 107 LoginUtils::Get()->PrewarmAuthentication(); |
108 if (CrosLibrary::Get()->EnsureLoaded()) | 108 if (CrosLibrary::Get()->EnsureLoaded()) |
109 CrosLibrary::Get()->GetLoginLibrary()->EmitLoginPromptReady(); | 109 CrosLibrary::Get()->GetLoginLibrary()->EmitLoginPromptReady(); |
110 StartAutomaticFreeDiskSpaceControl(); | 110 StartAutomaticFreeDiskSpaceControl(); |
111 } | 111 } |
112 | 112 |
113 //////////////////////////////////////////////////////////////////////////////// | 113 //////////////////////////////////////////////////////////////////////////////// |
114 // ExistingUserController, NotificationObserver implementation: | 114 // ExistingUserController, NotificationObserver implementation: |
115 // | 115 // |
116 | 116 |
117 void ExistingUserController::Observe(NotificationType type, | 117 void ExistingUserController::Observe(int type, |
118 const NotificationSource& source, | 118 const NotificationSource& source, |
119 const NotificationDetails& details) { | 119 const NotificationDetails& details) { |
120 if (type != NotificationType::LOGIN_USER_IMAGE_CHANGED) | 120 if (type != chrome::LOGIN_USER_IMAGE_CHANGED) |
121 return; | 121 return; |
122 | 122 |
123 UserManager::User* user = Details<UserManager::User>(details).ptr(); | 123 UserManager::User* user = Details<UserManager::User>(details).ptr(); |
124 login_display_->OnUserImageChanged(user); | 124 login_display_->OnUserImageChanged(user); |
125 } | 125 } |
126 | 126 |
127 //////////////////////////////////////////////////////////////////////////////// | 127 //////////////////////////////////////////////////////////////////////////////// |
128 // ExistingUserController, private: | 128 // ExistingUserController, private: |
129 | 129 |
130 ExistingUserController::~ExistingUserController() { | 130 ExistingUserController::~ExistingUserController() { |
(...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
519 } | 519 } |
520 if (CrosLibrary::Get()->EnsureLoaded()) { | 520 if (CrosLibrary::Get()->EnsureLoaded()) { |
521 CryptohomeLibrary* cryptohomed = CrosLibrary::Get()->GetCryptohomeLibrary(); | 521 CryptohomeLibrary* cryptohomed = CrosLibrary::Get()->GetCryptohomeLibrary(); |
522 cryptohomed->AsyncSetOwnerUser( | 522 cryptohomed->AsyncSetOwnerUser( |
523 UserCrosSettingsProvider::cached_owner(), NULL); | 523 UserCrosSettingsProvider::cached_owner(), NULL); |
524 cryptohomed->AsyncDoAutomaticFreeDiskSpaceControl(NULL); | 524 cryptohomed->AsyncDoAutomaticFreeDiskSpaceControl(NULL); |
525 } | 525 } |
526 } | 526 } |
527 | 527 |
528 } // namespace chromeos | 528 } // namespace chromeos |
OLD | NEW |