1// Copyright 2014 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 CHROME_BROWSER_UI_VIEWS_APP_LIST_APP_LIST_DIALOG_CONTENTS_VIEW_H_
6#define CHROME_BROWSER_UI_VIEWS_APP_LIST_APP_LIST_DIALOG_CONTENTS_VIEW_H_
7
8#include "ui/views/controls/button/button.h"
9#include "ui/views/window/dialog_delegate.h"
10
11class AppListControllerDelegate;
12
13namespace views {
14class LabelButton;
15class Widget;
16}
17
18// The contents view for an App List Dialog, which covers the entire app list
19// and adds a close button.
20class AppListDialogContentsView : public views::DialogDelegateView,
21                                  public views::ButtonListener {
22 public:
23  AppListDialogContentsView(
24      AppListControllerDelegate* app_list_controller_delegate,
25      views::View* dialog_body);
26  virtual ~AppListDialogContentsView();
27
28  // Create a |dialog| window Widget with the specified |parent|. The dialog
29  // will be resized to fill the body of the app list.
30  static views::Widget* CreateDialogWidget(gfx::NativeWindow parent,
31                                           const gfx::Rect& bounds,
32                                           AppListDialogContentsView* dialog);
33
34  // Overridden from views::View:
35  virtual void Layout() OVERRIDE;
36
37  // Overridden from views::WidgetDelegate:
38  virtual views::View* GetInitiallyFocusedView() OVERRIDE;
39  virtual views::View* GetContentsView() OVERRIDE;
40  virtual views::ClientView* CreateClientView(views::Widget* widget) OVERRIDE;
41  virtual views::NonClientFrameView* CreateNonClientFrameView(
42      views::Widget* widget) OVERRIDE;
43
44  // Overridden from views::ButtonListener:
45  virtual void ButtonPressed(views::Button* sender,
46                             const ui::Event& event) OVERRIDE;
47
48 protected:
49  // Overridden from views::WidgetDelegate:
50  virtual ui::ModalType GetModalType() const OVERRIDE;
51  virtual void WindowClosing() OVERRIDE;
52
53 private:
54  // Weak. Owned by the AppListService singleton.
55  AppListControllerDelegate* app_list_controller_delegate_;
56
57  views::View* dialog_body_;
58  views::LabelButton* close_button_;
59
60  DISALLOW_COPY_AND_ASSIGN(AppListDialogContentsView);
61};
62
63#endif  // CHROME_BROWSER_UI_VIEWS_APP_LIST_APP_LIST_DIALOG_CONTENTS_VIEW_H_
64