| 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" |
| 11 #include "chrome/browser/browser_process.h" | 11 #include "chrome/browser/browser_process.h" |
| 12 #include "chrome/browser/browser_shutdown.h" | 12 #include "chrome/browser/browser_shutdown.h" |
| 13 #include "chrome/browser/chromeos/cros/cros_library.h" | 13 #include "chrome/browser/chromeos/cros/cros_library.h" |
| 14 #include "chrome/browser/chromeos/dbus/dbus_thread_manager.h" | 14 #include "chrome/browser/chromeos/dbus/dbus_thread_manager.h" |
| 15 #include "chrome/browser/chromeos/dbus/session_manager_client.h" | 15 #include "chrome/browser/chromeos/dbus/session_manager_client.h" |
| 16 #include "chrome/browser/chromeos/customization_document.h" | 16 #include "chrome/browser/chromeos/customization_document.h" |
| 17 #include "chrome/browser/chromeos/input_method/input_method_manager.h" | 17 #include "chrome/browser/chromeos/input_method/input_method_manager.h" |
| 18 #include "chrome/browser/chromeos/input_method/input_method_util.h" | 18 #include "chrome/browser/chromeos/input_method/input_method_util.h" |
| 19 #include "chrome/browser/chromeos/language_preferences.h" | 19 #include "chrome/browser/chromeos/language_preferences.h" |
| 20 #include "chrome/browser/chromeos/login/existing_user_controller.h" | 20 #include "chrome/browser/chromeos/login/existing_user_controller.h" |
| 21 #include "chrome/browser/chromeos/login/helper.h" | 21 #include "chrome/browser/chromeos/login/helper.h" |
| 22 #include "chrome/browser/chromeos/login/language_switch_menu.h" | 22 #include "chrome/browser/chromeos/login/language_switch_menu.h" |
| 23 #include "chrome/browser/chromeos/login/login_utils.h" | 23 #include "chrome/browser/chromeos/login/login_utils.h" |
| 24 #include "chrome/browser/chromeos/login/user_manager.h" | 24 #include "chrome/browser/chromeos/login/user_manager.h" |
| 25 #include "chrome/browser/chromeos/login/views_login_display_host.h" | |
| 26 #include "chrome/browser/chromeos/login/webui_login_display_host.h" | 25 #include "chrome/browser/chromeos/login/webui_login_display_host.h" |
| 27 #include "chrome/browser/chromeos/login/wizard_controller.h" | 26 #include "chrome/browser/chromeos/login/wizard_controller.h" |
| 28 #include "chrome/browser/chromeos/mobile_config.h" | 27 #include "chrome/browser/chromeos/mobile_config.h" |
| 29 #include "chrome/browser/chromeos/system/timezone_settings.h" | 28 #include "chrome/browser/chromeos/system/timezone_settings.h" |
| 30 #include "chrome/browser/policy/browser_policy_connector.h" | 29 #include "chrome/browser/policy/browser_policy_connector.h" |
| 31 #include "chrome/browser/prefs/pref_service.h" | 30 #include "chrome/browser/prefs/pref_service.h" |
| 32 #include "chrome/common/chrome_switches.h" | |
| 33 #include "chrome/common/pref_names.h" | 31 #include "chrome/common/pref_names.h" |
| 34 #include "content/public/browser/notification_service.h" | 32 #include "content/public/browser/notification_service.h" |
| 35 #include "content/public/browser/notification_types.h" | 33 #include "content/public/browser/notification_types.h" |
| 36 #include "googleurl/src/gurl.h" | 34 #include "googleurl/src/gurl.h" |
| 37 #include "third_party/cros_system_api/window_manager/chromeos_wm_ipc_enums.h" | 35 #include "third_party/cros_system_api/window_manager/chromeos_wm_ipc_enums.h" |
| 38 #include "ui/base/resource/resource_bundle.h" | 36 #include "ui/base/resource/resource_bundle.h" |
| 39 #include "unicode/timezone.h" | 37 #include "unicode/timezone.h" |
| 40 | 38 |
| 41 #if defined(TOOLKIT_USES_GTK) | 39 #if defined(TOOLKIT_USES_GTK) |
| 42 #include "chrome/browser/chromeos/wm_ipc.h" | 40 #include "chrome/browser/chromeos/wm_ipc.h" |
| (...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 241 | 239 |
| 242 gfx::Rect screen_bounds(chromeos::CalculateScreenBounds(size)); | 240 gfx::Rect screen_bounds(chromeos::CalculateScreenBounds(size)); |
| 243 | 241 |
| 244 // Check whether we need to execute OOBE process. | 242 // Check whether we need to execute OOBE process. |
| 245 bool oobe_complete = chromeos::WizardController::IsOobeCompleted(); | 243 bool oobe_complete = chromeos::WizardController::IsOobeCompleted(); |
| 246 bool show_login_screen = | 244 bool show_login_screen = |
| 247 (first_screen_name.empty() && oobe_complete) || | 245 (first_screen_name.empty() && oobe_complete) || |
| 248 first_screen_name == chromeos::WizardController::kLoginScreenName; | 246 first_screen_name == chromeos::WizardController::kLoginScreenName; |
| 249 | 247 |
| 250 chromeos::LoginDisplayHost* display_host; | 248 chromeos::LoginDisplayHost* display_host; |
| 251 #if defined(USE_AURA) | |
| 252 // Under Aura we always use the WebUI. | |
| 253 display_host = new chromeos::WebUILoginDisplayHost(screen_bounds); | 249 display_host = new chromeos::WebUILoginDisplayHost(screen_bounds); |
| 254 #else | |
| 255 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kWebUILogin)) { | |
| 256 display_host = new chromeos::WebUILoginDisplayHost(screen_bounds); | |
| 257 } else { | |
| 258 display_host = new chromeos::ViewsLoginDisplayHost(screen_bounds); | |
| 259 } | |
| 260 #endif | |
| 261 | 250 |
| 262 if (show_login_screen && chromeos::CrosLibrary::Get()->EnsureLoaded()) { | 251 if (show_login_screen && chromeos::CrosLibrary::Get()->EnsureLoaded()) { |
| 263 // R11 > R12 migration fix. See http://crosbug.com/p/4898. | 252 // R11 > R12 migration fix. See http://crosbug.com/p/4898. |
| 264 // If user has manually changed locale during R11 OOBE, locale will be set. | 253 // If user has manually changed locale during R11 OOBE, locale will be set. |
| 265 // On R12 > R12|R13 etc. this fix won't get activated since | 254 // On R12 > R12|R13 etc. this fix won't get activated since |
| 266 // OOBE process has set kApplicationLocale to non-default value. | 255 // OOBE process has set kApplicationLocale to non-default value. |
| 267 PrefService* prefs = g_browser_process->local_state(); | 256 PrefService* prefs = g_browser_process->local_state(); |
| 268 if (!prefs->HasPrefPath(prefs::kApplicationLocale)) { | 257 if (!prefs->HasPrefPath(prefs::kApplicationLocale)) { |
| 269 std::string locale = chromeos::WizardController::GetInitialLocale(); | 258 std::string locale = chromeos::WizardController::GetInitialLocale(); |
| 270 prefs->SetString(prefs::kApplicationLocale, locale); | 259 prefs->SetString(prefs::kApplicationLocale, locale); |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 340 // user has changed to during OOBE. | 329 // user has changed to during OOBE. |
| 341 if (!timezone_name.empty()) { | 330 if (!timezone_name.empty()) { |
| 342 icu::TimeZone* timezone = icu::TimeZone::createTimeZone( | 331 icu::TimeZone* timezone = icu::TimeZone::createTimeZone( |
| 343 icu::UnicodeString::fromUTF8(timezone_name)); | 332 icu::UnicodeString::fromUTF8(timezone_name)); |
| 344 CHECK(timezone) << "Timezone could not be set for " << timezone_name; | 333 CHECK(timezone) << "Timezone could not be set for " << timezone_name; |
| 345 chromeos::system::TimezoneSettings::GetInstance()->SetTimezone(*timezone); | 334 chromeos::system::TimezoneSettings::GetInstance()->SetTimezone(*timezone); |
| 346 } | 335 } |
| 347 } | 336 } |
| 348 | 337 |
| 349 } // namespace browser | 338 } // namespace browser |
| OLD | NEW |