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

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: 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
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/launcher/launcher_model.h" 36 #include "ash/launcher/launcher_model.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::IsKeyboardUsabilityTestEnabled()) {
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 293 matching lines...) Expand 10 before | Expand all | Expand 10 after
687 #endif 699 #endif
688 700
689 DCHECK(instance_ == this); 701 DCHECK(instance_ == this);
690 instance_ = NULL; 702 instance_ = NULL;
691 } 703 }
692 704
693 void Shell::Init() { 705 void Shell::Init() {
694 CommandLine* command_line = CommandLine::ForCurrentProcess(); 706 CommandLine* command_line = CommandLine::ForCurrentProcess();
695 707
696 delegate_->PreInit(); 708 delegate_->PreInit();
697 if (command_line->HasSwitch(keyboard::switches::kKeyboardUsabilityTest)) { 709 if (keyboard::IsKeyboardUsabilityTestEnabled()) {
698 display_manager_->SetSecondDisplayMode( 710 display_manager_->SetSecondDisplayMode(
699 internal::DisplayManager::VIRTUAL_KEYBOARD); 711 internal::DisplayManager::VIRTUAL_KEYBOARD);
700 } 712 }
701 bool display_initialized = display_manager_->InitFromCommandLine(); 713 bool display_initialized = display_manager_->InitFromCommandLine();
702 #if defined(OS_CHROMEOS) && defined(USE_X11) 714 #if defined(OS_CHROMEOS) && defined(USE_X11)
703 output_configurator_animation_.reset( 715 output_configurator_animation_.reset(
704 new internal::OutputConfiguratorAnimation()); 716 new internal::OutputConfiguratorAnimation());
705 output_configurator_->AddObserver(output_configurator_animation_.get()); 717 output_configurator_->AddObserver(output_configurator_animation_.get());
706 718
707 if (!display_initialized && base::SysInfo::IsRunningOnChromeOS()) { 719 if (!display_initialized && base::SysInfo::IsRunningOnChromeOS()) {
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
916 display_manager_.get())); 928 display_manager_.get()));
917 // The compositor thread and main message loop have to be running in 929 // The compositor thread and main message loop have to be running in
918 // order to create mirror window. Run it after the main message loop 930 // order to create mirror window. Run it after the main message loop
919 // is started. 931 // is started.
920 base::MessageLoopForUI::current()->PostTask( 932 base::MessageLoopForUI::current()->PostTask(
921 FROM_HERE, 933 FROM_HERE,
922 base::Bind(&internal::DisplayManager::CreateMirrorWindowIfAny, 934 base::Bind(&internal::DisplayManager::CreateMirrorWindowIfAny,
923 weak_display_manager_factory_->GetWeakPtr())); 935 weak_display_manager_factory_->GetWeakPtr()));
924 } 936 }
925 937
926 void Shell::InitKeyboard(internal::RootWindowController* root) { 938 void Shell::InitKeyboard() {
927 if (keyboard::IsKeyboardEnabled()) { 939 if (keyboard::IsKeyboardEnabled()) {
928 if (keyboard_controller_.get()) { 940 if (keyboard_controller_.get()) {
929 RootWindowControllerList controllers = GetAllRootWindowControllers(); 941 RootWindowControllerList controllers = GetAllRootWindowControllers();
930 for (RootWindowControllerList::iterator iter = controllers.begin(); 942 for (RootWindowControllerList::iterator iter = controllers.begin();
931 iter != controllers.end(); ++iter) { 943 iter != controllers.end(); ++iter) {
932 (*iter)->DeactivateKeyboard(keyboard_controller_.get()); 944 (*iter)->DeactivateKeyboard(keyboard_controller_.get());
933 } 945 }
934 } 946 }
935 keyboard::KeyboardControllerProxy* proxy = 947 keyboard::KeyboardControllerProxy* proxy =
936 delegate_->CreateKeyboardControllerProxy(); 948 delegate_->CreateKeyboardControllerProxy();
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
996 //////////////////////////////////////////////////////////////////////////////// 1008 ////////////////////////////////////////////////////////////////////////////////
997 // Shell, aura::client::ActivationChangeObserver implementation: 1009 // Shell, aura::client::ActivationChangeObserver implementation:
998 1010
999 void Shell::OnWindowActivated(aura::Window* gained_active, 1011 void Shell::OnWindowActivated(aura::Window* gained_active,
1000 aura::Window* lost_active) { 1012 aura::Window* lost_active) {
1001 if (gained_active) 1013 if (gained_active)
1002 target_root_window_ = gained_active->GetRootWindow(); 1014 target_root_window_ = gained_active->GetRootWindow();
1003 } 1015 }
1004 1016
1005 } // namespace ash 1017 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698