OLD | NEW |
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 } |
OLD | NEW |