| 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 bool IsDIPEnabled() OVERRIDE { | 74 virtual bool IsDIPEnabled() override { |
| 75 return true; | 75 return true; |
| 76 } | 76 } |
| 77 virtual gfx::Point GetCursorScreenPoint() OVERRIDE { | 77 virtual gfx::Point GetCursorScreenPoint() override { |
| 78 return gfx::Point(); | 78 return gfx::Point(); |
| 79 } | 79 } |
| 80 virtual gfx::NativeWindow GetWindowUnderCursor() OVERRIDE { | 80 virtual gfx::NativeWindow GetWindowUnderCursor() override { |
| 81 return NULL; | 81 return NULL; |
| 82 } | 82 } |
| 83 virtual gfx::NativeWindow GetWindowAtScreenPoint( | 83 virtual gfx::NativeWindow GetWindowAtScreenPoint( |
| 84 const gfx::Point& point) OVERRIDE { | 84 const gfx::Point& point) override { |
| 85 return NULL; | 85 return NULL; |
| 86 } | 86 } |
| 87 virtual int GetNumDisplays() const OVERRIDE { | 87 virtual int GetNumDisplays() const override { |
| 88 return display_list_.size(); | 88 return display_list_.size(); |
| 89 } | 89 } |
| 90 virtual std::vector<gfx::Display> GetAllDisplays() const OVERRIDE { | 90 virtual std::vector<gfx::Display> GetAllDisplays() const override { |
| 91 return display_list_; | 91 return display_list_; |
| 92 } | 92 } |
| 93 virtual gfx::Display GetDisplayNearestWindow(gfx::NativeView view) | 93 virtual gfx::Display GetDisplayNearestWindow(gfx::NativeView view) |
| 94 const OVERRIDE { | 94 const override { |
| 95 return primary_display_; | 95 return primary_display_; |
| 96 } | 96 } |
| 97 virtual gfx::Display GetDisplayNearestPoint( | 97 virtual gfx::Display GetDisplayNearestPoint( |
| 98 const gfx::Point& point) const OVERRIDE { | 98 const gfx::Point& point) const override { |
| 99 return FindDisplayNearestPoint(display_list_, point); | 99 return FindDisplayNearestPoint(display_list_, point); |
| 100 } | 100 } |
| 101 virtual gfx::Display GetDisplayMatching(const gfx::Rect& match_rect) | 101 virtual gfx::Display GetDisplayMatching(const gfx::Rect& match_rect) |
| 102 const OVERRIDE { | 102 const override { |
| 103 const gfx::Display* matching = | 103 const gfx::Display* matching = |
| 104 FindDisplayMatching(display_list_, match_rect); | 104 FindDisplayMatching(display_list_, match_rect); |
| 105 // Fallback to the primary display if there is no matching display. | 105 // Fallback to the primary display if there is no matching display. |
| 106 return matching ? *matching : GetPrimaryDisplay(); | 106 return matching ? *matching : GetPrimaryDisplay(); |
| 107 } | 107 } |
| 108 virtual gfx::Display GetPrimaryDisplay() const OVERRIDE { | 108 virtual gfx::Display GetPrimaryDisplay() const override { |
| 109 return primary_display_; | 109 return primary_display_; |
| 110 } | 110 } |
| 111 virtual void AddObserver(gfx::DisplayObserver* observer) OVERRIDE { | 111 virtual void AddObserver(gfx::DisplayObserver* observer) override { |
| 112 NOTREACHED() << "Observer should not be added during shutdown"; | 112 NOTREACHED() << "Observer should not be added during shutdown"; |
| 113 } | 113 } |
| 114 virtual void RemoveObserver(gfx::DisplayObserver* observer) OVERRIDE { | 114 virtual void RemoveObserver(gfx::DisplayObserver* observer) override { |
| 115 } | 115 } |
| 116 | 116 |
| 117 private: | 117 private: |
| 118 const std::vector<gfx::Display> display_list_; | 118 const std::vector<gfx::Display> display_list_; |
| 119 const gfx::Display primary_display_; | 119 const gfx::Display primary_display_; |
| 120 | 120 |
| 121 DISALLOW_COPY_AND_ASSIGN(ScreenForShutdown); | 121 DISALLOW_COPY_AND_ASSIGN(ScreenForShutdown); |
| 122 }; | 122 }; |
| 123 | 123 |
| 124 } // namespace | 124 } // namespace |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 280 | 280 |
| 281 void ScreenAsh::RemoveObserver(gfx::DisplayObserver* observer) { | 281 void ScreenAsh::RemoveObserver(gfx::DisplayObserver* observer) { |
| 282 observers_.RemoveObserver(observer); | 282 observers_.RemoveObserver(observer); |
| 283 } | 283 } |
| 284 | 284 |
| 285 gfx::Screen* ScreenAsh::CloneForShutdown() { | 285 gfx::Screen* ScreenAsh::CloneForShutdown() { |
| 286 return new ScreenForShutdown(this); | 286 return new ScreenForShutdown(this); |
| 287 } | 287 } |
| 288 | 288 |
| 289 } // namespace ash | 289 } // namespace ash |
| OLD | NEW |