OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 #import <Cocoa/Cocoa.h> | 5 #import <Cocoa/Cocoa.h> |
6 | 6 |
7 #include "chrome/browser/window_sizer.h" | 7 #include "chrome/browser/window_sizer.h" |
8 | 8 |
9 // How much horizontal and vertical offset there is between newly | 9 // How much horizontal and vertical offset there is between newly |
10 // opened windows. | 10 // opened windows. |
11 const int WindowSizer::kWindowTilePixels = 22; | 11 const int WindowSizer::kWindowTilePixels = 22; |
12 | 12 |
| 13 namespace { |
| 14 |
13 class DefaultMonitorInfoProvider : public WindowSizer::MonitorInfoProvider { | 15 class DefaultMonitorInfoProvider : public WindowSizer::MonitorInfoProvider { |
14 public: | 16 public: |
15 DefaultMonitorInfoProvider() { } | 17 DefaultMonitorInfoProvider() { } |
16 | 18 |
17 // Overridden from WindowSizer::MonitorInfoProvider: | 19 // Overridden from WindowSizer::MonitorInfoProvider: |
18 virtual gfx::Rect GetPrimaryMonitorWorkArea() const { | 20 virtual gfx::Rect GetPrimaryMonitorWorkArea() const { |
19 // Primary monitor is defined as the monitor with the menubar, | 21 // Primary monitor is defined as the monitor with the menubar, |
20 // which is always at index 0. | 22 // which is always at index 0. |
21 NSScreen* primary = [[NSScreen screens] objectAtIndex:0]; | 23 NSScreen* primary = [[NSScreen screens] objectAtIndex:0]; |
22 NSRect frame = [primary frame]; | 24 NSRect frame = [primary frame]; |
(...skipping 28 matching lines...) Expand all Loading... |
51 void UpdateWorkAreas() { | 53 void UpdateWorkAreas() { |
52 // TODO(rohitrao): Support multiple monitors. | 54 // TODO(rohitrao): Support multiple monitors. |
53 work_areas_.clear(); | 55 work_areas_.clear(); |
54 work_areas_.push_back(GetPrimaryMonitorWorkArea()); | 56 work_areas_.push_back(GetPrimaryMonitorWorkArea()); |
55 } | 57 } |
56 | 58 |
57 private: | 59 private: |
58 DISALLOW_COPY_AND_ASSIGN(DefaultMonitorInfoProvider); | 60 DISALLOW_COPY_AND_ASSIGN(DefaultMonitorInfoProvider); |
59 }; | 61 }; |
60 | 62 |
| 63 } // namespace |
| 64 |
61 // static | 65 // static |
62 WindowSizer::MonitorInfoProvider* | 66 WindowSizer::MonitorInfoProvider* |
63 WindowSizer::CreateDefaultMonitorInfoProvider() { | 67 WindowSizer::CreateDefaultMonitorInfoProvider() { |
64 return new DefaultMonitorInfoProvider(); | 68 return new DefaultMonitorInfoProvider(); |
65 } | 69 } |
66 | 70 |
67 // static | 71 // static |
68 gfx::Point WindowSizer::GetDefaultPopupOrigin(const gfx::Size& size) { | 72 gfx::Point WindowSizer::GetDefaultPopupOrigin(const gfx::Size& size) { |
69 return gfx::Point(0, 0); | 73 return gfx::Point(0, 0); |
70 } | 74 } |
OLD | NEW |