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 ASH_SHELL_WINDOW_TYPE_LAUNCHER_H_
6 #define ASH_SHELL_WINDOW_TYPE_LAUNCHER_H_
8 #include "ui/views/context_menu_controller.h"
9 #include "ui/views/controls/button/button.h"
10 #include "ui/views/controls/menu/menu_delegate.h"
11 #include "ui/views/widget/widget_delegate.h"
21 // The contents view/delegate of a window that shows some buttons that create
22 // various window types.
23 class WindowTypeLauncher
: public views::WidgetDelegateView
,
24 public views::ButtonListener
,
25 public views::MenuDelegate
,
26 public views::ContextMenuController
{
29 ~WindowTypeLauncher() override
;
32 typedef std::pair
<aura::Window
*, gfx::Rect
> WindowAndBoundsPair
;
35 COMMAND_NEW_WINDOW
= 1,
36 COMMAND_TOGGLE_FULLSCREEN
= 3,
39 // Overridden from views::View:
40 void OnPaint(gfx::Canvas
* canvas
) override
;
41 bool OnMousePressed(const ui::MouseEvent
& event
) override
;
43 // Overridden from views::WidgetDelegate:
44 views::View
* GetContentsView() override
;
45 bool CanResize() const override
;
46 base::string16
GetWindowTitle() const override
;
47 bool CanMaximize() const override
;
48 bool CanMinimize() const override
;
50 // Overridden from views::ButtonListener:
51 void ButtonPressed(views::Button
* sender
, const ui::Event
& event
) override
;
53 // Overridden from views::MenuDelegate:
54 void ExecuteCommand(int id
, int event_flags
) override
;
56 // Override from views::ContextMenuController:
57 void ShowContextMenuForView(views::View
* source
,
58 const gfx::Point
& point
,
59 ui::MenuSourceType source_type
) override
;
61 views::LabelButton
* create_button_
;
62 views::LabelButton
* panel_button_
;
63 views::LabelButton
* create_nonresizable_button_
;
64 views::LabelButton
* bubble_button_
;
65 views::LabelButton
* lock_button_
;
66 views::LabelButton
* widgets_button_
;
67 views::LabelButton
* system_modal_button_
;
68 views::LabelButton
* window_modal_button_
;
69 views::LabelButton
* child_modal_button_
;
70 views::LabelButton
* transient_button_
;
71 views::LabelButton
* examples_button_
;
72 views::LabelButton
* show_hide_window_button_
;
73 views::LabelButton
* show_web_notification_
;
74 scoped_ptr
<views::MenuRunner
> menu_runner_
;
76 DISALLOW_COPY_AND_ASSIGN(WindowTypeLauncher
);
82 #endif // ASH_SHELL_WINDOW_TYPE_LAUNCHER_H_