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

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

Issue 907473002: Polish UI of bookmark app creation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Feedback Created 5 years, 10 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROME_BROWSER_UI_VIEWS_EXTENSIONS_BOOKMARK_APP_BUBBLE_VIEW_H_ 5 #ifndef CHROME_BROWSER_UI_VIEWS_EXTENSIONS_BOOKMARK_APP_BUBBLE_VIEW_H_
6 #define CHROME_BROWSER_UI_VIEWS_EXTENSIONS_BOOKMARK_APP_BUBBLE_VIEW_H_ 6 #define CHROME_BROWSER_UI_VIEWS_EXTENSIONS_BOOKMARK_APP_BUBBLE_VIEW_H_
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/strings/string16.h" 9 #include "base/strings/string16.h"
10 #include "chrome/browser/ui/browser_window.h" 10 #include "chrome/browser/ui/browser_window.h"
11 #include "chrome/common/web_application_info.h" 11 #include "chrome/common/web_application_info.h"
12 #include "ui/views/bubble/bubble_delegate.h" 12 #include "ui/views/bubble/bubble_delegate.h"
13 #include "ui/views/controls/button/button.h" 13 #include "ui/views/controls/button/button.h"
14 #include "ui/views/controls/textfield/textfield_controller.h"
14 15
15 namespace gfx { 16 namespace gfx {
16 class ImageSkia; 17 class ImageSkia;
17 } 18 }
18 19
19 namespace views { 20 namespace views {
20 class Checkbox; 21 class Checkbox;
21 class ImageView; 22 class ImageView;
22 class LabelButton; 23 class LabelButton;
23 class Textfield; 24 class Textfield;
24 } 25 }
25 26
26 // BookmarkAppBubbleView is a view intended to be used as the content of a 27 // BookmarkAppBubbleView is a view intended to be used as the content of a
27 // Bubble. BookmarkAppBubbleView provides views for editing the details to 28 // Bubble. BookmarkAppBubbleView provides views for editing the details to
28 // create a bookmark app with. Don't create a BookmarkAppBubbleView directly, 29 // create a bookmark app with. Don't create a BookmarkAppBubbleView directly,
29 // instead use the static ShowBubble method. 30 // instead use the static ShowBubble method.
30 class BookmarkAppBubbleView : public views::BubbleDelegateView, 31 class BookmarkAppBubbleView : public views::BubbleDelegateView,
31 public views::ButtonListener { 32 public views::ButtonListener,
33 public views::TextfieldController {
32 public: 34 public:
33 ~BookmarkAppBubbleView() override; 35 ~BookmarkAppBubbleView() override;
34 36
35 static void ShowBubble( 37 static void ShowBubble(
36 views::View* anchor_view, 38 views::View* anchor_view,
37 const WebApplicationInfo& web_app_info, 39 const WebApplicationInfo& web_app_info,
38 const BrowserWindow::ShowBookmarkAppBubbleCallback& callback); 40 const BrowserWindow::ShowBookmarkAppBubbleCallback& callback);
39 41
40 private: 42 private:
41 // Creates a BookmarkAppBubbleView. 43 // Creates a BookmarkAppBubbleView.
(...skipping 10 matching lines...) Expand all
52 void WindowClosing() override; 54 void WindowClosing() override;
53 55
54 // Overridden from views::View: 56 // Overridden from views::View:
55 bool AcceleratorPressed(const ui::Accelerator& accelerator) override; 57 bool AcceleratorPressed(const ui::Accelerator& accelerator) override;
56 gfx::Size GetMinimumSize() const override; 58 gfx::Size GetMinimumSize() const override;
57 59
58 // Overridden from views::ButtonListener: 60 // Overridden from views::ButtonListener:
59 // Closes the bubble or opens the edit dialog. 61 // Closes the bubble or opens the edit dialog.
60 void ButtonPressed(views::Button* sender, const ui::Event& event) override; 62 void ButtonPressed(views::Button* sender, const ui::Event& event) override;
61 63
64 // Overridden from views::TextfieldController:
65 void ContentsChanged(views::Textfield* sender,
66 const base::string16& new_contents) override;
67
62 // Handle the message when the user presses a button. 68 // Handle the message when the user presses a button.
63 void HandleButtonPressed(views::Button* sender); 69 void HandleButtonPressed(views::Button* sender);
64 70
71 // Update the state of the Add button.
72 void UpdateAddButtonState();
73
74 // Get the trimmed contents of the title text field.
75 base::string16 GetTrimmedTitle();
76
65 // The WebApplicationInfo that the user is editing. 77 // The WebApplicationInfo that the user is editing.
66 WebApplicationInfo web_app_info_; 78 WebApplicationInfo web_app_info_;
67 79
68 // Whether the user has accepted the dialog. 80 // Whether the user has accepted the dialog.
69 bool user_accepted_; 81 bool user_accepted_;
70 82
71 // The callback to be invoked when the dialog is completed. 83 // The callback to be invoked when the dialog is completed.
72 BrowserWindow::ShowBookmarkAppBubbleCallback callback_; 84 BrowserWindow::ShowBookmarkAppBubbleCallback callback_;
73 85
74 // Button for removing the bookmark. 86 // Button for removing the bookmark.
75 views::LabelButton* add_button_; 87 views::LabelButton* add_button_;
76 88
77 // Button to close the window. 89 // Button to close the window.
78 views::LabelButton* cancel_button_; 90 views::LabelButton* cancel_button_;
79 91
80 // Checkbox to launch as a window. 92 // Checkbox to launch as a window.
81 views::Checkbox* open_as_window_checkbox_; 93 views::Checkbox* open_as_window_checkbox_;
82 94
83 // Textfield showing the title of the app. 95 // Textfield showing the title of the app.
84 views::Textfield* title_tf_; 96 views::Textfield* title_tf_;
85 97
86 // Image showing the icon of the app. 98 // Image showing the icon of the app.
87 views::ImageView* icon_image_view_; 99 views::ImageView* icon_image_view_;
88 100
89 DISALLOW_COPY_AND_ASSIGN(BookmarkAppBubbleView); 101 DISALLOW_COPY_AND_ASSIGN(BookmarkAppBubbleView);
90 }; 102 };
91 103
92 #endif // CHROME_BROWSER_UI_VIEWS_EXTENSIONS_BOOKMARK_APP_BUBBLE_VIEW_H_ 104 #endif // CHROME_BROWSER_UI_VIEWS_EXTENSIONS_BOOKMARK_APP_BUBBLE_VIEW_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/toolbar/wrench_menu_model.cc ('k') | 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