OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/login_display_host_impl.h" | 5 #include "chrome/browser/chromeos/login/login_display_host_impl.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "ash/audio/sounds.h" | 9 #include "ash/audio/sounds.h" |
10 #include "ash/desktop_background/desktop_background_controller.h" | 10 #include "ash/desktop_background/desktop_background_controller.h" |
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
319 status_area_saved_visibility_(false), | 319 status_area_saved_visibility_(false), |
320 crash_count_(0), | 320 crash_count_(0), |
321 restore_path_(RESTORE_UNKNOWN), | 321 restore_path_(RESTORE_UNKNOWN), |
322 finalize_animation_type_(ANIMATION_WORKSPACE), | 322 finalize_animation_type_(ANIMATION_WORKSPACE), |
323 animation_weak_ptr_factory_(this), | 323 animation_weak_ptr_factory_(this), |
324 startup_sound_played_(false), | 324 startup_sound_played_(false), |
325 startup_sound_honors_spoken_feedback_(false), | 325 startup_sound_honors_spoken_feedback_(false), |
326 is_observing_keyboard_(false) { | 326 is_observing_keyboard_(false) { |
327 DBusThreadManager::Get()->GetSessionManagerClient()->AddObserver(this); | 327 DBusThreadManager::Get()->GetSessionManagerClient()->AddObserver(this); |
328 CrasAudioHandler::Get()->AddAudioObserver(this); | 328 CrasAudioHandler::Get()->AddAudioObserver(this); |
329 if (ash::Shell::GetInstance()->keyboard_controller()) { | 329 if (keyboard::KeyboardController::GetInstance()) { |
330 ash::Shell::GetInstance()->keyboard_controller()->AddObserver(this); | 330 keyboard::KeyboardController::GetInstance()->AddObserver(this); |
331 is_observing_keyboard_ = true; | 331 is_observing_keyboard_ = true; |
332 } | 332 } |
333 | 333 |
334 ash::Shell::GetInstance()->delegate()->AddVirtualKeyboardStateObserver(this); | 334 ash::Shell::GetInstance()->delegate()->AddVirtualKeyboardStateObserver(this); |
335 | 335 |
336 // We need to listen to CLOSE_ALL_BROWSERS_REQUEST but not APP_TERMINATING | 336 // We need to listen to CLOSE_ALL_BROWSERS_REQUEST but not APP_TERMINATING |
337 // because/ APP_TERMINATING will never be fired as long as this keeps | 337 // because/ APP_TERMINATING will never be fired as long as this keeps |
338 // ref-count. CLOSE_ALL_BROWSERS_REQUEST is safe here because there will be no | 338 // ref-count. CLOSE_ALL_BROWSERS_REQUEST is safe here because there will be no |
339 // browser instance that will block the shutdown. | 339 // browser instance that will block the shutdown. |
340 registrar_.Add(this, | 340 registrar_.Add(this, |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
420 | 420 |
421 media::SoundsManager* manager = media::SoundsManager::Get(); | 421 media::SoundsManager* manager = media::SoundsManager::Get(); |
422 ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance(); | 422 ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance(); |
423 manager->Initialize(chromeos::SOUND_STARTUP, | 423 manager->Initialize(chromeos::SOUND_STARTUP, |
424 bundle.GetRawDataResource(IDR_SOUND_STARTUP_WAV)); | 424 bundle.GetRawDataResource(IDR_SOUND_STARTUP_WAV)); |
425 } | 425 } |
426 | 426 |
427 LoginDisplayHostImpl::~LoginDisplayHostImpl() { | 427 LoginDisplayHostImpl::~LoginDisplayHostImpl() { |
428 DBusThreadManager::Get()->GetSessionManagerClient()->RemoveObserver(this); | 428 DBusThreadManager::Get()->GetSessionManagerClient()->RemoveObserver(this); |
429 CrasAudioHandler::Get()->RemoveAudioObserver(this); | 429 CrasAudioHandler::Get()->RemoveAudioObserver(this); |
430 if (ash::Shell::GetInstance()->keyboard_controller() && | 430 if (keyboard::KeyboardController::GetInstance() && is_observing_keyboard_) { |
431 is_observing_keyboard_) { | 431 keyboard::KeyboardController::GetInstance()->RemoveObserver(this); |
432 ash::Shell::GetInstance()->keyboard_controller()->RemoveObserver(this); | |
433 is_observing_keyboard_ = false; | 432 is_observing_keyboard_ = false; |
434 } | 433 } |
435 | 434 |
436 ash::Shell::GetInstance()->delegate()-> | 435 ash::Shell::GetInstance()->delegate()-> |
437 RemoveVirtualKeyboardStateObserver(this); | 436 RemoveVirtualKeyboardStateObserver(this); |
438 | 437 |
439 views::FocusManager::set_arrow_key_traversal_enabled(false); | 438 views::FocusManager::set_arrow_key_traversal_enabled(false); |
440 ResetLoginWindowAndView(); | 439 ResetLoginWindowAndView(); |
441 | 440 |
442 // Let chrome process exit after login/oobe screen if needed. | 441 // Let chrome process exit after login/oobe screen if needed. |
(...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
849 | 848 |
850 void LoginDisplayHostImpl::OnActiveOutputNodeChanged() { | 849 void LoginDisplayHostImpl::OnActiveOutputNodeChanged() { |
851 TryToPlayStartupSound(); | 850 TryToPlayStartupSound(); |
852 } | 851 } |
853 | 852 |
854 //////////////////////////////////////////////////////////////////////////////// | 853 //////////////////////////////////////////////////////////////////////////////// |
855 // LoginDisplayHostImpl, ash::KeyboardStateObserver: | 854 // LoginDisplayHostImpl, ash::KeyboardStateObserver: |
856 // implementation: | 855 // implementation: |
857 | 856 |
858 void LoginDisplayHostImpl::OnVirtualKeyboardStateChanged(bool activated) { | 857 void LoginDisplayHostImpl::OnVirtualKeyboardStateChanged(bool activated) { |
859 if (ash::Shell::GetInstance()->keyboard_controller()) { | 858 if (keyboard::KeyboardController::GetInstance()) { |
860 if (activated) { | 859 if (activated) { |
861 if (!is_observing_keyboard_) { | 860 if (!is_observing_keyboard_) { |
862 ash::Shell::GetInstance()->keyboard_controller()->AddObserver(this); | 861 keyboard::KeyboardController::GetInstance()->AddObserver(this); |
863 is_observing_keyboard_ = true; | 862 is_observing_keyboard_ = true; |
864 } | 863 } |
865 } else { | 864 } else { |
866 ash::Shell::GetInstance()->keyboard_controller()->RemoveObserver(this); | 865 keyboard::KeyboardController::GetInstance()->RemoveObserver(this); |
867 is_observing_keyboard_ = false; | 866 is_observing_keyboard_ = false; |
868 } | 867 } |
869 } | 868 } |
870 } | 869 } |
871 | 870 |
872 //////////////////////////////////////////////////////////////////////////////// | 871 //////////////////////////////////////////////////////////////////////////////// |
873 // LoginDisplayHostImpl, keyboard::KeyboardControllerObserver: | 872 // LoginDisplayHostImpl, keyboard::KeyboardControllerObserver: |
874 // implementation: | 873 // implementation: |
875 | 874 |
876 void LoginDisplayHostImpl::OnKeyboardBoundsChanging( | 875 void LoginDisplayHostImpl::OnKeyboardBoundsChanging( |
(...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1252 scoped_ptr<locale_util::SwitchLanguageCallback> callback( | 1251 scoped_ptr<locale_util::SwitchLanguageCallback> callback( |
1253 new locale_util::SwitchLanguageCallback( | 1252 new locale_util::SwitchLanguageCallback( |
1254 base::Bind(&OnLanguageSwitchedCallback, base::Passed(data.Pass())))); | 1253 base::Bind(&OnLanguageSwitchedCallback, base::Passed(data.Pass())))); |
1255 | 1254 |
1256 // Load locale keyboards here. Hardware layout would be automatically enabled. | 1255 // Load locale keyboards here. Hardware layout would be automatically enabled. |
1257 locale_util::SwitchLanguage( | 1256 locale_util::SwitchLanguage( |
1258 locale, true, true /* login_layouts_only */, callback.Pass()); | 1257 locale, true, true /* login_layouts_only */, callback.Pass()); |
1259 } | 1258 } |
1260 | 1259 |
1261 } // namespace chromeos | 1260 } // namespace chromeos |
OLD | NEW |