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

Side by Side Diff: ash/shell.cc

Issue 11421194: Hook up the FocusController behind a flag. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years 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/focus_manager_factory.h" 10 #include "ash/accelerators/focus_manager_factory.h"
(...skipping 18 matching lines...) Expand all
29 #include "ash/shell_window_ids.h" 29 #include "ash/shell_window_ids.h"
30 #include "ash/system/status_area_widget.h" 30 #include "ash/system/status_area_widget.h"
31 #include "ash/system/tray/system_tray_delegate.h" 31 #include "ash/system/tray/system_tray_delegate.h"
32 #include "ash/system/tray/system_tray_notifier.h" 32 #include "ash/system/tray/system_tray_notifier.h"
33 #include "ash/tooltips/tooltip_controller.h" 33 #include "ash/tooltips/tooltip_controller.h"
34 #include "ash/touch/touch_observer_hud.h" 34 #include "ash/touch/touch_observer_hud.h"
35 #include "ash/wm/activation_controller.h" 35 #include "ash/wm/activation_controller.h"
36 #include "ash/wm/always_on_top_controller.h" 36 #include "ash/wm/always_on_top_controller.h"
37 #include "ash/wm/app_list_controller.h" 37 #include "ash/wm/app_list_controller.h"
38 #include "ash/wm/ash_activation_controller.h" 38 #include "ash/wm/ash_activation_controller.h"
39 #include "ash/wm/ash_focus_rules.h"
39 #include "ash/wm/base_layout_manager.h" 40 #include "ash/wm/base_layout_manager.h"
40 #include "ash/wm/capture_controller.h" 41 #include "ash/wm/capture_controller.h"
41 #include "ash/wm/coordinate_conversion.h" 42 #include "ash/wm/coordinate_conversion.h"
42 #include "ash/wm/custom_frame_view_ash.h" 43 #include "ash/wm/custom_frame_view_ash.h"
43 #include "ash/wm/dialog_frame_view.h" 44 #include "ash/wm/dialog_frame_view.h"
44 #include "ash/wm/event_client_impl.h" 45 #include "ash/wm/event_client_impl.h"
45 #include "ash/wm/event_rewriter_event_filter.h" 46 #include "ash/wm/event_rewriter_event_filter.h"
46 #include "ash/wm/overlay_event_filter.h" 47 #include "ash/wm/overlay_event_filter.h"
47 #include "ash/wm/power_button_controller.h" 48 #include "ash/wm/power_button_controller.h"
48 #include "ash/wm/property_util.h" 49 #include "ash/wm/property_util.h"
(...skipping 27 matching lines...) Expand all
76 #include "ui/aura/ui_controls_aura.h" 77 #include "ui/aura/ui_controls_aura.h"
77 #include "ui/aura/window.h" 78 #include "ui/aura/window.h"
78 #include "ui/compositor/layer.h" 79 #include "ui/compositor/layer.h"
79 #include "ui/compositor/layer_animator.h" 80 #include "ui/compositor/layer_animator.h"
80 #include "ui/gfx/display.h" 81 #include "ui/gfx/display.h"
81 #include "ui/gfx/image/image_skia.h" 82 #include "ui/gfx/image/image_skia.h"
82 #include "ui/gfx/screen.h" 83 #include "ui/gfx/screen.h"
83 #include "ui/gfx/size.h" 84 #include "ui/gfx/size.h"
84 #include "ui/ui_controls/ui_controls.h" 85 #include "ui/ui_controls/ui_controls.h"
85 #include "ui/views/corewm/compound_event_filter.h" 86 #include "ui/views/corewm/compound_event_filter.h"
87 #include "ui/views/corewm/corewm_switches.h"
88 #include "ui/views/corewm/focus_controller.h"
86 #include "ui/views/corewm/input_method_event_filter.h" 89 #include "ui/views/corewm/input_method_event_filter.h"
87 #include "ui/views/corewm/shadow_controller.h" 90 #include "ui/views/corewm/shadow_controller.h"
88 #include "ui/views/corewm/visibility_controller.h" 91 #include "ui/views/corewm/visibility_controller.h"
89 #include "ui/views/corewm/window_modality_controller.h" 92 #include "ui/views/corewm/window_modality_controller.h"
90 #include "ui/views/focus/focus_manager_factory.h" 93 #include "ui/views/focus/focus_manager_factory.h"
91 #include "ui/views/widget/native_widget_aura.h" 94 #include "ui/views/widget/native_widget_aura.h"
92 #include "ui/views/widget/widget.h" 95 #include "ui/views/widget/widget.h"
93 96
94 #if !defined(OS_MACOSX) 97 #if !defined(OS_MACOSX)
95 #include "ash/accelerators/accelerator_controller.h" 98 #include "ash/accelerators/accelerator_controller.h"
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 // Overridden from views::corewm::VisibilityController: 169 // Overridden from views::corewm::VisibilityController:
167 virtual bool CallAnimateOnChildWindowVisibilityChanged( 170 virtual bool CallAnimateOnChildWindowVisibilityChanged(
168 aura::Window* window, 171 aura::Window* window,
169 bool visible) OVERRIDE { 172 bool visible) OVERRIDE {
170 return AnimateOnChildWindowVisibilityChanged(window, visible); 173 return AnimateOnChildWindowVisibilityChanged(window, visible);
171 } 174 }
172 175
173 DISALLOW_COPY_AND_ASSIGN(AshVisibilityController); 176 DISALLOW_COPY_AND_ASSIGN(AshVisibilityController);
174 }; 177 };
175 178
179 bool UseFocusController() {
180 return CommandLine::ForCurrentProcess()->HasSwitch(
181 views::corewm::switches::kUseFocusController);
182 }
183
176 } // namespace 184 } // namespace
177 185
178 // static 186 // static
179 Shell* Shell::instance_ = NULL; 187 Shell* Shell::instance_ = NULL;
180 // static 188 // static
181 bool Shell::initially_hide_cursor_ = false; 189 bool Shell::initially_hide_cursor_ = false;
182 190
183 //////////////////////////////////////////////////////////////////////////////// 191 ////////////////////////////////////////////////////////////////////////////////
184 // Shell::TestApi 192 // Shell::TestApi
185 193
(...skipping 21 matching lines...) Expand all
207 Shell::TestApi::screen_position_controller() { 215 Shell::TestApi::screen_position_controller() {
208 return shell_->screen_position_controller_.get(); 216 return shell_->screen_position_controller_.get();
209 } 217 }
210 218
211 //////////////////////////////////////////////////////////////////////////////// 219 ////////////////////////////////////////////////////////////////////////////////
212 // Shell, public: 220 // Shell, public:
213 221
214 Shell::Shell(ShellDelegate* delegate) 222 Shell::Shell(ShellDelegate* delegate)
215 : screen_(new ScreenAsh), 223 : screen_(new ScreenAsh),
216 active_root_window_(NULL), 224 active_root_window_(NULL),
217 delegate_(delegate), 225 delegate_(delegate),
sadrul 2012/12/03 06:32:17 Initialize activation_client_ here.
218 #if defined(OS_CHROMEOS) 226 #if defined(OS_CHROMEOS)
219 output_configurator_(new chromeos::OutputConfigurator()), 227 output_configurator_(new chromeos::OutputConfigurator()),
220 output_configurator_animation_( 228 output_configurator_animation_(
221 new internal::OutputConfiguratorAnimation()), 229 new internal::OutputConfiguratorAnimation()),
222 #endif // defined(OS_CHROMEOS) 230 #endif // defined(OS_CHROMEOS)
223 browser_context_(NULL), 231 browser_context_(NULL),
224 simulate_modal_window_open_for_testing_(false) { 232 simulate_modal_window_open_for_testing_(false) {
225 DCHECK(delegate_.get()); 233 DCHECK(delegate_.get());
226 display_manager_.reset(new internal::DisplayManager); 234 display_manager_.reset(new internal::DisplayManager);
227 ANNOTATE_LEAKING_OBJECT_PTR(screen_); // see crbug.com/156466 235 ANNOTATE_LEAKING_OBJECT_PTR(screen_); // see crbug.com/156466
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
421 } 429 }
422 #endif 430 #endif
423 431
424 // Install the custom factory first so that views::FocusManagers for Tray, 432 // Install the custom factory first so that views::FocusManagers for Tray,
425 // Launcher, and WallPaper could be created by the factory. 433 // Launcher, and WallPaper could be created by the factory.
426 views::FocusManagerFactory::Install(new AshFocusManagerFactory); 434 views::FocusManagerFactory::Install(new AshFocusManagerFactory);
427 435
428 env_filter_.reset(new views::corewm::CompoundEventFilter); 436 env_filter_.reset(new views::corewm::CompoundEventFilter);
429 AddPreTargetHandler(env_filter_.get()); 437 AddPreTargetHandler(env_filter_.get());
430 438
431 focus_client_.reset(new aura::FocusManager); 439 if (UseFocusController()) {
432 activation_controller_.reset( 440 views::corewm::FocusController* focus_controller =
433 new internal::ActivationController( 441 new views::corewm::FocusController(new wm::AshFocusRules);
434 focus_client_.get(), 442 focus_client_.reset(focus_controller);
435 new internal::AshActivationController)); 443 activation_client_ = focus_controller;
436 AddPreTargetHandler(activation_controller_.get()); 444 } else {
445 focus_client_.reset(new aura::FocusManager);
446 activation_controller_.reset(
447 new internal::ActivationController(
448 focus_client_.get(),
449 new internal::AshActivationController));
450 activation_client_ = activation_controller_.get();
451 AddPreTargetHandler(activation_controller_.get());
452 }
437 453
438 focus_cycler_.reset(new internal::FocusCycler()); 454 focus_cycler_.reset(new internal::FocusCycler());
439 455
440 screen_position_controller_.reset(new internal::ScreenPositionController); 456 screen_position_controller_.reset(new internal::ScreenPositionController);
441 display_controller_.reset(new DisplayController); 457 display_controller_.reset(new DisplayController);
442 display_controller_->InitPrimaryDisplay(); 458 display_controller_->InitPrimaryDisplay();
443 aura::RootWindow* root_window = display_controller_->GetPrimaryRootWindow(); 459 aura::RootWindow* root_window = display_controller_->GetPrimaryRootWindow();
444 active_root_window_ = root_window; 460 active_root_window_ = root_window;
445 461
446 cursor_manager_.SetDeviceScaleFactor( 462 cursor_manager_.SetDeviceScaleFactor(
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
513 AddPreTargetHandler(window_modality_controller_.get()); 529 AddPreTargetHandler(window_modality_controller_.get());
514 530
515 magnification_controller_.reset( 531 magnification_controller_.reset(
516 MagnificationController::CreateInstance()); 532 MagnificationController::CreateInstance());
517 533
518 partial_magnification_controller_.reset( 534 partial_magnification_controller_.reset(
519 new PartialMagnificationController()); 535 new PartialMagnificationController());
520 536
521 high_contrast_controller_.reset(new HighContrastController); 537 high_contrast_controller_.reset(new HighContrastController);
522 video_detector_.reset(new VideoDetector); 538 video_detector_.reset(new VideoDetector);
523 window_cycle_controller_.reset( 539 window_cycle_controller_.reset(new WindowCycleController(activation_client_));
524 new WindowCycleController(activation_controller_.get()));
525 540
526 tooltip_controller_.reset(new internal::TooltipController( 541 tooltip_controller_.reset(new internal::TooltipController(
527 drag_drop_controller_.get())); 542 drag_drop_controller_.get()));
528 AddPreTargetHandler(tooltip_controller_.get()); 543 AddPreTargetHandler(tooltip_controller_.get());
529 544
530 event_client_.reset(new internal::EventClientImpl); 545 event_client_.reset(new internal::EventClientImpl);
531 546
532 InitRootWindowController(root_window_controller); 547 InitRootWindowController(root_window_controller);
533 548
534 // This controller needs to be set before SetupManagedWindowMode. 549 // This controller needs to be set before SetupManagedWindowMode.
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after
815 DoInitialAnimation(); 830 DoInitialAnimation();
816 } 831 }
817 832
818 aura::client::StackingClient* Shell::stacking_client() { 833 aura::client::StackingClient* Shell::stacking_client() {
819 return stacking_client_.get(); 834 return stacking_client_.get();
820 } 835 }
821 836
822 void Shell::InitRootWindowController( 837 void Shell::InitRootWindowController(
823 internal::RootWindowController* controller) { 838 internal::RootWindowController* controller) {
824 aura::RootWindow* root_window = controller->root_window(); 839 aura::RootWindow* root_window = controller->root_window();
825 DCHECK(activation_controller_.get()); 840 DCHECK(activation_client_);
826 DCHECK(visibility_controller_.get()); 841 DCHECK(visibility_controller_.get());
827 DCHECK(drag_drop_controller_.get()); 842 DCHECK(drag_drop_controller_.get());
828 DCHECK(capture_controller_.get()); 843 DCHECK(capture_controller_.get());
829 DCHECK(window_cycle_controller_.get()); 844 DCHECK(window_cycle_controller_.get());
830 845
831 aura::client::SetFocusClient(root_window, focus_client_.get()); 846 aura::client::SetFocusClient(root_window, focus_client_.get());
832 input_method_filter_->SetInputMethodPropertyInRootWindow(root_window); 847 input_method_filter_->SetInputMethodPropertyInRootWindow(root_window);
833 aura::client::SetActivationClient(root_window, activation_controller_.get()); 848 aura::client::SetActivationClient(root_window, activation_client_);
849 if (UseFocusController()) {
850 views::corewm::FocusController* controller =
851 static_cast<views::corewm::FocusController*>(activation_client_);
852 root_window->AddPreTargetHandler(controller);
853 }
834 aura::client::SetVisibilityClient(root_window, visibility_controller_.get()); 854 aura::client::SetVisibilityClient(root_window, visibility_controller_.get());
835 aura::client::SetDragDropClient(root_window, drag_drop_controller_.get()); 855 aura::client::SetDragDropClient(root_window, drag_drop_controller_.get());
836 aura::client::SetCaptureClient(root_window, capture_controller_.get()); 856 aura::client::SetCaptureClient(root_window, capture_controller_.get());
837 aura::client::SetScreenPositionClient(root_window, 857 aura::client::SetScreenPositionClient(root_window,
838 screen_position_controller_.get()); 858 screen_position_controller_.get());
839 aura::client::SetCursorClient(root_window, &cursor_manager_); 859 aura::client::SetCursorClient(root_window, &cursor_manager_);
840 aura::client::SetTooltipClient(root_window, tooltip_controller_.get()); 860 aura::client::SetTooltipClient(root_window, tooltip_controller_.get());
841 aura::client::SetEventClient(root_window, event_client_.get()); 861 aura::client::SetEventClient(root_window, event_client_.get());
842 862
843 if (nested_dispatcher_controller_.get()) { 863 if (nested_dispatcher_controller_.get()) {
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
883 903
884 bool Shell::CanAcceptEvents() { 904 bool Shell::CanAcceptEvents() {
885 return true; 905 return true;
886 } 906 }
887 907
888 ui::EventTarget* Shell::GetParentTarget() { 908 ui::EventTarget* Shell::GetParentTarget() {
889 return NULL; 909 return NULL;
890 } 910 }
891 911
892 } // namespace ash 912 } // namespace ash
OLDNEW
« no previous file with comments | « ash/shell.h ('k') | ash/wm/app_list_controller.h » ('j') | ui/views/corewm/focus_change_shim.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698