OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "chrome/browser/ui/window_sizer.h" |
| 6 |
| 7 #include "ui/aura/desktop.h" |
| 8 #include "ui/aura/window.h" |
| 9 #include "ui/gfx/screen.h" |
| 10 |
| 11 // TODO(oshima): Get This from WindowManager |
| 12 const int WindowSizer::kWindowTilePixels = 10; |
| 13 |
| 14 // An implementation of WindowSizer::MonitorInfoProvider that gets the actual |
| 15 // monitor information from X via GDK. |
| 16 class DefaultMonitorInfoProvider : public WindowSizer::MonitorInfoProvider { |
| 17 public: |
| 18 DefaultMonitorInfoProvider() { } |
| 19 |
| 20 virtual gfx::Rect GetPrimaryMonitorWorkArea() const { |
| 21 return gfx::Screen::GetMonitorWorkAreaNearestPoint( |
| 22 gfx::Point(0, 0)); |
| 23 } |
| 24 |
| 25 virtual gfx::Rect GetPrimaryMonitorBounds() const { |
| 26 aura::Window* desktop_window = aura::Desktop::GetInstance()->window(); |
| 27 return desktop_window->bounds(); |
| 28 } |
| 29 |
| 30 virtual gfx::Rect GetMonitorWorkAreaMatching( |
| 31 const gfx::Rect& match_rect) const { |
| 32 return gfx::Screen::GetMonitorWorkAreaNearestPoint( |
| 33 match_rect.origin()); |
| 34 } |
| 35 |
| 36 virtual gfx::Point GetBoundsOffsetMatching( |
| 37 const gfx::Rect& match_rect) const { |
| 38 return GetMonitorWorkAreaMatching(match_rect).origin(); |
| 39 } |
| 40 |
| 41 void UpdateWorkAreas() { |
| 42 work_areas_.clear(); |
| 43 work_areas_.push_back(GetPrimaryMonitorBounds()); |
| 44 } |
| 45 |
| 46 private: |
| 47 |
| 48 DISALLOW_COPY_AND_ASSIGN(DefaultMonitorInfoProvider); |
| 49 }; |
| 50 |
| 51 // static |
| 52 WindowSizer::MonitorInfoProvider* |
| 53 WindowSizer::CreateDefaultMonitorInfoProvider() { |
| 54 return new DefaultMonitorInfoProvider(); |
| 55 } |
| 56 |
| 57 // static |
| 58 gfx::Point WindowSizer::GetDefaultPopupOrigin(const gfx::Size& size) { |
| 59 // TODO(oshima):This is used to control panel/popups, and this may |
| 60 // not be needed on aura environment as they must be controlled by |
| 61 // WM. |
| 62 NOTIMPLEMENTED(); |
| 63 return gfx::Point(); |
| 64 } |
OLD | NEW |