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

Side by Side Diff: chrome/browser/ui/panels/display_settings_provider.cc

Issue 1608733002: Remove ui/gfx/screen_type_delegate.h (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@metro-mode-4
Patch Set: GetNativeScreen Created 4 years, 11 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
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 "chrome/browser/ui/panels/display_settings_provider.h" 5 #include "chrome/browser/ui/panels/display_settings_provider.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "build/build_config.h" 9 #include "build/build_config.h"
10 #include "chrome/browser/fullscreen.h" 10 #include "chrome/browser/fullscreen.h"
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 void DisplaySettingsProvider::RemoveFullScreenObserver( 59 void DisplaySettingsProvider::RemoveFullScreenObserver(
60 FullScreenObserver* observer) { 60 FullScreenObserver* observer) {
61 full_screen_observers_.RemoveObserver(observer); 61 full_screen_observers_.RemoveObserver(observer);
62 62
63 if (!full_screen_observers_.might_have_observers()) 63 if (!full_screen_observers_.might_have_observers())
64 full_screen_mode_timer_.Stop(); 64 full_screen_mode_timer_.Stop();
65 } 65 }
66 66
67 // TODO(scottmg): This should be moved to ui/. 67 // TODO(scottmg): This should be moved to ui/.
68 gfx::Rect DisplaySettingsProvider::GetPrimaryDisplayArea() const { 68 gfx::Rect DisplaySettingsProvider::GetPrimaryDisplayArea() const {
69 // TODO(scottmg): NativeScreen is wrong. http://crbug.com/133312 69 return gfx::Screen::GetScreen()->GetPrimaryDisplay().bounds();
70 return gfx::Screen::GetNativeScreen()->GetPrimaryDisplay().bounds();
71 } 70 }
72 71
73 gfx::Rect DisplaySettingsProvider::GetPrimaryWorkArea() const { 72 gfx::Rect DisplaySettingsProvider::GetPrimaryWorkArea() const {
74 #if defined(OS_MACOSX) 73 #if defined(OS_MACOSX)
75 // On OSX, panels should be dropped all the way to the bottom edge of the 74 // On OSX, panels should be dropped all the way to the bottom edge of the
76 // screen (and overlap Dock). And we also want to exclude the system menu 75 // screen (and overlap Dock). And we also want to exclude the system menu
77 // area. Note that the rect returned from gfx::Screen util functions is in 76 // area. Note that the rect returned from gfx::Screen util functions is in
78 // platform-independent screen coordinates with (0, 0) as the top-left corner. 77 // platform-independent screen coordinates with (0, 0) as the top-left corner.
79 // TODO(scottmg): NativeScreen is wrong. http://crbug.com/133312 78 gfx::Display display = gfx::Screen::GetScreen()->GetPrimaryDisplay();
80 gfx::Display display = gfx::Screen::GetNativeScreen()->GetPrimaryDisplay();
81 gfx::Rect display_area = display.bounds(); 79 gfx::Rect display_area = display.bounds();
82 gfx::Rect work_area = display.work_area(); 80 gfx::Rect work_area = display.work_area();
83 int system_menu_height = work_area.y() - display_area.y(); 81 int system_menu_height = work_area.y() - display_area.y();
84 if (system_menu_height > 0) { 82 if (system_menu_height > 0) {
85 display_area.set_y(display_area.y() + system_menu_height); 83 display_area.set_y(display_area.y() + system_menu_height);
86 display_area.set_height(display_area.height() - system_menu_height); 84 display_area.set_height(display_area.height() - system_menu_height);
87 } 85 }
88 return display_area; 86 return display_area;
89 #else 87 #else
90 // TODO(scottmg): NativeScreen is wrong. http://crbug.com/133312 88 return gfx::Screen::GetScreen()->GetPrimaryDisplay().work_area();
91 return gfx::Screen::GetNativeScreen()->GetPrimaryDisplay().work_area();
92 #endif 89 #endif
93 } 90 }
94 91
95 gfx::Rect DisplaySettingsProvider::GetDisplayAreaMatching( 92 gfx::Rect DisplaySettingsProvider::GetDisplayAreaMatching(
96 const gfx::Rect& bounds) const { 93 const gfx::Rect& bounds) const {
97 // TODO(scottmg): NativeScreen is wrong. http://crbug.com/133312 94 return gfx::Screen::GetScreen()->GetDisplayMatching(bounds).bounds();
98 return gfx::Screen::GetNativeScreen()->GetDisplayMatching(bounds).bounds();
99 } 95 }
100 96
101 gfx::Rect DisplaySettingsProvider::GetWorkAreaMatching( 97 gfx::Rect DisplaySettingsProvider::GetWorkAreaMatching(
102 const gfx::Rect& bounds) const { 98 const gfx::Rect& bounds) const {
103 // TODO(scottmg): NativeScreen is wrong. http://crbug.com/133312 99 gfx::Screen* screen = gfx::Screen::GetScreen();
104 gfx::Screen* screen = gfx::Screen::GetNativeScreen();
105 gfx::Display display = screen->GetDisplayMatching(bounds); 100 gfx::Display display = screen->GetDisplayMatching(bounds);
106 if (display.bounds() == screen->GetPrimaryDisplay().bounds()) 101 if (display.bounds() == screen->GetPrimaryDisplay().bounds())
107 return GetPrimaryWorkArea(); 102 return GetPrimaryWorkArea();
108 return display.work_area(); 103 return display.work_area();
109 } 104 }
110 105
111 void DisplaySettingsProvider::OnDisplaySettingsChanged() { 106 void DisplaySettingsProvider::OnDisplaySettingsChanged() {
112 FOR_EACH_OBSERVER(DisplayObserver, display_observers_, OnDisplayChanged()); 107 FOR_EACH_OBSERVER(DisplayObserver, display_observers_, OnDisplayChanged());
113 } 108 }
114 109
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 bool DisplaySettingsProvider::IsFullScreen() { 156 bool DisplaySettingsProvider::IsFullScreen() {
162 return IsFullScreenMode(); 157 return IsFullScreenMode();
163 } 158 }
164 159
165 #if defined(USE_AURA) 160 #if defined(USE_AURA)
166 // static 161 // static
167 DisplaySettingsProvider* DisplaySettingsProvider::Create() { 162 DisplaySettingsProvider* DisplaySettingsProvider::Create() {
168 return new DisplaySettingsProvider(); 163 return new DisplaySettingsProvider();
169 } 164 }
170 #endif 165 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698