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

Side by Side Diff: chrome/browser/chromeos/login/base_login_display_host.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/base_login_display_host.h" 5 #include "chrome/browser/chromeos/login/base_login_display_host.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/file_util.h" 8 #include "base/file_util.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/threading/thread_restrictions.h" 10 #include "base/threading/thread_restrictions.h"
(...skipping 20 matching lines...) Expand all
31 #include "chrome/browser/prefs/pref_service.h" 31 #include "chrome/browser/prefs/pref_service.h"
32 #include "chrome/common/chrome_switches.h" 32 #include "chrome/common/chrome_switches.h"
33 #include "chrome/common/pref_names.h" 33 #include "chrome/common/pref_names.h"
34 #include "content/public/browser/notification_service.h" 34 #include "content/public/browser/notification_service.h"
35 #include "content/public/browser/notification_types.h" 35 #include "content/public/browser/notification_types.h"
36 #include "googleurl/src/gurl.h" 36 #include "googleurl/src/gurl.h"
37 #include "third_party/cros_system_api/window_manager/chromeos_wm_ipc_enums.h" 37 #include "third_party/cros_system_api/window_manager/chromeos_wm_ipc_enums.h"
38 #include "ui/base/resource/resource_bundle.h" 38 #include "ui/base/resource/resource_bundle.h"
39 #include "unicode/timezone.h" 39 #include "unicode/timezone.h"
40 40
41 // TODO(altimofeev): move to ViewsLoginDisplayHost
42 #include "chrome/browser/chromeos/login/views_oobe_display.h"
43
44 #if defined(TOOLKIT_USES_GTK) 41 #if defined(TOOLKIT_USES_GTK)
45 #include "chrome/browser/chromeos/wm_ipc.h" 42 #include "chrome/browser/chromeos/wm_ipc.h"
46 #endif 43 #endif
47 44
48 namespace { 45 namespace {
49 46
50 // The delay of triggering initialization of the device policy subsystem 47 // The delay of triggering initialization of the device policy subsystem
51 // after the login screen is initialized. This makes sure that device policy 48 // after the login screen is initialized. This makes sure that device policy
52 // network requests are made while the system is idle waiting for user input. 49 // network requests are made while the system is idle waiting for user input.
53 const int64 kPolicyServiceInitializationDelayMilliseconds = 100; 50 const int64 kPolicyServiceInitializationDelayMilliseconds = 100;
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 default_host_ = NULL; 122 default_host_ = NULL;
126 } 123 }
127 124
128 // LoginDisplayHost implementation --------------------------------------------- 125 // LoginDisplayHost implementation ---------------------------------------------
129 126
130 void BaseLoginDisplayHost::OnSessionStart() { 127 void BaseLoginDisplayHost::OnSessionStart() {
131 registrar_.RemoveAll(); 128 registrar_.RemoveAll();
132 MessageLoop::current()->DeleteSoon(FROM_HERE, this); 129 MessageLoop::current()->DeleteSoon(FROM_HERE, this);
133 } 130 }
134 131
135 WizardController* BaseLoginDisplayHost::CreateWizardController() {
136 // TODO(altimofeev): move this code to ViewsLoginDisplayHost when WebUI
137 // implementation will always be used with WebUILoginDisplayHost.
138 oobe_display_.reset(new ViewsOobeDisplay(background_bounds()));
139 WizardController* wizard_controller =
140 new WizardController(this, oobe_display_.get());
141 oobe_display_->SetScreenObserver(wizard_controller);
142 return wizard_controller;
143 }
144
145 void BaseLoginDisplayHost::StartWizard( 132 void BaseLoginDisplayHost::StartWizard(
146 const std::string& first_screen_name, 133 const std::string& first_screen_name,
147 const GURL& start_url) { 134 const GURL& start_url) {
148 DVLOG(1) << "Starting wizard, first_screen_name: " << first_screen_name; 135 DVLOG(1) << "Starting wizard, first_screen_name: " << first_screen_name;
149 // Create and show the wizard. 136 // Create and show the wizard.
150 // Note, dtor of the old WizardController should be called before ctor of the 137 // Note, dtor of the old WizardController should be called before ctor of the
151 // new one, because "default_controller()" is updated there. So pure "reset()" 138 // new one, because "default_controller()" is updated there. So pure "reset()"
152 // is done before new controller creation. 139 // is done before new controller creation.
153 wizard_controller_.reset(); 140 wizard_controller_.reset();
154 141 wizard_controller_.reset(CreateWizardController());
155 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kWebUILogin)) {
156 wizard_controller_.reset(CreateWizardController());
157 } else {
158 // Force views based implementation.
159 wizard_controller_.reset(BaseLoginDisplayHost::CreateWizardController());
160 }
161 142
162 wizard_controller_->set_start_url(start_url); 143 wizard_controller_->set_start_url(start_url);
163 ShowBackground(); 144 ShowBackground();
164 if (!WizardController::IsDeviceRegistered()) 145 if (!WizardController::IsDeviceRegistered())
165 SetOobeProgressBarVisible(true); 146 SetOobeProgressBarVisible(true);
166 wizard_controller_->Init(first_screen_name); 147 wizard_controller_->Init(first_screen_name);
167 } 148 }
168 149
169 void BaseLoginDisplayHost::StartSignInScreen() { 150 void BaseLoginDisplayHost::StartSignInScreen() {
170 oobe_display_.reset();
171
172 DVLOG(1) << "Starting sign in screen"; 151 DVLOG(1) << "Starting sign in screen";
173 std::vector<chromeos::UserManager::User> users = 152 std::vector<chromeos::UserManager::User> users =
174 chromeos::UserManager::Get()->GetUsers(); 153 chromeos::UserManager::Get()->GetUsers();
175 154
176 // Fix for users who updated device and thus never passed register screen. 155 // Fix for users who updated device and thus never passed register screen.
177 // If we already have users, we assume that it is not a second part of 156 // If we already have users, we assume that it is not a second part of
178 // OOBE. See http://crosbug.com/6289 157 // OOBE. See http://crosbug.com/6289
179 if (!WizardController::IsDeviceRegistered() && !users.empty()) { 158 if (!WizardController::IsDeviceRegistered() && !users.empty()) {
180 VLOG(1) << "Mark device registered because there are remembered users: " 159 VLOG(1) << "Mark device registered because there are remembered users: "
181 << users.size(); 160 << users.size();
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
361 // user has changed to during OOBE. 340 // user has changed to during OOBE.
362 if (!timezone_name.empty()) { 341 if (!timezone_name.empty()) {
363 icu::TimeZone* timezone = icu::TimeZone::createTimeZone( 342 icu::TimeZone* timezone = icu::TimeZone::createTimeZone(
364 icu::UnicodeString::fromUTF8(timezone_name)); 343 icu::UnicodeString::fromUTF8(timezone_name));
365 CHECK(timezone) << "Timezone could not be set for " << timezone_name; 344 CHECK(timezone) << "Timezone could not be set for " << timezone_name;
366 chromeos::system::TimezoneSettings::GetInstance()->SetTimezone(*timezone); 345 chromeos::system::TimezoneSettings::GetInstance()->SetTimezone(*timezone);
367 } 346 }
368 } 347 }
369 348
370 } // namespace browser 349 } // namespace browser
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/login/base_login_display_host.h ('k') | chrome/browser/chromeos/login/existing_user_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698