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.
5 #ifndef CHROME_BROWSER_UI_VIEWS_EXTENSIONS_BOOKMARK_APP_BUBBLE_VIEW_H_
6 #define CHROME_BROWSER_UI_VIEWS_EXTENSIONS_BOOKMARK_APP_BUBBLE_VIEW_H_
8 #include "base/basictypes.h"
9 #include "base/strings/string16.h"
10 #include "chrome/common/web_application_info.h"
11 #include "ui/views/bubble/bubble_delegate.h"
12 #include "ui/views/controls/button/button.h"
22 // BookmarkAppBubbleView is a view intended to be used as the content of a
23 // Bubble. BookmarkAppBubbleView provides views for editing the bookmark app it
24 // is created with. Don't create a BookmarkAppBubbleView directly, instead use
25 // the static ShowBubble method.
26 class BookmarkAppBubbleView : public views::BubbleDelegateView,
27 public views::ButtonListener {
29 virtual ~BookmarkAppBubbleView();
31 static void ShowBubble(views::View* anchor_view,
33 const WebApplicationInfo& web_app_info,
34 const std::string& extension_id);
37 // Creates a BookmarkAppBubbleView.
38 BookmarkAppBubbleView(views::View* anchor_view,
40 const WebApplicationInfo& web_app_info,
41 const std::string& extension_id);
43 // Overriden from views::BubbleDelegateView:
44 virtual void Init() OVERRIDE;
45 virtual views::View* GetInitiallyFocusedView() OVERRIDE;
47 // Overridden from views::WidgetDelegate:
48 virtual void WindowClosing() OVERRIDE;
50 // Overridden from views::View:
51 virtual bool AcceleratorPressed(const ui::Accelerator& accelerator) OVERRIDE;
52 virtual gfx::Size GetMinimumSize() OVERRIDE;
54 // Overridden from views::ButtonListener:
55 // Closes the bubble or opens the edit dialog.
56 virtual void ButtonPressed(views::Button* sender,
57 const ui::Event& event) OVERRIDE;
59 // Handle the message when the user presses a button.
60 void HandleButtonPressed(views::Button* sender);
62 // Sets the title and launch type of the app.
65 // The bookmark app bubble, if we're showing one.
66 static BookmarkAppBubbleView* bookmark_app_bubble_;
71 // The WebApplicationInfo being used to create the app.
72 const WebApplicationInfo web_app_info_;
74 // The extension id of the bookmark app.
75 const std::string extension_id_;
77 // Button for removing the bookmark.
78 views::LabelButton* add_button_;
80 // Button to close the window.
81 views::LabelButton* cancel_button_;
83 // Checkbox to launch as a tab.
84 views::Checkbox* open_as_tab_checkbox_;
86 // Textfield showing the title of the app.
87 views::Textfield* title_tf_;
89 // When the destructor is invoked should the app be removed?
92 DISALLOW_COPY_AND_ASSIGN(BookmarkAppBubbleView);
95 #endif // CHROME_BROWSER_UI_VIEWS_EXTENSIONS_BOOKMARK_APP_BUBBLE_VIEW_H_