Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(278)

Side by Side Diff: chrome/browser/chromeos/login/existing_user_controller.cc

Issue 8395042: [cros,de-hack] Get rid of singleton for the WebUILoginScreen. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: comment nit Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 73
74 // static 74 // static
75 ExistingUserController* ExistingUserController::current_controller_ = NULL; 75 ExistingUserController* ExistingUserController::current_controller_ = NULL;
76 76
77 //////////////////////////////////////////////////////////////////////////////// 77 ////////////////////////////////////////////////////////////////////////////////
78 // ExistingUserController, public: 78 // ExistingUserController, public:
79 79
80 ExistingUserController::ExistingUserController(LoginDisplayHost* host) 80 ExistingUserController::ExistingUserController(LoginDisplayHost* host)
81 : login_status_consumer_(NULL), 81 : login_status_consumer_(NULL),
82 host_(host), 82 host_(host),
83 login_display_(host_->CreateLoginDisplay(this)),
83 num_login_attempts_(0), 84 num_login_attempts_(0),
84 user_settings_(new UserCrosSettingsProvider), 85 user_settings_(new UserCrosSettingsProvider),
85 weak_factory_(this), 86 weak_factory_(this),
86 is_owner_login_(false) { 87 is_owner_login_(false) {
87 DCHECK(current_controller_ == NULL); 88 DCHECK(current_controller_ == NULL);
88 current_controller_ = this; 89 current_controller_ = this;
89 90
90 login_display_ = host_->CreateLoginDisplay(this);
91
92 registrar_.Add(this, 91 registrar_.Add(this,
93 chrome::NOTIFICATION_LOGIN_USER_IMAGE_CHANGED, 92 chrome::NOTIFICATION_LOGIN_USER_IMAGE_CHANGED,
94 content::NotificationService::AllSources()); 93 content::NotificationService::AllSources());
95 } 94 }
96 95
97 void ExistingUserController::Init(const UserVector& users) { 96 void ExistingUserController::Init(const UserVector& users) {
98 UserVector filtered_users; 97 UserVector filtered_users;
99 if (UserCrosSettingsProvider::cached_show_users_on_signin()) { 98 if (UserCrosSettingsProvider::cached_show_users_on_signin()) {
100 for (size_t i = 0; i < users.size(); ++i) 99 for (size_t i = 0; i < users.size(); ++i)
101 // TODO(xiyuan): Clean user profile whose email is not in whitelist. 100 // TODO(xiyuan): Clean user profile whose email is not in whitelist.
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 // ExistingUserController, private: 136 // ExistingUserController, private:
138 137
139 ExistingUserController::~ExistingUserController() { 138 ExistingUserController::~ExistingUserController() {
140 LoginUtils::Get()->DelegateDeleted(this); 139 LoginUtils::Get()->DelegateDeleted(this);
141 140
142 if (current_controller_ == this) { 141 if (current_controller_ == this) {
143 current_controller_ = NULL; 142 current_controller_ = NULL;
144 } else { 143 } else {
145 NOTREACHED() << "More than one controller are alive."; 144 NOTREACHED() << "More than one controller are alive.";
146 } 145 }
147 DCHECK(login_display_ != NULL); 146 DCHECK(login_display_.get());
148 login_display_->Destroy();
149 login_display_ = NULL;
150 } 147 }
151 148
152 //////////////////////////////////////////////////////////////////////////////// 149 ////////////////////////////////////////////////////////////////////////////////
153 // ExistingUserController, LoginDisplay::Delegate implementation: 150 // ExistingUserController, LoginDisplay::Delegate implementation:
154 // 151 //
155 152
156 void ExistingUserController::CreateAccount() { 153 void ExistingUserController::CreateAccount() {
157 guest_mode_url_ = 154 guest_mode_url_ =
158 google_util::AppendGoogleLocaleParam(GURL(kCreateAccountURL)); 155 google_util::AppendGoogleLocaleParam(GURL(kCreateAccountURL));
159 LoginAsGuest(); 156 LoginAsGuest();
(...skipping 433 matching lines...) Expand 10 before | Expand all | Expand 10 after
593 cryptohomed->AsyncSetOwnerUser( 590 cryptohomed->AsyncSetOwnerUser(
594 UserCrosSettingsProvider::cached_owner(), NULL); 591 UserCrosSettingsProvider::cached_owner(), NULL);
595 592
596 // Do not invoke AsyncDoAutomaticFreeDiskSpaceControl(NULL) here 593 // Do not invoke AsyncDoAutomaticFreeDiskSpaceControl(NULL) here
597 // so it does not delay the following mount. Cleanup will be 594 // so it does not delay the following mount. Cleanup will be
598 // started in Cryptohomed by timer. 595 // started in Cryptohomed by timer.
599 } 596 }
600 } 597 }
601 598
602 } // namespace chromeos 599 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698