Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(91)

Side by Side Diff: chrome/browser/ui/views/extensions/bookmark_app_bubble_view.h

Issue 1878963003: Convert BookmarkBubbleAppView to a DialogDelegateView (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: msw review Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | chrome/browser/ui/views/extensions/bookmark_app_bubble_view.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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_EXTENSIONS_BOOKMARK_APP_BUBBLE_VIEW_H_
6 #define CHROME_BROWSER_UI_VIEWS_EXTENSIONS_BOOKMARK_APP_BUBBLE_VIEW_H_
7
8 #include "base/macros.h"
9 #include "base/strings/string16.h"
10 #include "chrome/browser/ui/browser_window.h"
11 #include "chrome/common/web_application_info.h"
12 #include "ui/views/bubble/bubble_delegate.h"
13 #include "ui/views/controls/button/button.h"
14 #include "ui/views/controls/textfield/textfield_controller.h"
15
16 namespace gfx {
17 class ImageSkia;
18 }
19
20 namespace views {
21 class Checkbox;
22 class ImageView;
23 class LabelButton;
24 class Textfield;
25 }
26
27 // BookmarkAppBubbleView is a view intended to be used as the content of a
28 // Bubble. BookmarkAppBubbleView provides views for editing the details to
29 // create a bookmark app with. Don't create a BookmarkAppBubbleView directly,
30 // instead use the static ShowBubble method.
31 class BookmarkAppBubbleView : public views::BubbleDelegateView,
32 public views::ButtonListener,
33 public views::TextfieldController {
34 public:
35 ~BookmarkAppBubbleView() override;
36
37 static void ShowBubble(
38 views::View* anchor_view,
39 const WebApplicationInfo& web_app_info,
40 const BrowserWindow::ShowBookmarkAppBubbleCallback& callback);
41
42 private:
43 // Creates a BookmarkAppBubbleView.
44 BookmarkAppBubbleView(
45 views::View* anchor_view,
46 const WebApplicationInfo& web_app_info,
47 const BrowserWindow::ShowBookmarkAppBubbleCallback& callback);
48
49 // Overriden from views::BubbleDelegateView:
50 void Init() override;
51 views::View* GetInitiallyFocusedView() override;
52
53 // Overridden from views::WidgetDelegate:
54 void WindowClosing() override;
55
56 // Overridden from views::View:
57 bool AcceleratorPressed(const ui::Accelerator& accelerator) override;
58 void GetAccessibleState(ui::AXViewState* state) override;
59 gfx::Size GetMinimumSize() const override;
60
61 // Overridden from views::ButtonListener:
62 // Closes the bubble or opens the edit dialog.
63 void ButtonPressed(views::Button* sender, const ui::Event& event) override;
64
65 // Overridden from views::TextfieldController:
66 void ContentsChanged(views::Textfield* sender,
67 const base::string16& new_contents) override;
68
69 // Handle the message when the user presses a button.
70 void HandleButtonPressed(views::Button* sender);
71
72 // Update the state of the Add button.
73 void UpdateAddButtonState();
74
75 // Get the string ID to use for the bubble title.
76 int TitleStringId();
77
78 // Get the trimmed contents of the title text field.
79 base::string16 GetTrimmedTitle();
80
81 // The WebApplicationInfo that the user is editing.
82 WebApplicationInfo web_app_info_;
83
84 // Whether the user has accepted the dialog.
85 bool user_accepted_;
86
87 // The callback to be invoked when the dialog is completed.
88 BrowserWindow::ShowBookmarkAppBubbleCallback callback_;
89
90 // Button for removing the bookmark.
91 views::LabelButton* add_button_;
92
93 // Button to close the window.
94 views::LabelButton* cancel_button_;
95
96 // Checkbox to launch as a window.
97 views::Checkbox* open_as_window_checkbox_;
98
99 // Textfield showing the title of the app.
100 views::Textfield* title_tf_;
101
102 // Image showing the icon of the app.
103 views::ImageView* icon_image_view_;
104
105 DISALLOW_COPY_AND_ASSIGN(BookmarkAppBubbleView);
106 };
107
108 #endif // CHROME_BROWSER_UI_VIEWS_EXTENSIONS_BOOKMARK_APP_BUBBLE_VIEW_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/views/extensions/bookmark_app_bubble_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698