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/display/display_controller.h" | 7 #include "ash/display/display_controller.h" |
8 #include "ash/display/mirror_window_controller.h" | 8 #include "ash/display/mirror_window_controller.h" |
9 #include "ash/root_window_controller.h" | 9 #include "ash/root_window_controller.h" |
10 #include "ash/shell.h" | 10 #include "ash/shell.h" |
(...skipping 11 matching lines...) Expand all Loading... |
22 #include "ui/gfx/image/image_skia_operations.h" | 22 #include "ui/gfx/image/image_skia_operations.h" |
23 | 23 |
24 namespace ash { | 24 namespace ash { |
25 | 25 |
26 class CursorWindowDelegate : public aura::WindowDelegate { | 26 class CursorWindowDelegate : public aura::WindowDelegate { |
27 public: | 27 public: |
28 CursorWindowDelegate() : is_cursor_compositing_enabled_(false) {} | 28 CursorWindowDelegate() : is_cursor_compositing_enabled_(false) {} |
29 virtual ~CursorWindowDelegate() {} | 29 virtual ~CursorWindowDelegate() {} |
30 | 30 |
31 // aura::WindowDelegate overrides: | 31 // aura::WindowDelegate overrides: |
32 virtual gfx::Size GetMinimumSize() const OVERRIDE { return size_; } | 32 virtual gfx::Size GetMinimumSize() const override { return size_; } |
33 virtual gfx::Size GetMaximumSize() const OVERRIDE { return size_; } | 33 virtual gfx::Size GetMaximumSize() const override { return size_; } |
34 virtual void OnBoundsChanged(const gfx::Rect& old_bounds, | 34 virtual void OnBoundsChanged(const gfx::Rect& old_bounds, |
35 const gfx::Rect& new_bounds) OVERRIDE {} | 35 const gfx::Rect& new_bounds) override {} |
36 virtual gfx::NativeCursor GetCursor(const gfx::Point& point) OVERRIDE { | 36 virtual gfx::NativeCursor GetCursor(const gfx::Point& point) override { |
37 return gfx::kNullCursor; | 37 return gfx::kNullCursor; |
38 } | 38 } |
39 virtual int GetNonClientComponent( | 39 virtual int GetNonClientComponent( |
40 const gfx::Point& point) const OVERRIDE { | 40 const gfx::Point& point) const override { |
41 return HTNOWHERE; | 41 return HTNOWHERE; |
42 } | 42 } |
43 virtual bool ShouldDescendIntoChildForEventHandling( | 43 virtual bool ShouldDescendIntoChildForEventHandling( |
44 aura::Window* child, | 44 aura::Window* child, |
45 const gfx::Point& location) OVERRIDE { | 45 const gfx::Point& location) override { |
46 return false; | 46 return false; |
47 } | 47 } |
48 virtual bool CanFocus() OVERRIDE { return false; } | 48 virtual bool CanFocus() override { return false; } |
49 virtual void OnCaptureLost() OVERRIDE {} | 49 virtual void OnCaptureLost() override {} |
50 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE { | 50 virtual void OnPaint(gfx::Canvas* canvas) override { |
51 canvas->DrawImageInt(cursor_image_, 0, 0); | 51 canvas->DrawImageInt(cursor_image_, 0, 0); |
52 } | 52 } |
53 virtual void OnDeviceScaleFactorChanged( | 53 virtual void OnDeviceScaleFactorChanged( |
54 float device_scale_factor) OVERRIDE {} | 54 float device_scale_factor) override {} |
55 virtual void OnWindowDestroying(aura::Window* window) OVERRIDE {} | 55 virtual void OnWindowDestroying(aura::Window* window) override {} |
56 virtual void OnWindowDestroyed(aura::Window* window) OVERRIDE {} | 56 virtual void OnWindowDestroyed(aura::Window* window) override {} |
57 virtual void OnWindowTargetVisibilityChanged(bool visible) OVERRIDE {} | 57 virtual void OnWindowTargetVisibilityChanged(bool visible) override {} |
58 virtual bool HasHitTestMask() const OVERRIDE { return false; } | 58 virtual bool HasHitTestMask() const override { return false; } |
59 virtual void GetHitTestMask(gfx::Path* mask) const OVERRIDE {} | 59 virtual void GetHitTestMask(gfx::Path* mask) const override {} |
60 | 60 |
61 // Sets cursor compositing mode on/off. | 61 // Sets cursor compositing mode on/off. |
62 void SetCursorCompositingEnabled(bool enabled) { | 62 void SetCursorCompositingEnabled(bool enabled) { |
63 is_cursor_compositing_enabled_ = enabled; | 63 is_cursor_compositing_enabled_ = enabled; |
64 } | 64 } |
65 | 65 |
66 // Sets the cursor image for the |display|'s scale factor. | 66 // Sets the cursor image for the |display|'s scale factor. |
67 void SetCursorImage(const gfx::ImageSkia& image, | 67 void SetCursorImage(const gfx::ImageSkia& image, |
68 const gfx::Display& display) { | 68 const gfx::Display& display) { |
69 float scale_factor = display.device_scale_factor(); | 69 float scale_factor = display.device_scale_factor(); |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
258 delegate_->SetCursorImage(rotated, display_); | 258 delegate_->SetCursorImage(rotated, display_); |
259 if (cursor_window_) { | 259 if (cursor_window_) { |
260 cursor_window_->SetBounds(gfx::Rect(delegate_->size())); | 260 cursor_window_->SetBounds(gfx::Rect(delegate_->size())); |
261 cursor_window_->SchedulePaintInRect( | 261 cursor_window_->SchedulePaintInRect( |
262 gfx::Rect(cursor_window_->bounds().size())); | 262 gfx::Rect(cursor_window_->bounds().size())); |
263 UpdateLocation(); | 263 UpdateLocation(); |
264 } | 264 } |
265 } | 265 } |
266 | 266 |
267 } // namespace ash | 267 } // namespace ash |
OLD | NEW |