| Index: ash/wm/window_maximize.h
|
| diff --git a/ash/wm/window_maximize.h b/ash/wm/window_maximize.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..b3e3672b86107cd07540cd36b0d68dc104f517de
|
| --- /dev/null
|
| +++ b/ash/wm/window_maximize.h
|
| @@ -0,0 +1,123 @@
|
| +// Copyright (c) 2012 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_WINDOW_MAXIMIZE_H_
|
| +#define ASH_WM_WINDOW_MAXIMIZE_H_
|
| +
|
| +#include "ash/ash_export.h"
|
| +#include "ash/wm/workspace/frame_maximize_button.h"
|
| +#include "base/memory/scoped_ptr.h"
|
| +#include "ui/aura/event_filter.h"
|
| +
|
| +namespace base {
|
| + class Timer;
|
| +}
|
| +
|
| +namespace views {
|
| + class RadialMenu;
|
| +}
|
| +
|
| +namespace ash {
|
| +
|
| +// A class which shows a helper UI for the maximize button. This menu is either
|
| +// - showing a bubble showing three buttons and a help.
|
| +// - a helo menu (experimental behind a flag).
|
| +// The menu gets created every time after an initial delay. The delay can be
|
| +// reset through a function.
|
| +// Note: The EventFilter dependency is only part of the radial menu and will
|
| +// only be used to track mouse movement when the radial menu is shown. This is
|
| +// needed to update the menu in case of a non pressed mouse move.
|
| +class ASH_EXPORT MaximizeBubble : public aura::EventFilter {
|
| + public:
|
| + explicit MaximizeBubble(FrameMaximizeButton* frame_maximize_button,
|
| + bool is_maximized);
|
| + // Called from the outside to destroy the interface to the menu and
|
| + // the menu itself will delete itself then.
|
| + virtual ~MaximizeBubble();
|
| +
|
| + // Update the visible menu to reflect the previewed |snap_type| snapping
|
| + // state.
|
| + void SetMenuState(FrameMaximizeButton::SnapType snap_type);
|
| +
|
| + // Return a window handle underneath the snap animation window should
|
| + // operate.
|
| + aura::Window* GetMenuWindow();
|
| +
|
| + // Reset the delay of the menu creation to the beg.
|
| + void DelayCreation();
|
| +
|
| + // These functions below to the protected section were added for the
|
| + // experimental radial menu.
|
| +
|
| + // Returns true when the radial menu is turned on
|
| + bool IsRadialMenu();
|
| +
|
| + // Update the menu status and returns true if menu got hit and a |code|
|
| + // will be set accordingly.
|
| + bool SnapTypeForLocation(const gfx::Point& pt,
|
| + FrameMaximizeButton::SnapType& type);
|
| +
|
| + // EventFilter overrides:
|
| + virtual bool PreHandleKeyEvent(aura::Window* target,
|
| + aura::KeyEvent* event) OVERRIDE;
|
| + virtual bool PreHandleMouseEvent(aura::Window* target,
|
| + aura::MouseEvent* event) OVERRIDE;
|
| + virtual ui::TouchStatus PreHandleTouchEvent(aura::Window* target,
|
| + aura::TouchEvent* event) OVERRIDE;
|
| + virtual ui::GestureStatus PreHandleGestureEvent(aura::Window* target,
|
| + aura::GestureEvent* event) OVERRIDE;
|
| +
|
| + protected:
|
| + FrameMaximizeButton* frame_maximize_button() {
|
| + return frame_maximize_button_;
|
| + }
|
| +
|
| + // Called from the menu: Hide the bubble (and destroy).
|
| + void Close();
|
| +
|
| + // Called when a button was clicked.
|
| + void OnButtonClicked(FrameMaximizeButton::SnapType snap_type);
|
| +
|
| + // Tell the owner that the hover status for a button has changed.
|
| + // |snap_type| can be either SNAP_LEFT, SNAP_RIGHT, SNAP_MINIMIZE or
|
| + // SNAP_NONE.
|
| + void OnButtonHover(FrameMaximizeButton::SnapType snap_type);
|
| +
|
| + private:
|
| + class Bubble;
|
| + class BubbleContentsView;
|
| + class BubbleContentsButtonRow;
|
| + class BubbleMenuButton;
|
| +
|
| + // The function which creates the bubble once the delay is elapsed.
|
| + void DelayedBubbleCreation();
|
| +
|
| + // The status of the associated window: Maximized or normal.
|
| + bool is_maximized() { return is_maximized_; }
|
| +
|
| + // The owning button which is also the anchor for the menu.
|
| + FrameMaximizeButton* frame_maximize_button_;
|
| +
|
| + // The bubble menu.
|
| + Bubble* bubble_;
|
| +
|
| + // The alternative radial menu.
|
| + views::RadialMenu* radial_menu_;
|
| +
|
| + // The snap type which was set by the user's mouse movement (when in
|
| + // hover mode and no button was clicked).
|
| + FrameMaximizeButton::SnapType current_radial_snap_hover_type_;
|
| +
|
| + // If true the owning window is maximized.
|
| + const bool is_maximized_;
|
| +
|
| + // The timer for the delayed creation of the menu.
|
| + scoped_ptr<base::Timer> timer_;
|
| +
|
| + DISALLOW_COPY_AND_ASSIGN(MaximizeBubble);
|
| +};
|
| +
|
| +} // namespace ash
|
| +
|
| +#endif // ASH_WM_WINDOW_MAXIMIZE_H_
|
|
|