| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "chromecast/graphics/cast_screen.h" | 5 #include "chromecast/graphics/cast_screen.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include "ui/aura/env.h" | 9 #include "ui/aura/env.h" |
| 10 #include "ui/gfx/geometry/rect_conversions.h" | 10 #include "ui/gfx/geometry/rect_conversions.h" |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 // the size can be updated when we have actual display info at hand with | 26 // the size can be updated when we have actual display info at hand with |
| 27 // UpdateDisplaySize(). | 27 // UpdateDisplaySize(). |
| 28 const int kInitDisplayWidth = k720pWidth; | 28 const int kInitDisplayWidth = k720pWidth; |
| 29 const int kInitDisplayHeight = k720pHeight; | 29 const int kInitDisplayHeight = k720pHeight; |
| 30 | 30 |
| 31 } // namespace | 31 } // namespace |
| 32 | 32 |
| 33 CastScreen::~CastScreen() { | 33 CastScreen::~CastScreen() { |
| 34 } | 34 } |
| 35 | 35 |
| 36 void CastScreen::SetDisplayResizeCallback(const DisplayResizeCallback& cb) { |
| 37 DCHECK(!cb.is_null()); |
| 38 display_resize_cb_ = cb; |
| 39 } |
| 40 |
| 36 void CastScreen::UpdateDisplaySize(const gfx::Size& size) { | 41 void CastScreen::UpdateDisplaySize(const gfx::Size& size) { |
| 37 display_.SetScaleAndBounds(1.0f, gfx::Rect(size)); | 42 display_.SetScaleAndBounds(1.0f, gfx::Rect(size)); |
| 43 if (!display_resize_cb_.is_null()) |
| 44 display_resize_cb_.Run(Size(size.width(), size.height())); |
| 38 } | 45 } |
| 39 | 46 |
| 40 gfx::Point CastScreen::GetCursorScreenPoint() { | 47 gfx::Point CastScreen::GetCursorScreenPoint() { |
| 41 return aura::Env::GetInstance()->last_mouse_location(); | 48 return aura::Env::GetInstance()->last_mouse_location(); |
| 42 } | 49 } |
| 43 | 50 |
| 44 gfx::NativeWindow CastScreen::GetWindowUnderCursor() { | 51 gfx::NativeWindow CastScreen::GetWindowUnderCursor() { |
| 45 NOTIMPLEMENTED(); | 52 NOTIMPLEMENTED(); |
| 46 return gfx::NativeWindow(nullptr); | 53 return gfx::NativeWindow(nullptr); |
| 47 } | 54 } |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 | 87 |
| 81 void CastScreen::RemoveObserver(gfx::DisplayObserver* observer) { | 88 void CastScreen::RemoveObserver(gfx::DisplayObserver* observer) { |
| 82 } | 89 } |
| 83 | 90 |
| 84 CastScreen::CastScreen() : display_(kDisplayId) { | 91 CastScreen::CastScreen() : display_(kDisplayId) { |
| 85 display_.SetScaleAndBounds(1.0f, | 92 display_.SetScaleAndBounds(1.0f, |
| 86 gfx::Rect(kInitDisplayWidth, kInitDisplayHeight)); | 93 gfx::Rect(kInitDisplayWidth, kInitDisplayHeight)); |
| 87 } | 94 } |
| 88 | 95 |
| 89 } // namespace chromecast | 96 } // namespace chromecast |
| OLD | NEW |