OLD | NEW |
(Empty) | |
| 1 // Copyright 2013 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. |
| 4 |
| 5 #ifndef ASH_WM_CAPTION_BUTTONS_HIDEABLE_CAPTION_BUTTON_CONTAINER_H_ |
| 6 #define ASH_WM_CAPTION_BUTTONS_HIDEABLE_CAPTION_BUTTON_CONTAINER_H_ |
| 7 |
| 8 #include "ash/ash_export.h" |
| 9 #include "base/basictypes.h" |
| 10 #include "base/compiler_specific.h" |
| 11 #include "base/memory/scoped_ptr.h" |
| 12 #include "ui/views/widget/widget_observer.h" |
| 13 |
| 14 namespace views { |
| 15 class Widget; |
| 16 } |
| 17 |
| 18 namespace ash { |
| 19 class FrameCaptionButtonContainerView; |
| 20 |
| 21 // Controller for a widget containing the caption buttons which sits in the top |
| 22 // right corner of the workspace. |
| 23 // TODO(pkotwicz): Auto hide the buttons when they are not in use and reveal |
| 24 // them when the user hovers at the top edge of the screen. (crbug.com/297181). |
| 25 class ASH_EXPORT HideableCaptionButtonContainer : public views::WidgetObserver { |
| 26 public: |
| 27 static const char kButtonWindowName[]; // visible for test |
| 28 |
| 29 // |background_id| is the resource id of the image to use as the background. |
| 30 // |frame| is the widget that the buttons act on. |
| 31 HideableCaptionButtonContainer(int background_id, views::Widget* frame); |
| 32 virtual ~HideableCaptionButtonContainer(); |
| 33 |
| 34 // Shows and positions the button widget. |
| 35 void ShowButtonWidget(); |
| 36 |
| 37 private: |
| 38 // Returns the bounds at which the button widget should be positioned. |
| 39 gfx::Rect GetButtonWidgetBounds() const; |
| 40 |
| 41 // views::WidgetObserver override: |
| 42 virtual void OnWidgetBoundsChanged(views::Widget* widget, |
| 43 const gfx::Rect& new_bounds) OVERRIDE; |
| 44 |
| 45 // The resource id of the image to use for |button_widget_|'s background. |
| 46 int background_id_; |
| 47 |
| 48 // Widget that the buttons act on. |
| 49 views::Widget* frame_; |
| 50 |
| 51 // The widget which contains the buttons. |
| 52 scoped_ptr<views::Widget> button_widget_; |
| 53 |
| 54 // The view in |button_widget_| which contains the buttons. It is used to |
| 55 // determine |button_widget_|'s size. |
| 56 FrameCaptionButtonContainerView* button_container_; |
| 57 |
| 58 DISALLOW_COPY_AND_ASSIGN(HideableCaptionButtonContainer); |
| 59 }; |
| 60 |
| 61 } // namespace ash |
| 62 |
| 63 #endif // ASH_WM_CAPTION_BUTTONS_HIDEABLE_CAPTION_BUTTON_CONTAINER_H_ |
OLD | NEW |