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
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_UI_PANELS_PANEL_RESIZE_CONTROLLER_H_
6 #define CHROME_BROWSER_UI_PANELS_PANEL_RESIZE_CONTROLLER_H_
9 #include "base/basictypes.h"
10 #include "chrome/browser/ui/panels/panel_constants.h"
11 #include "ui/gfx/point.h"
12 #include "ui/gfx/rect.h"
20 // Responsible for handling resize operations initiated for all panels.
21 class PanelResizeController
{
23 explicit PanelResizeController(PanelManager
* panel_manager
);
25 // Resize the given panel.
26 // |mouse_location| is in screen coordinate system.
27 void StartResizing(Panel
* panel
,
28 const gfx::Point
& mouse_location
,
29 panel::ResizingSides sides
);
30 void Resize(const gfx::Point
& mouse_location
);
32 // Returns the panel that was resized.
33 Panel
* EndResizing(bool cancelled
);
35 // Asynchronous confirmation of panel having been closed.
36 void OnPanelClosed(Panel
* panel
);
38 bool IsResizing() const { return resizing_panel_
!= NULL
; }
41 PanelManager
* panel_manager_
; // Weak, owns us.
43 // Panel currently being resized.
44 Panel
* resizing_panel_
;
46 // Resizing at which side?
47 panel::ResizingSides sides_resized_
;
49 // The mouse location, in screen coordinates, when StartResizing
51 gfx::Point mouse_location_at_start_
;
53 // Bounds to restore the panel to if resize is cancelled.
54 gfx::Rect bounds_at_start_
;
56 DISALLOW_COPY_AND_ASSIGN(PanelResizeController
);
59 #endif // CHROME_BROWSER_UI_PANELS_PANEL_RESIZE_CONTROLLER_H_