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

Side by Side Diff: ash/display/display_controller.cc

Issue 145313003: Implement cursor compositing mode on Ash (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Get rid changes in ui/views/. Let Shell call AshNativeCursorManager directly. Created 6 years, 10 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
« no previous file with comments | « ash/display/display_controller.h ('k') | ash/display/mirror_window_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/display/display_controller.h" 5 #include "ash/display/display_controller.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cmath> 8 #include <cmath>
9 #include <map> 9 #include <map>
10 10
11 #include "ash/ash_switches.h" 11 #include "ash/ash_switches.h"
12 #include "ash/display/cursor_window_controller.h"
12 #include "ash/display/display_layout_store.h" 13 #include "ash/display/display_layout_store.h"
13 #include "ash/display/display_manager.h" 14 #include "ash/display/display_manager.h"
14 #include "ash/display/mirror_window_controller.h" 15 #include "ash/display/mirror_window_controller.h"
15 #include "ash/display/root_window_transformers.h" 16 #include "ash/display/root_window_transformers.h"
16 #include "ash/display/virtual_keyboard_window_controller.h" 17 #include "ash/display/virtual_keyboard_window_controller.h"
17 #include "ash/host/root_window_host_factory.h" 18 #include "ash/host/root_window_host_factory.h"
18 #include "ash/root_window_controller.h" 19 #include "ash/root_window_controller.h"
19 #include "ash/root_window_settings.h" 20 #include "ash/root_window_settings.h"
20 #include "ash/screen_util.h" 21 #include "ash/screen_util.h"
21 #include "ash/shell.h" 22 #include "ash/shell.h"
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 bool DisplayController::DisplayChangeLimiter::IsThrottled() const { 210 bool DisplayController::DisplayChangeLimiter::IsThrottled() const {
210 return base::Time::Now() < throttle_timeout_; 211 return base::Time::Now() < throttle_timeout_;
211 } 212 }
212 213
213 //////////////////////////////////////////////////////////////////////////////// 214 ////////////////////////////////////////////////////////////////////////////////
214 // DisplayController 215 // DisplayController
215 216
216 DisplayController::DisplayController() 217 DisplayController::DisplayController()
217 : primary_root_window_for_replace_(NULL), 218 : primary_root_window_for_replace_(NULL),
218 focus_activation_store_(new internal::FocusActivationStore()), 219 focus_activation_store_(new internal::FocusActivationStore()),
219 mirror_window_controller_(new internal::MirrorWindowController), 220 cursor_window_controller_(new internal::CursorWindowController()),
221 mirror_window_controller_(new internal::MirrorWindowController()),
220 virtual_keyboard_window_controller_( 222 virtual_keyboard_window_controller_(
221 new internal::VirtualKeyboardWindowController) { 223 new internal::VirtualKeyboardWindowController) {
222 #if defined(OS_CHROMEOS) 224 #if defined(OS_CHROMEOS)
223 CommandLine* command_line = CommandLine::ForCurrentProcess(); 225 CommandLine* command_line = CommandLine::ForCurrentProcess();
224 if (!command_line->HasSwitch(switches::kAshDisableDisplayChangeLimiter) && 226 if (!command_line->HasSwitch(switches::kAshDisableDisplayChangeLimiter) &&
225 base::SysInfo::IsRunningOnChromeOS()) 227 base::SysInfo::IsRunningOnChromeOS())
226 limiter_.reset(new DisplayChangeLimiter); 228 limiter_.reset(new DisplayChangeLimiter);
227 #endif 229 #endif
228 // Reset primary display to make sure that tests don't use 230 // Reset primary display to make sure that tests don't use
229 // stale display info from previous tests. 231 // stale display info from previous tests.
(...skipping 12 matching lines...) Expand all
242 FOR_EACH_OBSERVER(Observer, observers_, OnDisplayConfigurationChanging()); 244 FOR_EACH_OBSERVER(Observer, observers_, OnDisplayConfigurationChanging());
243 FOR_EACH_OBSERVER(Observer, observers_, OnDisplayConfigurationChanged()); 245 FOR_EACH_OBSERVER(Observer, observers_, OnDisplayConfigurationChanged());
244 } 246 }
245 } 247 }
246 248
247 void DisplayController::Shutdown() { 249 void DisplayController::Shutdown() {
248 // Unset the display manager's delegate here because 250 // Unset the display manager's delegate here because
249 // DisplayManager outlives DisplayController. 251 // DisplayManager outlives DisplayController.
250 Shell::GetInstance()->display_manager()->set_delegate(NULL); 252 Shell::GetInstance()->display_manager()->set_delegate(NULL);
251 253
254 cursor_window_controller_.reset();
252 mirror_window_controller_.reset(); 255 mirror_window_controller_.reset();
253 virtual_keyboard_window_controller_.reset(); 256 virtual_keyboard_window_controller_.reset();
254 257
255 Shell::GetScreen()->RemoveObserver(this); 258 Shell::GetScreen()->RemoveObserver(this);
256 // Delete all root window controllers, which deletes root window 259 // Delete all root window controllers, which deletes root window
257 // from the last so that the primary root window gets deleted last. 260 // from the last so that the primary root window gets deleted last.
258 for (std::map<int64, aura::Window*>::const_reverse_iterator it = 261 for (std::map<int64, aura::Window*>::const_reverse_iterator it =
259 root_windows_.rbegin(); it != root_windows_.rend(); ++it) { 262 root_windows_.rbegin(); it != root_windows_.rend(); ++it) {
260 internal::RootWindowController* controller = 263 internal::RootWindowController* controller =
261 internal::GetRootWindowController(it->second); 264 internal::GetRootWindowController(it->second);
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after
606 609
607 void DisplayController::OnWindowTreeHostResized(const aura::RootWindow* root) { 610 void DisplayController::OnWindowTreeHostResized(const aura::RootWindow* root) {
608 gfx::Display display = Shell::GetScreen()->GetDisplayNearestWindow( 611 gfx::Display display = Shell::GetScreen()->GetDisplayNearestWindow(
609 const_cast<aura::Window*>(root->window())); 612 const_cast<aura::Window*>(root->window()));
610 613
611 internal::DisplayManager* display_manager = GetDisplayManager(); 614 internal::DisplayManager* display_manager = GetDisplayManager();
612 if (display_manager->UpdateDisplayBounds( 615 if (display_manager->UpdateDisplayBounds(
613 display.id(), 616 display.id(),
614 root->host()->GetBounds())) { 617 root->host()->GetBounds())) {
615 mirror_window_controller_->UpdateWindow(); 618 mirror_window_controller_->UpdateWindow();
619 cursor_window_controller_->UpdateContainer();
616 } 620 }
617 } 621 }
618 622
619 void DisplayController::CreateOrUpdateNonDesktopDisplay( 623 void DisplayController::CreateOrUpdateNonDesktopDisplay(
620 const internal::DisplayInfo& info) { 624 const internal::DisplayInfo& info) {
621 switch (GetDisplayManager()->second_display_mode()) { 625 switch (GetDisplayManager()->second_display_mode()) {
622 case internal::DisplayManager::MIRRORING: 626 case internal::DisplayManager::MIRRORING:
623 mirror_window_controller_->UpdateWindow(info); 627 mirror_window_controller_->UpdateWindow(info);
628 cursor_window_controller_->UpdateContainer();
624 virtual_keyboard_window_controller_->Close(); 629 virtual_keyboard_window_controller_->Close();
625 break; 630 break;
626 case internal::DisplayManager::VIRTUAL_KEYBOARD: 631 case internal::DisplayManager::VIRTUAL_KEYBOARD:
627 mirror_window_controller_->Close(); 632 mirror_window_controller_->Close();
633 cursor_window_controller_->UpdateContainer();
628 virtual_keyboard_window_controller_->UpdateWindow(info); 634 virtual_keyboard_window_controller_->UpdateWindow(info);
629 break; 635 break;
630 case internal::DisplayManager::EXTENDED: 636 case internal::DisplayManager::EXTENDED:
631 NOTREACHED(); 637 NOTREACHED();
632 } 638 }
633 } 639 }
634 640
635 void DisplayController::CloseNonDesktopDisplay() { 641 void DisplayController::CloseNonDesktopDisplay() {
636 mirror_window_controller_->Close(); 642 mirror_window_controller_->Close();
643 cursor_window_controller_->UpdateContainer();
637 virtual_keyboard_window_controller_->Close(); 644 virtual_keyboard_window_controller_->Close();
638 } 645 }
639 646
640 void DisplayController::PreDisplayConfigurationChange(bool clear_focus) { 647 void DisplayController::PreDisplayConfigurationChange(bool clear_focus) {
641 FOR_EACH_OBSERVER(Observer, observers_, OnDisplayConfigurationChanging()); 648 FOR_EACH_OBSERVER(Observer, observers_, OnDisplayConfigurationChanging());
642 focus_activation_store_->Store(clear_focus); 649 focus_activation_store_->Store(clear_focus);
643 gfx::Screen* screen = Shell::GetScreen(); 650 gfx::Screen* screen = Shell::GetScreen();
644 gfx::Point point_in_screen = screen->GetCursorScreenPoint(); 651 gfx::Point point_in_screen = screen->GetCursorScreenPoint();
645 gfx::Display display = screen->GetDisplayNearestPoint(point_in_screen); 652 gfx::Display display = screen->GetDisplayNearestPoint(point_in_screen);
646 aura::Window* root_window = GetRootWindowForDisplayId(display.id()); 653 aura::Window* root_window = GetRootWindowForDisplayId(display.id());
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
735 std::string name = 742 std::string name =
736 root_windows[i] == primary ? "aura_root_0" : "aura_root_x"; 743 root_windows[i] == primary ? "aura_root_0" : "aura_root_x";
737 gfx::AcceleratedWidget xwindow = 744 gfx::AcceleratedWidget xwindow =
738 root_windows[i]->GetDispatcher()->host()->GetAcceleratedWidget(); 745 root_windows[i]->GetDispatcher()->host()->GetAcceleratedWidget();
739 XStoreName(gfx::GetXDisplay(), xwindow, name.c_str()); 746 XStoreName(gfx::GetXDisplay(), xwindow, name.c_str());
740 } 747 }
741 #endif 748 #endif
742 } 749 }
743 750
744 } // namespace ash 751 } // namespace ash
OLDNEW
« no previous file with comments | « ash/display/display_controller.h ('k') | ash/display/mirror_window_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698