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

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

Issue 9960042: Refactor screen/monitor so that gfx::Screen returns monitor object. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: sync Created 8 years, 8 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
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/logging.h" 7 #include "base/logging.h"
8 #include "ui/gfx/monitor.h"
8 #include "ui/gfx/screen.h" 9 #include "ui/gfx/screen.h"
9 10
10 DisplaySettingsProvider::DisplaySettingsProvider() 11 DisplaySettingsProvider::DisplaySettingsProvider()
11 : display_area_observer_(NULL), 12 : display_area_observer_(NULL),
12 desktop_bar_observer_(NULL) { 13 desktop_bar_observer_(NULL) {
13 } 14 }
14 15
15 DisplaySettingsProvider::~DisplaySettingsProvider() { 16 DisplaySettingsProvider::~DisplaySettingsProvider() {
16 } 17 }
17 18
18 gfx::Rect DisplaySettingsProvider::GetDisplayArea() { 19 gfx::Rect DisplaySettingsProvider::GetDisplayArea() {
19 // Do the first-time initialization if not yet. 20 // Do the first-time initialization if not yet.
20 if (adjusted_work_area_.IsEmpty()) 21 if (adjusted_work_area_.IsEmpty())
21 OnDisplaySettingsChanged(); 22 OnDisplaySettingsChanged();
22 23
23 return adjusted_work_area_; 24 return adjusted_work_area_;
24 } 25 }
25 26
26 gfx::Rect DisplaySettingsProvider::GetWorkArea() const { 27 gfx::Rect DisplaySettingsProvider::GetWorkArea() const {
27 #if defined(OS_MACOSX) 28 #if defined(OS_MACOSX)
28 // On OSX, panels should be dropped all the way to the bottom edge of the 29 // On OSX, panels should be dropped all the way to the bottom edge of the
29 // screen (and overlap Dock). 30 // screen (and overlap Dock).
30 gfx::Rect work_area = gfx::Screen::GetPrimaryMonitorBounds(); 31 gfx::Rect work_area = gfx::Screen::GetPrimaryMonitor()->GetBounds();
31 #else 32 #else
32 gfx::Rect work_area = gfx::Screen::GetPrimaryMonitorWorkArea(); 33 gfx::Rect work_area = gfx::Screen::GetPrimaryMonitor()->GetWorkArea();
33 #endif 34 #endif
34 return work_area; 35 return work_area;
35 } 36 }
36 37
37 void DisplaySettingsProvider::OnDisplaySettingsChanged() { 38 void DisplaySettingsProvider::OnDisplaySettingsChanged() {
38 gfx::Rect work_area = GetWorkArea(); 39 gfx::Rect work_area = GetWorkArea();
39 if (work_area == work_area_) 40 if (work_area == work_area_)
40 return; 41 return;
41 work_area_ = work_area; 42 work_area_ = work_area;
42 43
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 adjusted_work_area_.set_width(adjusted_work_area_.width() - space); 87 adjusted_work_area_.set_width(adjusted_work_area_.width() - space);
87 } 88 }
88 } 89 }
89 90
90 #if defined(USE_AURA) 91 #if defined(USE_AURA)
91 // static 92 // static
92 DisplaySettingsProvider* DisplaySettingsProvider::Create() { 93 DisplaySettingsProvider* DisplaySettingsProvider::Create() {
93 return new DisplaySettingsProvider(); 94 return new DisplaySettingsProvider();
94 } 95 }
95 #endif 96 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698