| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/drag_drop/drag_drop_controller.h" | 5 #include "ash/drag_drop/drag_drop_controller.h" |
| 6 | 6 |
| 7 #include "ash/drag_drop/drag_drop_tracker.h" | 7 #include "ash/drag_drop/drag_drop_tracker.h" |
| 8 #include "ash/drag_drop/drag_image_view.h" | 8 #include "ash/drag_drop/drag_image_view.h" |
| 9 #include "ash/shell.h" | 9 #include "ash/shell.h" |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 } | 74 } |
| 75 } // namespace | 75 } // namespace |
| 76 | 76 |
| 77 class DragDropTrackerDelegate : public aura::WindowDelegate { | 77 class DragDropTrackerDelegate : public aura::WindowDelegate { |
| 78 public: | 78 public: |
| 79 explicit DragDropTrackerDelegate(DragDropController* controller) | 79 explicit DragDropTrackerDelegate(DragDropController* controller) |
| 80 : drag_drop_controller_(controller) {} | 80 : drag_drop_controller_(controller) {} |
| 81 virtual ~DragDropTrackerDelegate() {} | 81 virtual ~DragDropTrackerDelegate() {} |
| 82 | 82 |
| 83 // Overridden from WindowDelegate: | 83 // Overridden from WindowDelegate: |
| 84 virtual gfx::Size GetMinimumSize() const OVERRIDE { | 84 virtual gfx::Size GetMinimumSize() const override { |
| 85 return gfx::Size(); | 85 return gfx::Size(); |
| 86 } | 86 } |
| 87 | 87 |
| 88 virtual gfx::Size GetMaximumSize() const OVERRIDE { | 88 virtual gfx::Size GetMaximumSize() const override { |
| 89 return gfx::Size(); | 89 return gfx::Size(); |
| 90 } | 90 } |
| 91 | 91 |
| 92 virtual void OnBoundsChanged(const gfx::Rect& old_bounds, | 92 virtual void OnBoundsChanged(const gfx::Rect& old_bounds, |
| 93 const gfx::Rect& new_bounds) OVERRIDE {} | 93 const gfx::Rect& new_bounds) override {} |
| 94 virtual gfx::NativeCursor GetCursor(const gfx::Point& point) OVERRIDE { | 94 virtual gfx::NativeCursor GetCursor(const gfx::Point& point) override { |
| 95 return gfx::kNullCursor; | 95 return gfx::kNullCursor; |
| 96 } | 96 } |
| 97 virtual int GetNonClientComponent(const gfx::Point& point) const OVERRIDE { | 97 virtual int GetNonClientComponent(const gfx::Point& point) const override { |
| 98 return HTCAPTION; | 98 return HTCAPTION; |
| 99 } | 99 } |
| 100 virtual bool ShouldDescendIntoChildForEventHandling( | 100 virtual bool ShouldDescendIntoChildForEventHandling( |
| 101 aura::Window* child, | 101 aura::Window* child, |
| 102 const gfx::Point& location) OVERRIDE { | 102 const gfx::Point& location) override { |
| 103 return true; | 103 return true; |
| 104 } | 104 } |
| 105 virtual bool CanFocus() OVERRIDE { return true; } | 105 virtual bool CanFocus() override { return true; } |
| 106 virtual void OnCaptureLost() OVERRIDE { | 106 virtual void OnCaptureLost() override { |
| 107 if (drag_drop_controller_->IsDragDropInProgress()) | 107 if (drag_drop_controller_->IsDragDropInProgress()) |
| 108 drag_drop_controller_->DragCancel(); | 108 drag_drop_controller_->DragCancel(); |
| 109 } | 109 } |
| 110 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE { | 110 virtual void OnPaint(gfx::Canvas* canvas) override { |
| 111 } | 111 } |
| 112 virtual void OnDeviceScaleFactorChanged(float device_scale_factor) OVERRIDE {} | 112 virtual void OnDeviceScaleFactorChanged(float device_scale_factor) override {} |
| 113 virtual void OnWindowDestroying(aura::Window* window) OVERRIDE {} | 113 virtual void OnWindowDestroying(aura::Window* window) override {} |
| 114 virtual void OnWindowDestroyed(aura::Window* window) OVERRIDE {} | 114 virtual void OnWindowDestroyed(aura::Window* window) override {} |
| 115 virtual void OnWindowTargetVisibilityChanged(bool visible) OVERRIDE {} | 115 virtual void OnWindowTargetVisibilityChanged(bool visible) override {} |
| 116 virtual bool HasHitTestMask() const OVERRIDE { | 116 virtual bool HasHitTestMask() const override { |
| 117 return true; | 117 return true; |
| 118 } | 118 } |
| 119 virtual void GetHitTestMask(gfx::Path* mask) const OVERRIDE { | 119 virtual void GetHitTestMask(gfx::Path* mask) const override { |
| 120 DCHECK(mask->isEmpty()); | 120 DCHECK(mask->isEmpty()); |
| 121 } | 121 } |
| 122 | 122 |
| 123 private: | 123 private: |
| 124 DragDropController* drag_drop_controller_; | 124 DragDropController* drag_drop_controller_; |
| 125 | 125 |
| 126 DISALLOW_COPY_AND_ASSIGN(DragDropTrackerDelegate); | 126 DISALLOW_COPY_AND_ASSIGN(DragDropTrackerDelegate); |
| 127 }; | 127 }; |
| 128 | 128 |
| 129 //////////////////////////////////////////////////////////////////////////////// | 129 //////////////////////////////////////////////////////////////////////////////// |
| (...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 556 if (drag_window_) | 556 if (drag_window_) |
| 557 drag_window_->RemoveObserver(this); | 557 drag_window_->RemoveObserver(this); |
| 558 drag_window_ = NULL; | 558 drag_window_ = NULL; |
| 559 drag_data_ = NULL; | 559 drag_data_ = NULL; |
| 560 // Cleanup can be called again while deleting DragDropTracker, so delete | 560 // Cleanup can be called again while deleting DragDropTracker, so delete |
| 561 // the pointer with a local variable to avoid double free. | 561 // the pointer with a local variable to avoid double free. |
| 562 scoped_ptr<ash::DragDropTracker> holder = drag_drop_tracker_.Pass(); | 562 scoped_ptr<ash::DragDropTracker> holder = drag_drop_tracker_.Pass(); |
| 563 } | 563 } |
| 564 | 564 |
| 565 } // namespace ash | 565 } // namespace ash |
| OLD | NEW |