Index: ash/wm/caption_buttons/hideable_caption_button_container.h |
diff --git a/ash/wm/caption_buttons/hideable_caption_button_container.h b/ash/wm/caption_buttons/hideable_caption_button_container.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..fffb1165a2beb8f42388bd7ab629cf00b6cc5146 |
--- /dev/null |
+++ b/ash/wm/caption_buttons/hideable_caption_button_container.h |
@@ -0,0 +1,63 @@ |
+// Copyright 2013 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef ASH_WM_CAPTION_BUTTONS_HIDEABLE_CAPTION_BUTTON_CONTAINER_H_ |
+#define ASH_WM_CAPTION_BUTTONS_HIDEABLE_CAPTION_BUTTON_CONTAINER_H_ |
+ |
+#include "ash/ash_export.h" |
+#include "base/basictypes.h" |
+#include "base/compiler_specific.h" |
+#include "base/memory/scoped_ptr.h" |
+#include "ui/views/widget/widget_observer.h" |
+ |
+namespace views { |
+class Widget; |
+} |
+ |
+namespace ash { |
+class FrameCaptionButtonContainerView; |
+ |
+// Controller for a widget containing the caption buttons which sits in the top |
+// right corner of the workspace. |
+// TODO(pkotwicz): Auto hide the buttons when they are not in use and reveal |
+// them when the user hovers at the top edge of the screen. (crbug.com/297181). |
+class ASH_EXPORT HideableCaptionButtonContainer : public views::WidgetObserver { |
+ public: |
+ static const char kButtonWindowName[]; // visible for test |
+ |
+ // |background_id| is the resource id of the image to use as the background. |
+ // |frame| is the widget that the buttons act on. |
+ HideableCaptionButtonContainer(int background_id, views::Widget* frame); |
+ virtual ~HideableCaptionButtonContainer(); |
+ |
+ // Shows and positions the button widget. |
+ void ShowButtonWidget(); |
+ |
+ private: |
+ // Returns the bounds at which the button widget should be positioned. |
+ gfx::Rect GetButtonWidgetBounds() const; |
+ |
+ // views::WidgetObserver override: |
+ virtual void OnWidgetBoundsChanged(views::Widget* widget, |
+ const gfx::Rect& new_bounds) OVERRIDE; |
+ |
+ // The resource id of the image to use for |button_widget_|'s background. |
+ int background_id_; |
+ |
+ // Widget that the buttons act on. |
+ views::Widget* frame_; |
+ |
+ // The widget which contains the buttons. |
+ scoped_ptr<views::Widget> button_widget_; |
+ |
+ // The view in |button_widget_| which contains the buttons. It is used to |
+ // determine |button_widget_|'s size. |
+ FrameCaptionButtonContainerView* button_container_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(HideableCaptionButtonContainer); |
+}; |
+ |
+} // namespace ash |
+ |
+#endif // ASH_WM_CAPTION_BUTTONS_HIDEABLE_CAPTION_BUTTON_CONTAINER_H_ |