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

Side by Side Diff: chrome/browser/chromeos/login/ui/login_display_host_impl.cc

Issue 292233002: Disable VK overscroll for login/out-of-box. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase, keyboard override value: convert to bool Created 6 years, 7 months 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/ui/login_display_host_impl.h" 5 #include "chrome/browser/chromeos/login/ui/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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 #include "content/public/browser/web_contents.h" 73 #include "content/public/browser/web_contents.h"
74 #include "content/public/browser/web_ui.h" 74 #include "content/public/browser/web_ui.h"
75 #include "grit/browser_resources.h" 75 #include "grit/browser_resources.h"
76 #include "media/audio/sounds/sounds_manager.h" 76 #include "media/audio/sounds/sounds_manager.h"
77 #include "ui/aura/window.h" 77 #include "ui/aura/window.h"
78 #include "ui/base/resource/resource_bundle.h" 78 #include "ui/base/resource/resource_bundle.h"
79 #include "ui/compositor/layer.h" 79 #include "ui/compositor/layer.h"
80 #include "ui/compositor/layer_animation_observer.h" 80 #include "ui/compositor/layer_animation_observer.h"
81 #include "ui/compositor/scoped_layer_animation_settings.h" 81 #include "ui/compositor/scoped_layer_animation_settings.h"
82 #include "ui/events/event_utils.h" 82 #include "ui/events/event_utils.h"
83 #include "ui/gfx/display.h"
83 #include "ui/gfx/rect.h" 84 #include "ui/gfx/rect.h"
85 #include "ui/gfx/screen.h"
86 #include "ui/gfx/size.h"
84 #include "ui/gfx/transform.h" 87 #include "ui/gfx/transform.h"
85 #include "ui/keyboard/keyboard_controller.h" 88 #include "ui/keyboard/keyboard_controller.h"
89 #include "ui/keyboard/keyboard_util.h"
86 #include "ui/views/focus/focus_manager.h" 90 #include "ui/views/focus/focus_manager.h"
87 #include "ui/views/widget/widget.h" 91 #include "ui/views/widget/widget.h"
88 #include "ui/views/widget/widget_delegate.h" 92 #include "ui/views/widget/widget_delegate.h"
89 #include "ui/wm/core/window_animations.h" 93 #include "ui/wm/core/window_animations.h"
90 #include "url/gurl.h" 94 #include "url/gurl.h"
91 95
92 namespace { 96 namespace {
93 97
94 // Maximum delay for startup sound after 'loginPromptVisible' signal. 98 // Maximum delay for startup sound after 'loginPromptVisible' signal.
95 const int kStartupSoundMaxDelayMs = 2000; 99 const int kStartupSoundMaxDelayMs = 2000;
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
275 virtual bool ShouldAdvanceFocusToTopLevelWidget() const OVERRIDE { 279 virtual bool ShouldAdvanceFocusToTopLevelWidget() const OVERRIDE {
276 return true; 280 return true;
277 } 281 }
278 282
279 private: 283 private:
280 views::Widget* widget_; 284 views::Widget* widget_;
281 285
282 DISALLOW_COPY_AND_ASSIGN(LoginWidgetDelegate); 286 DISALLOW_COPY_AND_ASSIGN(LoginWidgetDelegate);
283 }; 287 };
284 288
289 // Disables virtual keyboard overscroll. Login UI will scroll user pods
290 // into view on JS side when virtual keyboard is shown.
291 void DisableKeyboardOverscroll() {
292 keyboard::SetKeyboardOverscrollOverride(
293 keyboard::KEYBOARD_OVERSCROLL_OVERRIDE_DISABLED);
294 }
295
296 void ResetKeyboardOverscrollOverride() {
297 keyboard::SetKeyboardOverscrollOverride(
298 keyboard::KEYBOARD_OVERSCROLL_OVERRIDE_NONE);
299 }
300
285 } // namespace 301 } // namespace
286 302
287 namespace chromeos { 303 namespace chromeos {
288 304
289 // static 305 // static
290 LoginDisplayHost* LoginDisplayHostImpl::default_host_ = NULL; 306 LoginDisplayHost* LoginDisplayHostImpl::default_host_ = NULL;
291 307
292 // static 308 // static
293 const int LoginDisplayHostImpl::kShowLoginWebUIid = 0x1111; 309 const int LoginDisplayHostImpl::kShowLoginWebUIid = 0x1111;
294 310
(...skipping 30 matching lines...) Expand all
325 startup_sound_honors_spoken_feedback_(false), 341 startup_sound_honors_spoken_feedback_(false),
326 is_observing_keyboard_(false) { 342 is_observing_keyboard_(false) {
327 DBusThreadManager::Get()->GetSessionManagerClient()->AddObserver(this); 343 DBusThreadManager::Get()->GetSessionManagerClient()->AddObserver(this);
328 CrasAudioHandler::Get()->AddAudioObserver(this); 344 CrasAudioHandler::Get()->AddAudioObserver(this);
329 if (keyboard::KeyboardController::GetInstance()) { 345 if (keyboard::KeyboardController::GetInstance()) {
330 keyboard::KeyboardController::GetInstance()->AddObserver(this); 346 keyboard::KeyboardController::GetInstance()->AddObserver(this);
331 is_observing_keyboard_ = true; 347 is_observing_keyboard_ = true;
332 } 348 }
333 349
334 ash::Shell::GetInstance()->delegate()->AddVirtualKeyboardStateObserver(this); 350 ash::Shell::GetInstance()->delegate()->AddVirtualKeyboardStateObserver(this);
351 ash::Shell::GetScreen()->AddObserver(this);
335 352
336 // We need to listen to CLOSE_ALL_BROWSERS_REQUEST but not APP_TERMINATING 353 // 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 354 // 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 355 // ref-count. CLOSE_ALL_BROWSERS_REQUEST is safe here because there will be no
339 // browser instance that will block the shutdown. 356 // browser instance that will block the shutdown.
340 registrar_.Add(this, 357 registrar_.Add(this,
341 chrome::NOTIFICATION_CLOSE_ALL_BROWSERS_REQUEST, 358 chrome::NOTIFICATION_CLOSE_ALL_BROWSERS_REQUEST,
342 content::NotificationService::AllSources()); 359 content::NotificationService::AllSources());
343 360
344 // NOTIFICATION_BROWSER_OPENED is issued after browser is created, but 361 // NOTIFICATION_BROWSER_OPENED is issued after browser is created, but
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
427 LoginDisplayHostImpl::~LoginDisplayHostImpl() { 444 LoginDisplayHostImpl::~LoginDisplayHostImpl() {
428 DBusThreadManager::Get()->GetSessionManagerClient()->RemoveObserver(this); 445 DBusThreadManager::Get()->GetSessionManagerClient()->RemoveObserver(this);
429 CrasAudioHandler::Get()->RemoveAudioObserver(this); 446 CrasAudioHandler::Get()->RemoveAudioObserver(this);
430 if (keyboard::KeyboardController::GetInstance() && is_observing_keyboard_) { 447 if (keyboard::KeyboardController::GetInstance() && is_observing_keyboard_) {
431 keyboard::KeyboardController::GetInstance()->RemoveObserver(this); 448 keyboard::KeyboardController::GetInstance()->RemoveObserver(this);
432 is_observing_keyboard_ = false; 449 is_observing_keyboard_ = false;
433 } 450 }
434 451
435 ash::Shell::GetInstance()->delegate()-> 452 ash::Shell::GetInstance()->delegate()->
436 RemoveVirtualKeyboardStateObserver(this); 453 RemoveVirtualKeyboardStateObserver(this);
454 ash::Shell::GetScreen()->RemoveObserver(this);
455
456 if (login::LoginScrollIntoViewEnabled())
457 ResetKeyboardOverscrollOverride();
437 458
438 views::FocusManager::set_arrow_key_traversal_enabled(false); 459 views::FocusManager::set_arrow_key_traversal_enabled(false);
439 ResetLoginWindowAndView(); 460 ResetLoginWindowAndView();
440 461
441 // Let chrome process exit after login/oobe screen if needed. 462 // Let chrome process exit after login/oobe screen if needed.
442 chrome::DecrementKeepAliveCount(); 463 chrome::DecrementKeepAliveCount();
443 464
444 default_host_ = NULL; 465 default_host_ = NULL;
445 // TODO(tengs): This should be refactored. See crbug.com/314934. 466 // TODO(tengs): This should be refactored. See crbug.com/314934.
446 if (UserManager::Get()->IsCurrentUserNew()) { 467 if (UserManager::Get()->IsCurrentUserNew()) {
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
523 auto_enrollment_controller_->RegisterProgressCallback( 544 auto_enrollment_controller_->RegisterProgressCallback(
524 base::Bind(&LoginDisplayHostImpl::OnAutoEnrollmentProgress, 545 base::Bind(&LoginDisplayHostImpl::OnAutoEnrollmentProgress,
525 base::Unretained(this))); 546 base::Unretained(this)));
526 } 547 }
527 return auto_enrollment_controller_.get(); 548 return auto_enrollment_controller_.get();
528 } 549 }
529 550
530 void LoginDisplayHostImpl::StartWizard( 551 void LoginDisplayHostImpl::StartWizard(
531 const std::string& first_screen_name, 552 const std::string& first_screen_name,
532 scoped_ptr<base::DictionaryValue> screen_parameters) { 553 scoped_ptr<base::DictionaryValue> screen_parameters) {
554 if (login::LoginScrollIntoViewEnabled())
555 DisableKeyboardOverscroll();
556
533 startup_sound_honors_spoken_feedback_ = true; 557 startup_sound_honors_spoken_feedback_ = true;
534 TryToPlayStartupSound(); 558 TryToPlayStartupSound();
535 559
536 // Keep parameters to restore if renderer crashes. 560 // Keep parameters to restore if renderer crashes.
537 restore_path_ = RESTORE_WIZARD; 561 restore_path_ = RESTORE_WIZARD;
538 wizard_first_screen_name_ = first_screen_name; 562 wizard_first_screen_name_ = first_screen_name;
539 if (screen_parameters.get()) 563 if (screen_parameters.get())
540 wizard_screen_parameters_.reset(screen_parameters->DeepCopy()); 564 wizard_screen_parameters_.reset(screen_parameters->DeepCopy());
541 else 565 else
542 wizard_screen_parameters_.reset(); 566 wizard_screen_parameters_.reset();
(...skipping 24 matching lines...) Expand all
567 WizardController* LoginDisplayHostImpl::GetWizardController() { 591 WizardController* LoginDisplayHostImpl::GetWizardController() {
568 return wizard_controller_.get(); 592 return wizard_controller_.get();
569 } 593 }
570 594
571 AppLaunchController* LoginDisplayHostImpl::GetAppLaunchController() { 595 AppLaunchController* LoginDisplayHostImpl::GetAppLaunchController() {
572 return app_launch_controller_.get(); 596 return app_launch_controller_.get();
573 } 597 }
574 598
575 void LoginDisplayHostImpl::StartUserAdding( 599 void LoginDisplayHostImpl::StartUserAdding(
576 const base::Closure& completion_callback) { 600 const base::Closure& completion_callback) {
601 if (login::LoginScrollIntoViewEnabled())
602 DisableKeyboardOverscroll();
603
577 restore_path_ = RESTORE_ADD_USER_INTO_SESSION; 604 restore_path_ = RESTORE_ADD_USER_INTO_SESSION;
578 completion_callback_ = completion_callback; 605 completion_callback_ = completion_callback;
579 finalize_animation_type_ = ANIMATION_NONE; 606 finalize_animation_type_ = ANIMATION_NONE;
580 LOG(WARNING) << "Login WebUI >> user adding"; 607 LOG(WARNING) << "Login WebUI >> user adding";
581 if (!login_window_) 608 if (!login_window_)
582 LoadURL(GURL(kUserAddingURL)); 609 LoadURL(GURL(kUserAddingURL));
583 // We should emit this signal only at login screen (after reboot or sign out). 610 // We should emit this signal only at login screen (after reboot or sign out).
584 login_view_->set_should_emit_login_prompt_visible(false); 611 login_view_->set_should_emit_login_prompt_visible(false);
585 612
586 // Lock container can be transparent after lock screen animation. 613 // Lock container can be transparent after lock screen animation.
(...skipping 12 matching lines...) Expand all
599 sign_in_controller_->Init( 626 sign_in_controller_->Init(
600 chromeos::UserManager::Get()->GetUsersAdmittedForMultiProfile()); 627 chromeos::UserManager::Get()->GetUsersAdmittedForMultiProfile());
601 CHECK(webui_login_display_); 628 CHECK(webui_login_display_);
602 GetOobeUI()->ShowSigninScreen(LoginScreenContext(), 629 GetOobeUI()->ShowSigninScreen(LoginScreenContext(),
603 webui_login_display_, 630 webui_login_display_,
604 webui_login_display_); 631 webui_login_display_);
605 } 632 }
606 633
607 void LoginDisplayHostImpl::StartSignInScreen( 634 void LoginDisplayHostImpl::StartSignInScreen(
608 const LoginScreenContext& context) { 635 const LoginScreenContext& context) {
636 if (login::LoginScrollIntoViewEnabled())
637 DisableKeyboardOverscroll();
638
609 startup_sound_honors_spoken_feedback_ = true; 639 startup_sound_honors_spoken_feedback_ = true;
610 TryToPlayStartupSound(); 640 TryToPlayStartupSound();
611 641
612 restore_path_ = RESTORE_SIGN_IN; 642 restore_path_ = RESTORE_SIGN_IN;
613 is_showing_login_ = true; 643 is_showing_login_ = true;
614 finalize_animation_type_ = ANIMATION_WORKSPACE; 644 finalize_animation_type_ = ANIMATION_WORKSPACE;
615 645
616 PrewarmAuthentication(); 646 PrewarmAuthentication();
617 647
618 if (waiting_for_wallpaper_load_ && !initialize_webui_hidden_) { 648 if (waiting_for_wallpaper_load_ && !initialize_webui_hidden_) {
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after
869 } 899 }
870 900
871 //////////////////////////////////////////////////////////////////////////////// 901 ////////////////////////////////////////////////////////////////////////////////
872 // LoginDisplayHostImpl, keyboard::KeyboardControllerObserver: 902 // LoginDisplayHostImpl, keyboard::KeyboardControllerObserver:
873 // implementation: 903 // implementation:
874 904
875 void LoginDisplayHostImpl::OnKeyboardBoundsChanging( 905 void LoginDisplayHostImpl::OnKeyboardBoundsChanging(
876 const gfx::Rect& new_bounds) { 906 const gfx::Rect& new_bounds) {
877 if (new_bounds.IsEmpty() && !keyboard_bounds_.IsEmpty()) { 907 if (new_bounds.IsEmpty() && !keyboard_bounds_.IsEmpty()) {
878 // Keyboard has been hidden. 908 // Keyboard has been hidden.
879 if (webui_login_display_) 909 if (webui_login_display_) {
880 webui_login_display_->ShowControlBar(true); 910 webui_login_display_->ShowControlBar(true);
911 if (login::LoginScrollIntoViewEnabled())
912 webui_login_display_->SetKeyboardState(false);
913 }
881 } else if (!new_bounds.IsEmpty() && keyboard_bounds_.IsEmpty()) { 914 } else if (!new_bounds.IsEmpty() && keyboard_bounds_.IsEmpty()) {
882 // Keyboard has been shown. 915 // Keyboard has been shown.
883 if (webui_login_display_) 916 if (webui_login_display_) {
884 webui_login_display_->ShowControlBar(false); 917 webui_login_display_->ShowControlBar(false);
918 if (login::LoginScrollIntoViewEnabled())
919 webui_login_display_->SetKeyboardState(true);
920 }
885 } 921 }
886 922
887 keyboard_bounds_ = new_bounds; 923 keyboard_bounds_ = new_bounds;
888 } 924 }
889 925
890 //////////////////////////////////////////////////////////////////////////////// 926 ////////////////////////////////////////////////////////////////////////////////
927 // LoginDisplayHostImpl, gfx::DisplayObserver implementation:
928
929 void LoginDisplayHostImpl::OnDisplayAdded(const gfx::Display& new_display) {
930 }
931
932 void LoginDisplayHostImpl::OnDisplayRemoved(const gfx::Display& old_display) {
933 }
934
935 void LoginDisplayHostImpl::OnDisplayMetricsChanged(const gfx::Display& display,
936 uint32_t changed_metrics) {
937 if (display.id() != ash::Shell::GetScreen()->GetPrimaryDisplay().id() ||
938 !(changed_metrics & DISPLAY_METRIC_BOUNDS)) {
939 return;
940 }
941
942 if (webui_login_display_) {
943 const gfx::Size& size = ash::Shell::GetScreen()->GetPrimaryDisplay().size();
944 webui_login_display_->SetClientAreaSize(size.width(), size.height());
945 }
946 }
947
948 ////////////////////////////////////////////////////////////////////////////////
891 // LoginDisplayHostImpl, private 949 // LoginDisplayHostImpl, private
892 950
893 void LoginDisplayHostImpl::ShutdownDisplayHost(bool post_quit_task) { 951 void LoginDisplayHostImpl::ShutdownDisplayHost(bool post_quit_task) {
894 if (shutting_down_) 952 if (shutting_down_)
895 return; 953 return;
896 954
897 shutting_down_ = true; 955 shutting_down_ = true;
898 registrar_.RemoveAll(); 956 registrar_.RemoveAll();
899 base::MessageLoop::current()->DeleteSoon(FROM_HERE, this); 957 base::MessageLoop::current()->DeleteSoon(FROM_HERE, this);
900 if (post_quit_task) 958 if (post_quit_task)
(...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after
1242 scoped_ptr<locale_util::SwitchLanguageCallback> callback( 1300 scoped_ptr<locale_util::SwitchLanguageCallback> callback(
1243 new locale_util::SwitchLanguageCallback( 1301 new locale_util::SwitchLanguageCallback(
1244 base::Bind(&OnLanguageSwitchedCallback, base::Passed(data.Pass())))); 1302 base::Bind(&OnLanguageSwitchedCallback, base::Passed(data.Pass()))));
1245 1303
1246 // Load locale keyboards here. Hardware layout would be automatically enabled. 1304 // Load locale keyboards here. Hardware layout would be automatically enabled.
1247 locale_util::SwitchLanguage( 1305 locale_util::SwitchLanguage(
1248 locale, true, true /* login_layouts_only */, callback.Pass()); 1306 locale, true, true /* login_layouts_only */, callback.Pass());
1249 } 1307 }
1250 1308
1251 } // namespace chromeos 1309 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/login/ui/login_display_host_impl.h ('k') | chrome/browser/chromeos/login/ui/mock_login_display.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698