| 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" |
| 11 #include "ash/shell_window_ids.h" | 11 #include "ash/shell_window_ids.h" |
| 12 #include "ui/aura/env.h" | 12 #include "ui/aura/env.h" |
| 13 #include "ui/aura/window_delegate.h" | 13 #include "ui/aura/window_delegate.h" |
| 14 #include "ui/aura/window_event_dispatcher.h" | 14 #include "ui/aura/window_event_dispatcher.h" |
| 15 #include "ui/base/cursor/cursors_aura.h" | 15 #include "ui/base/cursor/cursors_aura.h" |
| 16 #include "ui/base/hit_test.h" | 16 #include "ui/base/hit_test.h" |
| 17 #include "ui/base/resource/resource_bundle.h" | 17 #include "ui/base/resource/resource_bundle.h" |
| 18 #include "ui/compositor/dip_util.h" | 18 #include "ui/compositor/dip_util.h" |
| 19 #include "ui/compositor/paint_recorder.h" |
| 19 #include "ui/gfx/canvas.h" | 20 #include "ui/gfx/canvas.h" |
| 20 #include "ui/gfx/display.h" | 21 #include "ui/gfx/display.h" |
| 21 #include "ui/gfx/image/image_skia.h" | 22 #include "ui/gfx/image/image_skia.h" |
| 22 #include "ui/gfx/image/image_skia_operations.h" | 23 #include "ui/gfx/image/image_skia_operations.h" |
| 23 | 24 |
| 24 namespace ash { | 25 namespace ash { |
| 25 | 26 |
| 26 class CursorWindowDelegate : public aura::WindowDelegate { | 27 class CursorWindowDelegate : public aura::WindowDelegate { |
| 27 public: | 28 public: |
| 28 CursorWindowDelegate() : is_cursor_compositing_enabled_(false) {} | 29 CursorWindowDelegate() : is_cursor_compositing_enabled_(false) {} |
| (...skipping 13 matching lines...) Expand all Loading... |
| 42 } | 43 } |
| 43 bool ShouldDescendIntoChildForEventHandling( | 44 bool ShouldDescendIntoChildForEventHandling( |
| 44 aura::Window* child, | 45 aura::Window* child, |
| 45 const gfx::Point& location) override { | 46 const gfx::Point& location) override { |
| 46 return false; | 47 return false; |
| 47 } | 48 } |
| 48 bool CanFocus() override { return false; } | 49 bool CanFocus() override { return false; } |
| 49 void OnCaptureLost() override {} | 50 void OnCaptureLost() override {} |
| 50 void OnPaintToDisplayList(cc::DisplayItemList* list, | 51 void OnPaintToDisplayList(cc::DisplayItemList* list, |
| 51 float device_scale_factor) override { | 52 float device_scale_factor) override { |
| 52 // TODO(danakj): Implement it. Does this need to be the same as | 53 gfx::Rect record_bounds(size_); |
| 53 // View::OnPaintLayerToDisplayList? Can they share code? | 54 ui::PaintRecorder recorder(record_bounds, device_scale_factor); |
| 54 NOTIMPLEMENTED(); | 55 OnPaint(recorder.canvas()); |
| 56 recorder.AppendDisplayItem(list); |
| 55 } | 57 } |
| 56 void OnPaint(gfx::Canvas* canvas) override { | 58 void OnPaint(gfx::Canvas* canvas) override { |
| 57 canvas->DrawImageInt(cursor_image_, 0, 0); | 59 canvas->DrawImageInt(cursor_image_, 0, 0); |
| 58 } | 60 } |
| 59 void OnDeviceScaleFactorChanged(float device_scale_factor) override {} | 61 void OnDeviceScaleFactorChanged(float device_scale_factor) override {} |
| 60 void OnWindowDestroying(aura::Window* window) override {} | 62 void OnWindowDestroying(aura::Window* window) override {} |
| 61 void OnWindowDestroyed(aura::Window* window) override {} | 63 void OnWindowDestroyed(aura::Window* window) override {} |
| 62 void OnWindowTargetVisibilityChanged(bool visible) override {} | 64 void OnWindowTargetVisibilityChanged(bool visible) override {} |
| 63 bool HasHitTestMask() const override { return false; } | 65 bool HasHitTestMask() const override { return false; } |
| 64 void GetHitTestMask(gfx::Path* mask) const override {} | 66 void GetHitTestMask(gfx::Path* mask) const override {} |
| (...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 275 if (!cursor_window_) | 277 if (!cursor_window_) |
| 276 return; | 278 return; |
| 277 bool visible = (visible_ && cursor_type_ != ui::kCursorNone); | 279 bool visible = (visible_ && cursor_type_ != ui::kCursorNone); |
| 278 if (visible) | 280 if (visible) |
| 279 cursor_window_->Show(); | 281 cursor_window_->Show(); |
| 280 else | 282 else |
| 281 cursor_window_->Hide(); | 283 cursor_window_->Hide(); |
| 282 } | 284 } |
| 283 | 285 |
| 284 } // namespace ash | 286 } // namespace ash |
| OLD | NEW |