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

Side by Side Diff: ash/shell.cc

Issue 47873003: Add a full screen virtual keyboard to virtual keyboard root window (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 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 | Annotate | Revision Log
« no previous file with comments | « ash/shell.h ('k') | ash/shell/keyboard_controller_proxy_stub.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "ash/shell.h" 5 #include "ash/shell.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <string> 8 #include <string>
9 9
10 #include "ash/accelerators/accelerator_controller.h" 10 #include "ash/accelerators/accelerator_controller.h"
11 #include "ash/accelerators/accelerator_filter.h" 11 #include "ash/accelerators/accelerator_filter.h"
12 #include "ash/accelerators/focus_manager_factory.h" 12 #include "ash/accelerators/focus_manager_factory.h"
13 #include "ash/accelerators/nested_dispatcher_controller.h" 13 #include "ash/accelerators/nested_dispatcher_controller.h"
14 #include "ash/ash_switches.h" 14 #include "ash/ash_switches.h"
15 #include "ash/autoclick/autoclick_controller.h" 15 #include "ash/autoclick/autoclick_controller.h"
16 #include "ash/caps_lock_delegate.h" 16 #include "ash/caps_lock_delegate.h"
17 #include "ash/desktop_background/desktop_background_controller.h" 17 #include "ash/desktop_background/desktop_background_controller.h"
18 #include "ash/desktop_background/desktop_background_view.h" 18 #include "ash/desktop_background/desktop_background_view.h"
19 #include "ash/desktop_background/user_wallpaper_delegate.h" 19 #include "ash/desktop_background/user_wallpaper_delegate.h"
20 #include "ash/display/display_controller.h" 20 #include "ash/display/display_controller.h"
21 #include "ash/display/display_manager.h" 21 #include "ash/display/display_manager.h"
22 #include "ash/display/event_transformation_handler.h" 22 #include "ash/display/event_transformation_handler.h"
23 #include "ash/display/mouse_cursor_event_filter.h" 23 #include "ash/display/mouse_cursor_event_filter.h"
24 #include "ash/display/resolution_notification_controller.h" 24 #include "ash/display/resolution_notification_controller.h"
25 #include "ash/display/screen_position_controller.h" 25 #include "ash/display/screen_position_controller.h"
26 #include "ash/display/virtual_keyboard_window_controller.h"
26 #include "ash/drag_drop/drag_drop_controller.h" 27 #include "ash/drag_drop/drag_drop_controller.h"
27 #include "ash/first_run/first_run_helper_impl.h" 28 #include "ash/first_run/first_run_helper_impl.h"
28 #include "ash/focus_cycler.h" 29 #include "ash/focus_cycler.h"
29 #include "ash/high_contrast/high_contrast_controller.h" 30 #include "ash/high_contrast/high_contrast_controller.h"
30 #include "ash/host/root_window_host_factory.h" 31 #include "ash/host/root_window_host_factory.h"
31 #include "ash/keyboard_uma_event_filter.h" 32 #include "ash/keyboard_uma_event_filter.h"
32 #include "ash/launcher/launcher_delegate.h" 33 #include "ash/launcher/launcher_delegate.h"
33 #include "ash/launcher/launcher_item_delegate.h" 34 #include "ash/launcher/launcher_item_delegate.h"
34 #include "ash/launcher/launcher_item_delegate_manager.h" 35 #include "ash/launcher/launcher_item_delegate_manager.h"
35 #include "ash/magnifier/magnification_controller.h" 36 #include "ash/magnifier/magnification_controller.h"
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after
330 const gfx::Insets& insets) { 331 const gfx::Insets& insets) {
331 if (!display_controller_->UpdateWorkAreaOfDisplayNearestWindow( 332 if (!display_controller_->UpdateWorkAreaOfDisplayNearestWindow(
332 contains, insets)) { 333 contains, insets)) {
333 return; 334 return;
334 } 335 }
335 FOR_EACH_OBSERVER(ShellObserver, observers_, 336 FOR_EACH_OBSERVER(ShellObserver, observers_,
336 OnDisplayWorkAreaInsetsChanged()); 337 OnDisplayWorkAreaInsetsChanged());
337 } 338 }
338 339
339 void Shell::OnLoginStateChanged(user::LoginStatus status) { 340 void Shell::OnLoginStateChanged(user::LoginStatus status) {
340 if (status != user::LOGGED_IN_NONE) {
341 // TODO(bshe): Primary root window controller may not be the controller to
342 // attach virtual keyboard. See http://crbug.com/303429
343 InitKeyboard(GetPrimaryRootWindowController());
344 GetPrimaryRootWindowController()->ActivateKeyboard(
345 keyboard_controller_.get());
346 }
347 FOR_EACH_OBSERVER(ShellObserver, observers_, OnLoginStateChanged(status)); 341 FOR_EACH_OBSERVER(ShellObserver, observers_, OnLoginStateChanged(status));
348 } 342 }
349 343
344 void Shell::OnLoginUserProfilePrepared() {
345 CreateLauncher();
346 CreateKeyboard();
347 }
348
350 void Shell::UpdateAfterLoginStatusChange(user::LoginStatus status) { 349 void Shell::UpdateAfterLoginStatusChange(user::LoginStatus status) {
351 RootWindowControllerList controllers = GetAllRootWindowControllers(); 350 RootWindowControllerList controllers = GetAllRootWindowControllers();
352 for (RootWindowControllerList::iterator iter = controllers.begin(); 351 for (RootWindowControllerList::iterator iter = controllers.begin();
353 iter != controllers.end(); ++iter) 352 iter != controllers.end(); ++iter)
354 (*iter)->UpdateAfterLoginStatusChange(status); 353 (*iter)->UpdateAfterLoginStatusChange(status);
355 } 354 }
356 355
357 void Shell::OnAppTerminating() { 356 void Shell::OnAppTerminating() {
358 FOR_EACH_OBSERVER(ShellObserver, observers_, OnAppTerminating()); 357 FOR_EACH_OBSERVER(ShellObserver, observers_, OnAppTerminating());
359 } 358 }
(...skipping 14 matching lines...) Expand all
374 #endif 373 #endif
375 } 374 }
376 375
377 void Shell::CreateLauncher() { 376 void Shell::CreateLauncher() {
378 RootWindowControllerList controllers = GetAllRootWindowControllers(); 377 RootWindowControllerList controllers = GetAllRootWindowControllers();
379 for (RootWindowControllerList::iterator iter = controllers.begin(); 378 for (RootWindowControllerList::iterator iter = controllers.begin();
380 iter != controllers.end(); ++iter) 379 iter != controllers.end(); ++iter)
381 (*iter)->shelf()->CreateLauncher(); 380 (*iter)->shelf()->CreateLauncher();
382 } 381 }
383 382
383 void Shell::CreateKeyboard() {
384 // TODO(bshe): Primary root window controller may not be the controller to
385 // attach virtual keyboard. See http://crbug.com/303429
386 InitKeyboard();
387 if (keyboard::IsKeyboardUsabilityExperimentEnabled()) {
388 display_controller()->virtual_keyboard_window_controller()->
389 ActivateKeyboard(keyboard_controller_.get());
390 } else {
391 GetPrimaryRootWindowController()->
392 ActivateKeyboard(keyboard_controller_.get());
393 }
394 }
395
384 void Shell::ShowLauncher() { 396 void Shell::ShowLauncher() {
385 RootWindowControllerList controllers = GetAllRootWindowControllers(); 397 RootWindowControllerList controllers = GetAllRootWindowControllers();
386 for (RootWindowControllerList::iterator iter = controllers.begin(); 398 for (RootWindowControllerList::iterator iter = controllers.begin();
387 iter != controllers.end(); ++iter) 399 iter != controllers.end(); ++iter)
388 (*iter)->ShowLauncher(); 400 (*iter)->ShowLauncher();
389 } 401 }
390 402
391 void Shell::AddShellObserver(ShellObserver* observer) { 403 void Shell::AddShellObserver(ShellObserver* observer) {
392 observers_.AddObserver(observer); 404 observers_.AddObserver(observer);
393 } 405 }
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
612 system_tray_delegate_->Shutdown(); 624 system_tray_delegate_->Shutdown();
613 system_tray_delegate_.reset(); 625 system_tray_delegate_.reset();
614 626
615 locale_notification_controller_.reset(); 627 locale_notification_controller_.reset();
616 628
617 // Drag-and-drop must be canceled prior to close all windows. 629 // Drag-and-drop must be canceled prior to close all windows.
618 drag_drop_controller_.reset(); 630 drag_drop_controller_.reset();
619 631
620 // Destroy all child windows including widgets. 632 // Destroy all child windows including widgets.
621 display_controller_->CloseChildWindows(); 633 display_controller_->CloseChildWindows();
634 display_controller_->CloseNonDesktopDisplay();
622 635
623 // Destroy SystemTrayNotifier after destroying SystemTray as TrayItems 636 // Destroy SystemTrayNotifier after destroying SystemTray as TrayItems
624 // needs to remove observers from it. 637 // needs to remove observers from it.
625 system_tray_notifier_.reset(); 638 system_tray_notifier_.reset();
626 639
627 #if defined(OS_CHROMEOS) 640 #if defined(OS_CHROMEOS)
628 // Destroy VideoActivityNotifier before destroying VideoDetector. 641 // Destroy VideoActivityNotifier before destroying VideoDetector.
629 video_activity_notifier_.reset(); 642 video_activity_notifier_.reset();
630 #endif // defined(OS_CHROMEOS) 643 #endif // defined(OS_CHROMEOS)
631 644
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
686 #endif 699 #endif
687 700
688 DCHECK(instance_ == this); 701 DCHECK(instance_ == this);
689 instance_ = NULL; 702 instance_ = NULL;
690 } 703 }
691 704
692 void Shell::Init() { 705 void Shell::Init() {
693 CommandLine* command_line = CommandLine::ForCurrentProcess(); 706 CommandLine* command_line = CommandLine::ForCurrentProcess();
694 707
695 delegate_->PreInit(); 708 delegate_->PreInit();
696 if (command_line->HasSwitch(keyboard::switches::kKeyboardUsabilityTest)) { 709 if (keyboard::IsKeyboardUsabilityExperimentEnabled()) {
697 display_manager_->SetSecondDisplayMode( 710 display_manager_->SetSecondDisplayMode(
698 internal::DisplayManager::VIRTUAL_KEYBOARD); 711 internal::DisplayManager::VIRTUAL_KEYBOARD);
699 } 712 }
700 bool display_initialized = display_manager_->InitFromCommandLine(); 713 bool display_initialized = display_manager_->InitFromCommandLine();
701 #if defined(OS_CHROMEOS) && defined(USE_X11) 714 #if defined(OS_CHROMEOS) && defined(USE_X11)
702 output_configurator_animation_.reset( 715 output_configurator_animation_.reset(
703 new internal::OutputConfiguratorAnimation()); 716 new internal::OutputConfiguratorAnimation());
704 output_configurator_->AddObserver(output_configurator_animation_.get()); 717 output_configurator_->AddObserver(output_configurator_animation_.get());
705 718
706 if (!display_initialized && base::SysInfo::IsRunningOnChromeOS()) { 719 if (!display_initialized && base::SysInfo::IsRunningOnChromeOS()) {
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
909 display_manager_.get())); 922 display_manager_.get()));
910 // The compositor thread and main message loop have to be running in 923 // The compositor thread and main message loop have to be running in
911 // order to create mirror window. Run it after the main message loop 924 // order to create mirror window. Run it after the main message loop
912 // is started. 925 // is started.
913 base::MessageLoopForUI::current()->PostTask( 926 base::MessageLoopForUI::current()->PostTask(
914 FROM_HERE, 927 FROM_HERE,
915 base::Bind(&internal::DisplayManager::CreateMirrorWindowIfAny, 928 base::Bind(&internal::DisplayManager::CreateMirrorWindowIfAny,
916 weak_display_manager_factory_->GetWeakPtr())); 929 weak_display_manager_factory_->GetWeakPtr()));
917 } 930 }
918 931
919 void Shell::InitKeyboard(internal::RootWindowController* root) { 932 void Shell::InitKeyboard() {
920 if (keyboard::IsKeyboardEnabled()) { 933 if (keyboard::IsKeyboardEnabled()) {
921 if (keyboard_controller_.get()) { 934 if (keyboard_controller_.get()) {
922 RootWindowControllerList controllers = GetAllRootWindowControllers(); 935 RootWindowControllerList controllers = GetAllRootWindowControllers();
923 for (RootWindowControllerList::iterator iter = controllers.begin(); 936 for (RootWindowControllerList::iterator iter = controllers.begin();
924 iter != controllers.end(); ++iter) { 937 iter != controllers.end(); ++iter) {
925 (*iter)->DeactivateKeyboard(keyboard_controller_.get()); 938 (*iter)->DeactivateKeyboard(keyboard_controller_.get());
926 } 939 }
927 } 940 }
928 keyboard::KeyboardControllerProxy* proxy = 941 keyboard::KeyboardControllerProxy* proxy =
929 delegate_->CreateKeyboardControllerProxy(); 942 delegate_->CreateKeyboardControllerProxy();
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
989 //////////////////////////////////////////////////////////////////////////////// 1002 ////////////////////////////////////////////////////////////////////////////////
990 // Shell, aura::client::ActivationChangeObserver implementation: 1003 // Shell, aura::client::ActivationChangeObserver implementation:
991 1004
992 void Shell::OnWindowActivated(aura::Window* gained_active, 1005 void Shell::OnWindowActivated(aura::Window* gained_active,
993 aura::Window* lost_active) { 1006 aura::Window* lost_active) {
994 if (gained_active) 1007 if (gained_active)
995 target_root_window_ = gained_active->GetRootWindow(); 1008 target_root_window_ = gained_active->GetRootWindow();
996 } 1009 }
997 1010
998 } // namespace ash 1011 } // namespace ash
OLDNEW
« no previous file with comments | « ash/shell.h ('k') | ash/shell/keyboard_controller_proxy_stub.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698