app_list_dialog_container.h revision 03b57e008b61dfcb1fbad3aea950ae0e001748b0
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_CONTAINER_H_
6#define CHROME_BROWSER_UI_VIEWS_APP_LIST_APP_LIST_DIALOG_CONTAINER_H_
7
8#include "ui/views/controls/button/button.h"
9#include "ui/views/window/dialog_delegate.h"
10
11namespace views {
12class LabelButton;
13class Widget;
14}
15
16// The contents view for an App List Dialog, which covers the entire app list
17// and adds a close button.
18class AppListDialogContainer : public views::DialogDelegateView,
19                               public views::ButtonListener {
20 public:
21  // Creates a new AppListDialogContainer. Takes ownership of |dialog_body|.
22  AppListDialogContainer(views::View* dialog_body,
23                         const base::Closure& close_callback);
24  virtual ~AppListDialogContainer();
25
26  // Overridden from views::View:
27  virtual void Layout() OVERRIDE;
28
29  // Overridden from views::WidgetDelegate:
30  virtual views::View* GetInitiallyFocusedView() OVERRIDE;
31  virtual views::View* GetContentsView() OVERRIDE;
32  virtual views::ClientView* CreateClientView(views::Widget* widget) OVERRIDE;
33  virtual views::NonClientFrameView* CreateNonClientFrameView(
34      views::Widget* widget) OVERRIDE;
35
36  // Overridden from views::ButtonListener:
37  virtual void ButtonPressed(views::Button* sender,
38                             const ui::Event& event) OVERRIDE;
39
40 protected:
41  // Overridden from views::WidgetDelegate:
42  virtual ui::ModalType GetModalType() const OVERRIDE;
43  virtual void WindowClosing() OVERRIDE;
44
45 private:
46  views::View* dialog_body_;  // Owned by this class via the views hierarchy.
47  const base::Closure close_callback_;
48
49  views::LabelButton* close_button_;
50
51  DISALLOW_COPY_AND_ASSIGN(AppListDialogContainer);
52};
53
54#endif  // CHROME_BROWSER_UI_VIEWS_APP_LIST_APP_LIST_DIALOG_CONTAINER_H_
55