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
3 // found in the LICENSE file.
5 #ifndef UI_WM_PUBLIC_SCOPED_DRAG_DROP_DISABLER_H_
6 #define UI_WM_PUBLIC_SCOPED_DRAG_DROP_DISABLER_H_
8 #include "base/macros.h"
9 #include "base/memory/scoped_ptr.h"
10 #include "ui/aura/window_observer.h"
18 // 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 // client on the window, and upon destruction, it restores the previous one.
21 class AURA_EXPORT ScopedDragDropDisabler
: public WindowObserver
{
23 explicit ScopedDragDropDisabler(Window
* window
);
24 ~ScopedDragDropDisabler() override
;
28 void OnWindowDestroyed(Window
* window
) override
;
31 DragDropClient
* old_client_
;
32 scoped_ptr
<DragDropClient
> new_client_
;
34 DISALLOW_COPY_AND_ASSIGN(ScopedDragDropDisabler
);
40 #endif // UI_WM_PUBLIC_SCOPED_DRAG_DROP_DISABLER_H_