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

Side by Side Diff: ash/screen_ash.cc

Issue 11363124: Move DisplayManager and DisplayChangeObserverX11 from aura to ash. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix rebase Created 8 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/screen_ash.h ('k') | ash/shell.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/screen_ash.h" 5 #include "ash/screen_ash.h"
6 6
7 #include "ash/display/display_controller.h" 7 #include "ash/display/display_controller.h"
8 #include "ash/display/multi_display_manager.h" 8 #include "ash/display/display_manager.h"
9 #include "ash/root_window_controller.h" 9 #include "ash/root_window_controller.h"
10 #include "ash/shell.h" 10 #include "ash/shell.h"
11 #include "ash/wm/property_util.h" 11 #include "ash/wm/property_util.h"
12 #include "ash/wm/coordinate_conversion.h" 12 #include "ash/wm/coordinate_conversion.h"
13 #include "ash/wm/shelf_layout_manager.h" 13 #include "ash/wm/shelf_layout_manager.h"
14 #include "base/logging.h" 14 #include "base/logging.h"
15 #include "ui/aura/client/screen_position_client.h" 15 #include "ui/aura/client/screen_position_client.h"
16 #include "ui/aura/env.h" 16 #include "ui/aura/env.h"
17 #include "ui/aura/display_manager.h"
18 #include "ui/aura/root_window.h" 17 #include "ui/aura/root_window.h"
19 #include "ui/gfx/display.h" 18 #include "ui/gfx/display.h"
20 #include "ui/gfx/screen.h" 19 #include "ui/gfx/screen.h"
21 20
22 namespace ash { 21 namespace ash {
23 22
24 namespace { 23 namespace {
25 internal::MultiDisplayManager* GetDisplayManager() { 24 internal::DisplayManager* GetDisplayManager() {
26 return static_cast<internal::MultiDisplayManager*>( 25 return Shell::GetInstance()->display_manager();
27 aura::Env::GetInstance()->display_manager());
28 } 26 }
29 } // namespace 27 } // namespace
30 28
31 ScreenAsh::ScreenAsh() { 29 ScreenAsh::ScreenAsh() {
32 } 30 }
33 31
34 ScreenAsh::~ScreenAsh() { 32 ScreenAsh::~ScreenAsh() {
35 } 33 }
36 34
37 // static 35 // static
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 // static 80 // static
83 const gfx::Display& ScreenAsh::GetSecondaryDisplay() { 81 const gfx::Display& ScreenAsh::GetSecondaryDisplay() {
84 return *(Shell::GetInstance()->display_controller()->GetSecondaryDisplay()); 82 return *(Shell::GetInstance()->display_controller()->GetSecondaryDisplay());
85 } 83 }
86 84
87 // static 85 // static
88 const gfx::Display& ScreenAsh::GetDisplayForId(int64 display_id) { 86 const gfx::Display& ScreenAsh::GetDisplayForId(int64 display_id) {
89 return GetDisplayManager()->GetDisplayForId(display_id); 87 return GetDisplayManager()->GetDisplayForId(display_id);
90 } 88 }
91 89
90 void ScreenAsh::NotifyBoundsChanged(const gfx::Display& display) {
91 FOR_EACH_OBSERVER(gfx::DisplayObserver, observers_,
92 OnDisplayBoundsChanged(display));
93 }
94
95 void ScreenAsh::NotifyDisplayAdded(const gfx::Display& display) {
96 FOR_EACH_OBSERVER(gfx::DisplayObserver, observers_, OnDisplayAdded(display));
97 }
98
99 void ScreenAsh::NotifyDisplayRemoved(const gfx::Display& display) {
100 FOR_EACH_OBSERVER(
101 gfx::DisplayObserver, observers_, OnDisplayRemoved(display));
102 }
103
92 bool ScreenAsh::IsDIPEnabled() { 104 bool ScreenAsh::IsDIPEnabled() {
93 return true; 105 return true;
94 } 106 }
95 107
96 gfx::Point ScreenAsh::GetCursorScreenPoint() { 108 gfx::Point ScreenAsh::GetCursorScreenPoint() {
97 return aura::Env::GetInstance()->last_mouse_location(); 109 return aura::Env::GetInstance()->last_mouse_location();
98 } 110 }
99 111
100 gfx::NativeWindow ScreenAsh::GetWindowAtCursorScreenPoint() { 112 gfx::NativeWindow ScreenAsh::GetWindowAtCursorScreenPoint() {
101 const gfx::Point point = Shell::GetScreen()->GetCursorScreenPoint(); 113 const gfx::Point point = Shell::GetScreen()->GetCursorScreenPoint();
(...skipping 13 matching lines...) Expand all
115 } 127 }
116 128
117 gfx::Display ScreenAsh::GetDisplayMatching(const gfx::Rect& match_rect) const { 129 gfx::Display ScreenAsh::GetDisplayMatching(const gfx::Rect& match_rect) const {
118 return GetDisplayManager()->GetDisplayMatching(match_rect); 130 return GetDisplayManager()->GetDisplayMatching(match_rect);
119 } 131 }
120 132
121 gfx::Display ScreenAsh::GetPrimaryDisplay() const { 133 gfx::Display ScreenAsh::GetPrimaryDisplay() const {
122 return DisplayController::GetPrimaryDisplay(); 134 return DisplayController::GetPrimaryDisplay();
123 } 135 }
124 136
137 void ScreenAsh::AddObserver(gfx::DisplayObserver* observer) {
138 observers_.AddObserver(observer);
139 }
140
141 void ScreenAsh::RemoveObserver(gfx::DisplayObserver* observer) {
142 observers_.RemoveObserver(observer);
143 }
144
125 } // namespace ash 145 } // namespace ash
OLDNEW
« no previous file with comments | « ash/screen_ash.h ('k') | ash/shell.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698