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/cursor_window_controller.h" | 5 #include "ash/display/cursor_window_controller.h" |
6 | 6 |
7 #include "ash/ash_constants.h" | 7 #include "ash/ash_constants.h" |
8 #include "ash/display/mirror_window_controller.h" | 8 #include "ash/display/mirror_window_controller.h" |
9 #include "ash/display/window_tree_host_manager.h" | 9 #include "ash/display/window_tree_host_manager.h" |
10 #include "ash/public/cpp/shell_window_ids.h" | 10 #include "ash/public/cpp/shell_window_ids.h" |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 private: | 81 private: |
82 gfx::ImageSkia cursor_image_; | 82 gfx::ImageSkia cursor_image_; |
83 gfx::Size size_; | 83 gfx::Size size_; |
84 | 84 |
85 DISALLOW_COPY_AND_ASSIGN(CursorWindowDelegate); | 85 DISALLOW_COPY_AND_ASSIGN(CursorWindowDelegate); |
86 }; | 86 }; |
87 | 87 |
88 CursorWindowController::CursorWindowController() | 88 CursorWindowController::CursorWindowController() |
89 : is_cursor_compositing_enabled_(false), | 89 : is_cursor_compositing_enabled_(false), |
90 container_(NULL), | 90 container_(NULL), |
91 cursor_type_(ui::kCursorNone), | 91 cursor_type_(ui::CursorType::kNone), |
92 visible_(true), | 92 visible_(true), |
93 cursor_set_(ui::CURSOR_SET_NORMAL), | 93 cursor_set_(ui::CURSOR_SET_NORMAL), |
94 large_cursor_size_in_dip_(ash::kDefaultLargeCursorSize), | 94 large_cursor_size_in_dip_(ash::kDefaultLargeCursorSize), |
95 delegate_(new CursorWindowDelegate()) { | 95 delegate_(new CursorWindowDelegate()) {} |
96 } | |
97 | 96 |
98 CursorWindowController::~CursorWindowController() { | 97 CursorWindowController::~CursorWindowController() { |
99 SetContainer(NULL); | 98 SetContainer(NULL); |
100 } | 99 } |
101 | 100 |
102 void CursorWindowController::SetLargeCursorSizeInDip( | 101 void CursorWindowController::SetLargeCursorSizeInDip( |
103 int large_cursor_size_in_dip) { | 102 int large_cursor_size_in_dip) { |
104 large_cursor_size_in_dip = | 103 large_cursor_size_in_dip = |
105 std::min(large_cursor_size_in_dip, kMaxLargeCursorSize); | 104 std::min(large_cursor_size_in_dip, kMaxLargeCursorSize); |
106 large_cursor_size_in_dip = | 105 large_cursor_size_in_dip = |
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
313 cursor_window_->SetBounds(gfx::Rect(delegate_->size())); | 312 cursor_window_->SetBounds(gfx::Rect(delegate_->size())); |
314 cursor_window_->SchedulePaintInRect( | 313 cursor_window_->SchedulePaintInRect( |
315 gfx::Rect(cursor_window_->bounds().size())); | 314 gfx::Rect(cursor_window_->bounds().size())); |
316 UpdateLocation(); | 315 UpdateLocation(); |
317 } | 316 } |
318 } | 317 } |
319 | 318 |
320 void CursorWindowController::UpdateCursorVisibility() { | 319 void CursorWindowController::UpdateCursorVisibility() { |
321 if (!cursor_window_) | 320 if (!cursor_window_) |
322 return; | 321 return; |
323 bool visible = (visible_ && cursor_type_ != ui::kCursorNone); | 322 bool visible = (visible_ && cursor_type_ != ui::CursorType::kNone); |
324 if (visible) | 323 if (visible) |
325 cursor_window_->Show(); | 324 cursor_window_->Show(); |
326 else | 325 else |
327 cursor_window_->Hide(); | 326 cursor_window_->Hide(); |
328 } | 327 } |
329 | 328 |
330 const gfx::ImageSkia& CursorWindowController::GetCursorImageForTest() const { | 329 const gfx::ImageSkia& CursorWindowController::GetCursorImageForTest() const { |
331 return delegate_->cursor_image(); | 330 return delegate_->cursor_image(); |
332 } | 331 } |
333 | 332 |
334 } // namespace ash | 333 } // namespace ash |
OLD | NEW |