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

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

Issue 1920263003: Rename gfx::Display/Screen to display::Display/Screen in chrome (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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
« no previous file with comments | « chrome/browser/ui/libgtk2ui/gtk2_ui.cc ('k') | chrome/browser/ui/panels/panel_browsertest.cc » ('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 "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"
11 #include "ui/gfx/screen.h" 11 #include "ui/display/screen.h"
12 12
13 namespace { 13 namespace {
14 // The polling interval to check any display settings change, like full-screen 14 // The polling interval to check any display settings change, like full-screen
15 // mode changes. 15 // mode changes.
16 const int kFullScreenModeCheckIntervalMs = 1000; 16 const int kFullScreenModeCheckIntervalMs = 1000;
17 } // namespace 17 } // namespace
18 18
19 DisplaySettingsProvider::DisplaySettingsProvider() 19 DisplaySettingsProvider::DisplaySettingsProvider()
20 : is_full_screen_(false) { 20 : is_full_screen_(false) {
21 } 21 }
(...skipping 37 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 return gfx::Screen::GetScreen()->GetPrimaryDisplay().bounds(); 69 return display::Screen::GetScreen()->GetPrimaryDisplay().bounds();
70 } 70 }
71 71
72 gfx::Rect DisplaySettingsProvider::GetPrimaryWorkArea() const { 72 gfx::Rect DisplaySettingsProvider::GetPrimaryWorkArea() const {
73 #if defined(OS_MACOSX) 73 #if defined(OS_MACOSX)
74 // 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
75 // 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
76 // area. Note that the rect returned from gfx::Screen util functions is in 76 // area. Note that the rect returned from display::Screen util functions is in
77 // 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.
78 gfx::Display display = gfx::Screen::GetScreen()->GetPrimaryDisplay(); 78 display::Display display = display::Screen::GetScreen()->GetPrimaryDisplay();
79 gfx::Rect display_area = display.bounds(); 79 gfx::Rect display_area = display.bounds();
80 gfx::Rect work_area = display.work_area(); 80 gfx::Rect work_area = display.work_area();
81 int system_menu_height = work_area.y() - display_area.y(); 81 int system_menu_height = work_area.y() - display_area.y();
82 if (system_menu_height > 0) { 82 if (system_menu_height > 0) {
83 display_area.set_y(display_area.y() + system_menu_height); 83 display_area.set_y(display_area.y() + system_menu_height);
84 display_area.set_height(display_area.height() - system_menu_height); 84 display_area.set_height(display_area.height() - system_menu_height);
85 } 85 }
86 return display_area; 86 return display_area;
87 #else 87 #else
88 return gfx::Screen::GetScreen()->GetPrimaryDisplay().work_area(); 88 return display::Screen::GetScreen()->GetPrimaryDisplay().work_area();
89 #endif 89 #endif
90 } 90 }
91 91
92 gfx::Rect DisplaySettingsProvider::GetDisplayAreaMatching( 92 gfx::Rect DisplaySettingsProvider::GetDisplayAreaMatching(
93 const gfx::Rect& bounds) const { 93 const gfx::Rect& bounds) const {
94 return gfx::Screen::GetScreen()->GetDisplayMatching(bounds).bounds(); 94 return display::Screen::GetScreen()->GetDisplayMatching(bounds).bounds();
95 } 95 }
96 96
97 gfx::Rect DisplaySettingsProvider::GetWorkAreaMatching( 97 gfx::Rect DisplaySettingsProvider::GetWorkAreaMatching(
98 const gfx::Rect& bounds) const { 98 const gfx::Rect& bounds) const {
99 gfx::Screen* screen = gfx::Screen::GetScreen(); 99 display::Screen* screen = display::Screen::GetScreen();
100 gfx::Display display = screen->GetDisplayMatching(bounds); 100 display::Display display = screen->GetDisplayMatching(bounds);
101 if (display.bounds() == screen->GetPrimaryDisplay().bounds()) 101 if (display.bounds() == screen->GetPrimaryDisplay().bounds())
102 return GetPrimaryWorkArea(); 102 return GetPrimaryWorkArea();
103 return display.work_area(); 103 return display.work_area();
104 } 104 }
105 105
106 void DisplaySettingsProvider::OnDisplaySettingsChanged() { 106 void DisplaySettingsProvider::OnDisplaySettingsChanged() {
107 FOR_EACH_OBSERVER(DisplayObserver, display_observers_, OnDisplayChanged()); 107 FOR_EACH_OBSERVER(DisplayObserver, display_observers_, OnDisplayChanged());
108 } 108 }
109 109
110 bool DisplaySettingsProvider::IsAutoHidingDesktopBarEnabled( 110 bool DisplaySettingsProvider::IsAutoHidingDesktopBarEnabled(
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 bool DisplaySettingsProvider::IsFullScreen() { 156 bool DisplaySettingsProvider::IsFullScreen() {
157 return IsFullScreenMode(); 157 return IsFullScreenMode();
158 } 158 }
159 159
160 #if defined(USE_AURA) 160 #if defined(USE_AURA)
161 // static 161 // static
162 DisplaySettingsProvider* DisplaySettingsProvider::Create() { 162 DisplaySettingsProvider* DisplaySettingsProvider::Create() {
163 return new DisplaySettingsProvider(); 163 return new DisplaySettingsProvider();
164 } 164 }
165 #endif 165 #endif
OLDNEW
« no previous file with comments | « chrome/browser/ui/libgtk2ui/gtk2_ui.cc ('k') | chrome/browser/ui/panels/panel_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698