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

Side by Side Diff: ash/shell.cc

Issue 11299219: Rework FocusManager as FocusClient. (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
« no previous file with comments | « ash/shell.h ('k') | ash/wm/activation_controller.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/focus_manager_factory.h" 10 #include "ash/accelerators/focus_manager_factory.h"
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 #endif // defined(OS_CHROMEOS) 225 #endif // defined(OS_CHROMEOS)
226 } 226 }
227 227
228 Shell::~Shell() { 228 Shell::~Shell() {
229 views::FocusManagerFactory::Install(NULL); 229 views::FocusManagerFactory::Install(NULL);
230 230
231 // Remove the focus from any window. This will prevent overhead and side 231 // Remove the focus from any window. This will prevent overhead and side
232 // effects (e.g. crashes) from changing focus during shutdown. 232 // effects (e.g. crashes) from changing focus during shutdown.
233 // See bug crbug.com/134502. 233 // See bug crbug.com/134502.
234 if (active_root_window_) 234 if (active_root_window_)
235 active_root_window_->GetFocusManager()->SetFocusedWindow(NULL, NULL); 235 aura::client::GetFocusClient(active_root_window_)->FocusWindow(NULL, NULL);
236 236
237 // Please keep in same order as in Init() because it's easy to miss one. 237 // Please keep in same order as in Init() because it's easy to miss one.
238 RemovePreTargetHandler(user_activity_detector_.get()); 238 RemovePreTargetHandler(user_activity_detector_.get());
239 RemovePreTargetHandler(event_rewriter_filter_.get()); 239 RemovePreTargetHandler(event_rewriter_filter_.get());
240 RemovePreTargetHandler(overlay_filter_.get()); 240 RemovePreTargetHandler(overlay_filter_.get());
241 RemovePreTargetHandler(input_method_filter_.get()); 241 RemovePreTargetHandler(input_method_filter_.get());
242 RemovePreTargetHandler(window_modality_controller_.get()); 242 RemovePreTargetHandler(window_modality_controller_.get());
243 if (mouse_cursor_filter_.get()) 243 if (mouse_cursor_filter_.get())
244 RemovePreTargetHandler(mouse_cursor_filter_.get()); 244 RemovePreTargetHandler(mouse_cursor_filter_.get());
245 RemovePreTargetHandler(system_gesture_filter_.get()); 245 RemovePreTargetHandler(system_gesture_filter_.get());
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
402 } 402 }
403 #endif 403 #endif
404 404
405 // Install the custom factory first so that views::FocusManagers for Tray, 405 // Install the custom factory first so that views::FocusManagers for Tray,
406 // Launcher, and WallPaper could be created by the factory. 406 // Launcher, and WallPaper could be created by the factory.
407 views::FocusManagerFactory::Install(new AshFocusManagerFactory); 407 views::FocusManagerFactory::Install(new AshFocusManagerFactory);
408 408
409 env_filter_.reset(new views::corewm::CompoundEventFilter); 409 env_filter_.reset(new views::corewm::CompoundEventFilter);
410 AddPreTargetHandler(env_filter_.get()); 410 AddPreTargetHandler(env_filter_.get());
411 411
412 focus_manager_.reset(new aura::FocusManager); 412 focus_client_.reset(new aura::FocusManager);
413 activation_controller_.reset( 413 activation_controller_.reset(
414 new internal::ActivationController( 414 new internal::ActivationController(
415 focus_manager_.get(), 415 focus_client_.get(),
416 new internal::AshActivationController)); 416 new internal::AshActivationController));
417 AddPreTargetHandler(activation_controller_.get()); 417 AddPreTargetHandler(activation_controller_.get());
418 418
419 focus_cycler_.reset(new internal::FocusCycler()); 419 focus_cycler_.reset(new internal::FocusCycler());
420 420
421 screen_position_controller_.reset(new internal::ScreenPositionController); 421 screen_position_controller_.reset(new internal::ScreenPositionController);
422 display_controller_.reset(new DisplayController); 422 display_controller_.reset(new DisplayController);
423 display_controller_->InitPrimaryDisplay(); 423 display_controller_->InitPrimaryDisplay();
424 aura::RootWindow* root_window = display_controller_->GetPrimaryRootWindow(); 424 aura::RootWindow* root_window = display_controller_->GetPrimaryRootWindow();
425 active_root_window_ = root_window; 425 active_root_window_ = root_window;
(...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after
764 764
765 SystemTray* Shell::system_tray() { 765 SystemTray* Shell::system_tray() {
766 // We assume in throughout the code that this will not return NULL. If code 766 // We assume in throughout the code that this will not return NULL. If code
767 // triggers this for valid reasons, it should test status_area_widget first. 767 // triggers this for valid reasons, it should test status_area_widget first.
768 internal::StatusAreaWidget* status_area = status_area_widget(); 768 internal::StatusAreaWidget* status_area = status_area_widget();
769 CHECK(status_area); 769 CHECK(status_area);
770 return status_area->system_tray(); 770 return status_area->system_tray();
771 } 771 }
772 772
773 void Shell::InitRootWindowForSecondaryDisplay(aura::RootWindow* root) { 773 void Shell::InitRootWindowForSecondaryDisplay(aura::RootWindow* root) {
774 root->set_focus_manager(focus_manager_.get()); 774 aura::client::SetFocusClient(root, focus_client_.get());
775 internal::RootWindowController* controller = 775 internal::RootWindowController* controller =
776 new internal::RootWindowController(root); 776 new internal::RootWindowController(root);
777 controller->CreateContainers(); 777 controller->CreateContainers();
778 // Pass false for the |is_first_run_after_boot| parameter so we'll show a 778 // Pass false for the |is_first_run_after_boot| parameter so we'll show a
779 // black background on this display instead of trying to mimic the boot splash 779 // black background on this display instead of trying to mimic the boot splash
780 // screen. 780 // screen.
781 controller->CreateSystemBackground(false); 781 controller->CreateSystemBackground(false);
782 InitRootWindowController(controller); 782 InitRootWindowController(controller);
783 if (IsLauncherPerDisplayEnabled()) 783 if (IsLauncherPerDisplayEnabled())
784 controller->InitForPrimaryDisplay(); 784 controller->InitForPrimaryDisplay();
(...skipping 16 matching lines...) Expand all
801 801
802 void Shell::InitRootWindowController( 802 void Shell::InitRootWindowController(
803 internal::RootWindowController* controller) { 803 internal::RootWindowController* controller) {
804 aura::RootWindow* root_window = controller->root_window(); 804 aura::RootWindow* root_window = controller->root_window();
805 DCHECK(activation_controller_.get()); 805 DCHECK(activation_controller_.get());
806 DCHECK(visibility_controller_.get()); 806 DCHECK(visibility_controller_.get());
807 DCHECK(drag_drop_controller_.get()); 807 DCHECK(drag_drop_controller_.get());
808 DCHECK(capture_controller_.get()); 808 DCHECK(capture_controller_.get());
809 DCHECK(window_cycle_controller_.get()); 809 DCHECK(window_cycle_controller_.get());
810 810
811 root_window->set_focus_manager(focus_manager_.get()); 811 aura::client::SetFocusClient(root_window, focus_client_.get());
812 input_method_filter_->SetInputMethodPropertyInRootWindow(root_window); 812 input_method_filter_->SetInputMethodPropertyInRootWindow(root_window);
813 aura::client::SetActivationClient(root_window, activation_controller_.get()); 813 aura::client::SetActivationClient(root_window, activation_controller_.get());
814 aura::client::SetVisibilityClient(root_window, visibility_controller_.get()); 814 aura::client::SetVisibilityClient(root_window, visibility_controller_.get());
815 aura::client::SetDragDropClient(root_window, drag_drop_controller_.get()); 815 aura::client::SetDragDropClient(root_window, drag_drop_controller_.get());
816 aura::client::SetCaptureClient(root_window, capture_controller_.get()); 816 aura::client::SetCaptureClient(root_window, capture_controller_.get());
817 aura::client::SetScreenPositionClient(root_window, 817 aura::client::SetScreenPositionClient(root_window,
818 screen_position_controller_.get()); 818 screen_position_controller_.get());
819 aura::client::SetCursorClient(root_window, &cursor_manager_); 819 aura::client::SetCursorClient(root_window, &cursor_manager_);
820 aura::client::SetTooltipClient(root_window, tooltip_controller_.get()); 820 aura::client::SetTooltipClient(root_window, tooltip_controller_.get());
821 aura::client::SetEventClient(root_window, event_client_.get()); 821 aura::client::SetEventClient(root_window, event_client_.get());
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
863 863
864 bool Shell::CanAcceptEvents() { 864 bool Shell::CanAcceptEvents() {
865 return true; 865 return true;
866 } 866 }
867 867
868 ui::EventTarget* Shell::GetParentTarget() { 868 ui::EventTarget* Shell::GetParentTarget() {
869 return NULL; 869 return NULL;
870 } 870 }
871 871
872 } // namespace ash 872 } // namespace ash
OLDNEW
« no previous file with comments | « ash/shell.h ('k') | ash/wm/activation_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698