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

Side by Side Diff: chrome/browser/ui/window_sizer_aura.cc

Issue 8549008: Extract MonitorInfoProvider from WindowSizer. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: add docs Created 9 years 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 | « chrome/browser/ui/window_sizer.cc ('k') | chrome/browser/ui/window_sizer_gtk.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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/window_sizer.h" 5 #include "chrome/browser/ui/window_sizer.h"
6 6
7 #include "base/compiler_specific.h"
8 #include "ui/gfx/screen.h"
9
10 // This doesn't matter for aura, which has different tiling. 7 // This doesn't matter for aura, which has different tiling.
11 // static 8 // static
12 const int WindowSizer::kWindowTilePixels = 10; 9 const int WindowSizer::kWindowTilePixels = 10;
13 10
14 // An implementation of WindowSizer::MonitorInfoProvider. This assumes a single
15 // monitor, which is currently the case.
16 class DefaultMonitorInfoProvider : public WindowSizer::MonitorInfoProvider {
17 public:
18 DefaultMonitorInfoProvider() {}
19
20 virtual gfx::Rect GetPrimaryMonitorWorkArea() const OVERRIDE {
21 return gfx::Screen::GetMonitorWorkAreaNearestPoint(gfx::Point());
22 }
23
24 virtual gfx::Rect GetPrimaryMonitorBounds() const OVERRIDE {
25 return gfx::Screen::GetMonitorAreaNearestPoint(gfx::Point());
26 }
27
28 virtual gfx::Rect GetMonitorWorkAreaMatching(
29 const gfx::Rect& match_rect) const OVERRIDE {
30 return gfx::Screen::GetMonitorWorkAreaNearestPoint(gfx::Point());
31 }
32
33 virtual void UpdateWorkAreas() OVERRIDE {
34 work_areas_.clear();
35 work_areas_.push_back(GetPrimaryMonitorBounds());
36 }
37
38 private:
39 DISALLOW_COPY_AND_ASSIGN(DefaultMonitorInfoProvider);
40 };
41
42 // static
43 WindowSizer::MonitorInfoProvider*
44 WindowSizer::CreateDefaultMonitorInfoProvider() {
45 return new DefaultMonitorInfoProvider();
46 }
47
48 // static 11 // static
49 gfx::Point WindowSizer::GetDefaultPopupOrigin(const gfx::Size& size) { 12 gfx::Point WindowSizer::GetDefaultPopupOrigin(const gfx::Size& size) {
50 // TODO(oshima):This is used to control panel/popups, and this may not be 13 // TODO(oshima):This is used to control panel/popups, and this may not be
51 // needed on aura environment as they must be controlled by WM. 14 // needed on aura environment as they must be controlled by WM.
52 return gfx::Point(); 15 return gfx::Point();
53 } 16 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/window_sizer.cc ('k') | chrome/browser/ui/window_sizer_gtk.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698