Chromium Code Reviews| 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..f9eef37861fc7b621e0c392fb811f69e30e5ae4f |
| --- /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 screen. |
| +// TODO(pkotwicz): Auto hide the buttons when they are not in use and reveal |
|
James Cook
2013/10/02 21:07:55
Just to double-check, are we sure we want to hide
pkotwicz
2013/10/03 20:45:35
I think that we are sure that we want to hide the
|
| +// them when the user hovers at the top edge of the screen. (crbug.com/297181). |
| +class ASH_EXPORT HideableCaptionButtonContainer : public views::WidgetObserver { |
|
pkotwicz
2013/10/02 19:41:49
Do you have a suggestion for a better class name?
James Cook
2013/10/02 21:07:55
HideableCaptionButtonController? Or just keep it
pkotwicz
2013/10/03 20:45:35
HideableCaptionButtonContainer it is then.
|
| + public: |
| + static const char kButtonWindowName[]; // visible for test |
| + |
| + // |background_id| is the idr of the image to use as the background. |
|
James Cook
2013/10/02 21:07:55
idr -> "resource id" or "IDR resource id"
pkotwicz
2013/10/03 20:45:35
Done.
|
| + // |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 idr 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_ |