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/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 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 | 112 |
113 default_host_ = NULL; | 113 default_host_ = NULL; |
114 } | 114 } |
115 | 115 |
116 // LoginDisplayHost implementation --------------------------------------------- | 116 // LoginDisplayHost implementation --------------------------------------------- |
117 | 117 |
118 void BaseLoginDisplayHost::OnSessionStart() { | 118 void BaseLoginDisplayHost::OnSessionStart() { |
119 MessageLoop::current()->DeleteSoon(FROM_HERE, this); | 119 MessageLoop::current()->DeleteSoon(FROM_HERE, this); |
120 } | 120 } |
121 | 121 |
| 122 WizardController* BaseLoginDisplayHost::CreateWizardController() { |
| 123 // TODO(altimofeev): move this code to ViewsLoginDisplayHost when WebUI |
| 124 // implementation will always be used with WebUILoginDisplayHost. |
| 125 oobe_display_.reset(new ViewsOobeDisplay(background_bounds())); |
| 126 WizardController* wizard_controller = |
| 127 new WizardController(this, oobe_display_.get()); |
| 128 oobe_display_->SetScreenObserver(wizard_controller); |
| 129 return wizard_controller; |
| 130 } |
| 131 |
122 void BaseLoginDisplayHost::StartWizard( | 132 void BaseLoginDisplayHost::StartWizard( |
123 const std::string& first_screen_name, | 133 const std::string& first_screen_name, |
124 const GURL& start_url) { | 134 const GURL& start_url) { |
125 DVLOG(1) << "Starting wizard, first_screen_name: " << first_screen_name; | 135 DVLOG(1) << "Starting wizard, first_screen_name: " << first_screen_name; |
126 // Create and show the wizard. | 136 // Create and show the wizard. |
127 // 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 |
128 // new one, because "default_controller()" is updated there. So pure "reset()" | 138 // new one, because "default_controller()" is updated there. So pure "reset()" |
129 // is done before new controller creation. | 139 // is done before new controller creation. |
130 wizard_controller_.reset(); | 140 wizard_controller_.reset(); |
131 | 141 |
132 ViewsOobeDisplay* oobe_display = new ViewsOobeDisplay(background_bounds_); | 142 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kAllowWebUIOobe)) { |
133 wizard_controller_.reset(new WizardController(this, oobe_display)); | 143 wizard_controller_.reset(CreateWizardController()); |
134 oobe_display->SetScreenObserver(wizard_controller_.get()); | 144 } else { |
| 145 // Force views based implementation. |
| 146 wizard_controller_.reset(BaseLoginDisplayHost::CreateWizardController()); |
| 147 } |
135 | 148 |
136 wizard_controller_->set_start_url(start_url); | 149 wizard_controller_->set_start_url(start_url); |
137 ShowBackground(); | 150 ShowBackground(); |
138 if (!WizardController::IsDeviceRegistered()) | 151 if (!WizardController::IsDeviceRegistered()) |
139 SetOobeProgressBarVisible(true); | 152 SetOobeProgressBarVisible(true); |
140 wizard_controller_->Init(first_screen_name); | 153 wizard_controller_->Init(first_screen_name); |
141 } | 154 } |
142 | 155 |
143 void BaseLoginDisplayHost::StartSignInScreen() { | 156 void BaseLoginDisplayHost::StartSignInScreen() { |
| 157 oobe_display_.reset(); |
| 158 |
144 DVLOG(1) << "Starting sign in screen"; | 159 DVLOG(1) << "Starting sign in screen"; |
145 std::vector<chromeos::UserManager::User> users = | 160 std::vector<chromeos::UserManager::User> users = |
146 chromeos::UserManager::Get()->GetUsers(); | 161 chromeos::UserManager::Get()->GetUsers(); |
147 | 162 |
148 // Fix for users who updated device and thus never passed register screen. | 163 // Fix for users who updated device and thus never passed register screen. |
149 // If we already have users, we assume that it is not a second part of | 164 // If we already have users, we assume that it is not a second part of |
150 // OOBE. See http://crosbug.com/6289 | 165 // OOBE. See http://crosbug.com/6289 |
151 if (!WizardController::IsDeviceRegistered() && !users.empty()) { | 166 if (!WizardController::IsDeviceRegistered() && !users.empty()) { |
152 VLOG(1) << "Mark device registered because there are remembered users: " | 167 VLOG(1) << "Mark device registered because there are remembered users: " |
153 << users.size(); | 168 << users.size(); |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
307 if (!timezone_name.empty()) { | 322 if (!timezone_name.empty()) { |
308 icu::TimeZone* timezone = icu::TimeZone::createTimeZone( | 323 icu::TimeZone* timezone = icu::TimeZone::createTimeZone( |
309 icu::UnicodeString::fromUTF8(timezone_name)); | 324 icu::UnicodeString::fromUTF8(timezone_name)); |
310 CHECK(timezone) << "Timezone could not be set for " << timezone_name; | 325 CHECK(timezone) << "Timezone could not be set for " << timezone_name; |
311 chromeos::SystemAccess::GetInstance()->SetTimezone(*timezone); | 326 chromeos::SystemAccess::GetInstance()->SetTimezone(*timezone); |
312 } | 327 } |
313 } | 328 } |
314 } | 329 } |
315 | 330 |
316 } // namespace browser | 331 } // namespace browser |
OLD | NEW |