| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "ash/display/screen_ash.h" | 5 #include "ash/display/screen_ash.h" |
| 6 | 6 |
| 7 #include "ash/display/display_controller.h" | 7 #include "ash/display/display_controller.h" |
| 8 #include "ash/display/display_manager.h" | 8 #include "ash/display/display_manager.h" |
| 9 #include "ash/root_window_controller.h" | 9 #include "ash/root_window_controller.h" |
| 10 #include "ash/root_window_settings.h" | 10 #include "ash/root_window_settings.h" |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 } | 64 } |
| 65 | 65 |
| 66 class ScreenForShutdown : public gfx::Screen { | 66 class ScreenForShutdown : public gfx::Screen { |
| 67 public: | 67 public: |
| 68 explicit ScreenForShutdown(ScreenAsh* screen_ash) | 68 explicit ScreenForShutdown(ScreenAsh* screen_ash) |
| 69 : display_list_(screen_ash->GetAllDisplays()), | 69 : display_list_(screen_ash->GetAllDisplays()), |
| 70 primary_display_(screen_ash->GetPrimaryDisplay()) { | 70 primary_display_(screen_ash->GetPrimaryDisplay()) { |
| 71 } | 71 } |
| 72 | 72 |
| 73 // gfx::Screen overrides: | 73 // gfx::Screen overrides: |
| 74 virtual gfx::Point GetCursorScreenPoint() override { | 74 gfx::Point GetCursorScreenPoint() override { return gfx::Point(); } |
| 75 return gfx::Point(); | 75 gfx::NativeWindow GetWindowUnderCursor() override { return NULL; } |
| 76 } | 76 gfx::NativeWindow GetWindowAtScreenPoint(const gfx::Point& point) override { |
| 77 virtual gfx::NativeWindow GetWindowUnderCursor() override { | |
| 78 return NULL; | 77 return NULL; |
| 79 } | 78 } |
| 80 virtual gfx::NativeWindow GetWindowAtScreenPoint( | 79 int GetNumDisplays() const override { return display_list_.size(); } |
| 81 const gfx::Point& point) override { | 80 std::vector<gfx::Display> GetAllDisplays() const override { |
| 82 return NULL; | |
| 83 } | |
| 84 virtual int GetNumDisplays() const override { | |
| 85 return display_list_.size(); | |
| 86 } | |
| 87 virtual std::vector<gfx::Display> GetAllDisplays() const override { | |
| 88 return display_list_; | 81 return display_list_; |
| 89 } | 82 } |
| 90 virtual gfx::Display GetDisplayNearestWindow(gfx::NativeView view) | 83 gfx::Display GetDisplayNearestWindow(gfx::NativeView view) const override { |
| 91 const override { | |
| 92 return primary_display_; | 84 return primary_display_; |
| 93 } | 85 } |
| 94 virtual gfx::Display GetDisplayNearestPoint( | 86 gfx::Display GetDisplayNearestPoint(const gfx::Point& point) const override { |
| 95 const gfx::Point& point) const override { | |
| 96 return FindDisplayNearestPoint(display_list_, point); | 87 return FindDisplayNearestPoint(display_list_, point); |
| 97 } | 88 } |
| 98 virtual gfx::Display GetDisplayMatching(const gfx::Rect& match_rect) | 89 gfx::Display GetDisplayMatching(const gfx::Rect& match_rect) const override { |
| 99 const override { | |
| 100 const gfx::Display* matching = | 90 const gfx::Display* matching = |
| 101 FindDisplayMatching(display_list_, match_rect); | 91 FindDisplayMatching(display_list_, match_rect); |
| 102 // Fallback to the primary display if there is no matching display. | 92 // Fallback to the primary display if there is no matching display. |
| 103 return matching ? *matching : GetPrimaryDisplay(); | 93 return matching ? *matching : GetPrimaryDisplay(); |
| 104 } | 94 } |
| 105 virtual gfx::Display GetPrimaryDisplay() const override { | 95 gfx::Display GetPrimaryDisplay() const override { return primary_display_; } |
| 106 return primary_display_; | 96 void AddObserver(gfx::DisplayObserver* observer) override { |
| 107 } | |
| 108 virtual void AddObserver(gfx::DisplayObserver* observer) override { | |
| 109 NOTREACHED() << "Observer should not be added during shutdown"; | 97 NOTREACHED() << "Observer should not be added during shutdown"; |
| 110 } | 98 } |
| 111 virtual void RemoveObserver(gfx::DisplayObserver* observer) override { | 99 void RemoveObserver(gfx::DisplayObserver* observer) override {} |
| 112 } | |
| 113 | 100 |
| 114 private: | 101 private: |
| 115 const std::vector<gfx::Display> display_list_; | 102 const std::vector<gfx::Display> display_list_; |
| 116 const gfx::Display primary_display_; | 103 const gfx::Display primary_display_; |
| 117 | 104 |
| 118 DISALLOW_COPY_AND_ASSIGN(ScreenForShutdown); | 105 DISALLOW_COPY_AND_ASSIGN(ScreenForShutdown); |
| 119 }; | 106 }; |
| 120 | 107 |
| 121 } // namespace | 108 } // namespace |
| 122 | 109 |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 273 | 260 |
| 274 void ScreenAsh::RemoveObserver(gfx::DisplayObserver* observer) { | 261 void ScreenAsh::RemoveObserver(gfx::DisplayObserver* observer) { |
| 275 observers_.RemoveObserver(observer); | 262 observers_.RemoveObserver(observer); |
| 276 } | 263 } |
| 277 | 264 |
| 278 gfx::Screen* ScreenAsh::CloneForShutdown() { | 265 gfx::Screen* ScreenAsh::CloneForShutdown() { |
| 279 return new ScreenForShutdown(this); | 266 return new ScreenForShutdown(this); |
| 280 } | 267 } |
| 281 | 268 |
| 282 } // namespace ash | 269 } // namespace ash |
| OLD | NEW |