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

Side by Side Diff: ui/aura/single_display_manager.cc

Issue 10675011: Rename the remaining usage of Monitor to Display (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: sync Created 8 years, 5 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 | « ui/aura/single_display_manager.h ('k') | ui/aura/single_monitor_manager.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 "ui/aura/single_monitor_manager.h" 5 #include "ui/aura/single_display_manager.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "ui/aura/aura_switches.h" 10 #include "ui/aura/aura_switches.h"
11 #include "ui/aura/root_window.h" 11 #include "ui/aura/root_window.h"
12 #include "ui/aura/root_window_host.h" 12 #include "ui/aura/root_window_host.h"
13 #include "ui/gfx/display.h" 13 #include "ui/gfx/display.h"
14 #include "ui/gfx/rect.h" 14 #include "ui/gfx/rect.h"
15 15
16 namespace aura { 16 namespace aura {
17 17
18 using std::string; 18 using std::string;
19 19
20 namespace { 20 namespace {
21 // Default bounds for the primary monitor. 21 // Default bounds for the primary display.
22 const int kDefaultHostWindowX = 200; 22 const int kDefaultHostWindowX = 200;
23 const int kDefaultHostWindowY = 200; 23 const int kDefaultHostWindowY = 200;
24 const int kDefaultHostWindowWidth = 1280; 24 const int kDefaultHostWindowWidth = 1280;
25 const int kDefaultHostWindowHeight = 1024; 25 const int kDefaultHostWindowHeight = 1024;
26 } // namespace 26 } // namespace
27 27
28 SingleMonitorManager::SingleMonitorManager() 28 SingleDisplayManager::SingleDisplayManager()
29 : root_window_(NULL) { 29 : root_window_(NULL) {
30 Init(); 30 Init();
31 } 31 }
32 32
33 SingleMonitorManager::~SingleMonitorManager() { 33 SingleDisplayManager::~SingleDisplayManager() {
34 // All monitors must have been deleted when monitor manager is deleted. 34 // All displays must have been deleted when display manager is deleted.
35 CHECK(!root_window_); 35 CHECK(!root_window_);
36 } 36 }
37 37
38 void SingleMonitorManager::OnNativeMonitorsChanged( 38 void SingleDisplayManager::OnNativeDisplaysChanged(
39 const std::vector<gfx::Display>& displays) { 39 const std::vector<gfx::Display>& displays) {
40 DCHECK(displays.size() > 0); 40 DCHECK(displays.size() > 0);
41 if (use_fullscreen_host_window()) { 41 if (use_fullscreen_host_window()) {
42 display_.SetSize(displays[0].bounds().size()); 42 display_.SetSize(displays[0].bounds().size());
43 NotifyBoundsChanged(display_); 43 NotifyBoundsChanged(display_);
44 } 44 }
45 } 45 }
46 46
47 RootWindow* SingleMonitorManager::CreateRootWindowForMonitor( 47 RootWindow* SingleDisplayManager::CreateRootWindowForDisplay(
48 const gfx::Display& display) { 48 const gfx::Display& display) {
49 DCHECK(!root_window_); 49 DCHECK(!root_window_);
50 DCHECK_EQ(display_.id(), display.id()); 50 DCHECK_EQ(display_.id(), display.id());
51 root_window_ = new RootWindow(display.bounds()); 51 root_window_ = new RootWindow(display.bounds());
52 root_window_->AddObserver(this); 52 root_window_->AddObserver(this);
53 root_window_->Init(); 53 root_window_->Init();
54 return root_window_; 54 return root_window_;
55 } 55 }
56 56
57 const gfx::Display& SingleMonitorManager::GetDisplayAt(size_t index) { 57 const gfx::Display& SingleDisplayManager::GetDisplayAt(size_t index) {
58 return display_; 58 return display_;
59 } 59 }
60 60
61 size_t SingleMonitorManager::GetNumDisplays() const { 61 size_t SingleDisplayManager::GetNumDisplays() const {
62 return 1; 62 return 1;
63 } 63 }
64 64
65 const gfx::Display& SingleMonitorManager::GetDisplayNearestWindow( 65 const gfx::Display& SingleDisplayManager::GetDisplayNearestWindow(
66 const Window* window) const { 66 const Window* window) const {
67 return display_; 67 return display_;
68 } 68 }
69 69
70 const gfx::Display& SingleMonitorManager::GetDisplayNearestPoint( 70 const gfx::Display& SingleDisplayManager::GetDisplayNearestPoint(
71 const gfx::Point& point) const { 71 const gfx::Point& point) const {
72 return display_; 72 return display_;
73 } 73 }
74 74
75 void SingleMonitorManager::OnWindowBoundsChanged( 75 void SingleDisplayManager::OnWindowBoundsChanged(
76 Window* window, const gfx::Rect& old_bounds, const gfx::Rect& new_bounds) { 76 Window* window, const gfx::Rect& old_bounds, const gfx::Rect& new_bounds) {
77 if (!use_fullscreen_host_window()) { 77 if (!use_fullscreen_host_window()) {
78 Update(new_bounds.size()); 78 Update(new_bounds.size());
79 NotifyBoundsChanged(display_); 79 NotifyBoundsChanged(display_);
80 } 80 }
81 } 81 }
82 82
83 void SingleMonitorManager::OnWindowDestroying(Window* window) { 83 void SingleDisplayManager::OnWindowDestroying(Window* window) {
84 if (root_window_ == window) 84 if (root_window_ == window)
85 root_window_ = NULL; 85 root_window_ = NULL;
86 } 86 }
87 87
88 void SingleMonitorManager::Init() { 88 void SingleDisplayManager::Init() {
89 const string size_str = CommandLine::ForCurrentProcess()->GetSwitchValueASCII( 89 const string size_str = CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
90 switches::kAuraHostWindowSize); 90 switches::kAuraHostWindowSize);
91 display_ = CreateMonitorFromSpec(size_str); 91 display_ = CreateDisplayFromSpec(size_str);
92 } 92 }
93 93
94 void SingleMonitorManager::Update(const gfx::Size size) { 94 void SingleDisplayManager::Update(const gfx::Size size) {
95 display_.SetSize(size); 95 display_.SetSize(size);
96 } 96 }
97 97
98 } // namespace aura 98 } // namespace aura
OLDNEW
« no previous file with comments | « ui/aura/single_display_manager.h ('k') | ui/aura/single_monitor_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698