| 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 #ifndef UI_WM_PUBLIC_SCOPED_DRAG_DROP_DISABLER_H_ | 5 #ifndef UI_WM_PUBLIC_SCOPED_DRAG_DROP_DISABLER_H_ |
| 6 #define UI_WM_PUBLIC_SCOPED_DRAG_DROP_DISABLER_H_ | 6 #define UI_WM_PUBLIC_SCOPED_DRAG_DROP_DISABLER_H_ |
| 7 | 7 |
| 8 #include <memory> |
| 9 |
| 8 #include "base/macros.h" | 10 #include "base/macros.h" |
| 9 #include "base/memory/scoped_ptr.h" | |
| 10 #include "ui/aura/window_observer.h" | 11 #include "ui/aura/window_observer.h" |
| 11 | 12 |
| 12 namespace aura { | 13 namespace aura { |
| 13 class Window; | 14 class Window; |
| 14 | 15 |
| 15 namespace client { | 16 namespace client { |
| 16 class DragDropClient; | 17 class DragDropClient; |
| 17 | 18 |
| 18 // ScopedDragDropDisabler is used to temporarily replace the drag'n'drop client | 19 // ScopedDragDropDisabler is used to temporarily replace the drag'n'drop client |
| 19 // for a window with a "no-op" client. Upon construction, it installs a new | 20 // for a window with a "no-op" client. Upon construction, it installs a new |
| 20 // client on the window, and upon destruction, it restores the previous one. | 21 // client on the window, and upon destruction, it restores the previous one. |
| 21 class AURA_EXPORT ScopedDragDropDisabler : public WindowObserver { | 22 class AURA_EXPORT ScopedDragDropDisabler : public WindowObserver { |
| 22 public: | 23 public: |
| 23 explicit ScopedDragDropDisabler(Window* window); | 24 explicit ScopedDragDropDisabler(Window* window); |
| 24 ~ScopedDragDropDisabler() override; | 25 ~ScopedDragDropDisabler() override; |
| 25 | 26 |
| 26 private: | 27 private: |
| 27 // WindowObserver: | 28 // WindowObserver: |
| 28 void OnWindowDestroyed(Window* window) override; | 29 void OnWindowDestroyed(Window* window) override; |
| 29 | 30 |
| 30 Window* window_; | 31 Window* window_; |
| 31 DragDropClient* old_client_; | 32 DragDropClient* old_client_; |
| 32 scoped_ptr<DragDropClient> new_client_; | 33 std::unique_ptr<DragDropClient> new_client_; |
| 33 | 34 |
| 34 DISALLOW_COPY_AND_ASSIGN(ScopedDragDropDisabler); | 35 DISALLOW_COPY_AND_ASSIGN(ScopedDragDropDisabler); |
| 35 }; | 36 }; |
| 36 | 37 |
| 37 } // namespace client | 38 } // namespace client |
| 38 } // namespace aura | 39 } // namespace aura |
| 39 | 40 |
| 40 #endif // UI_WM_PUBLIC_SCOPED_DRAG_DROP_DISABLER_H_ | 41 #endif // UI_WM_PUBLIC_SCOPED_DRAG_DROP_DISABLER_H_ |
| OLD | NEW |