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

Side by Side Diff: chrome/browser/ui/views/bookmarks/bookmark_bubble_view.h

Issue 2905243003: Cleanup BookmarkBubbleView, remove LocationBarBubbleDelegateView::GetDialogButtons() (Closed)
Patch Set: neater Created 3 years, 7 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_BOOKMARKS_BOOKMARK_BUBBLE_VIEW_H_ 5 #ifndef CHROME_BROWSER_UI_VIEWS_BOOKMARKS_BOOKMARK_BUBBLE_VIEW_H_
6 #define CHROME_BROWSER_UI_VIEWS_BOOKMARKS_BOOKMARK_BUBBLE_VIEW_H_ 6 #define CHROME_BROWSER_UI_VIEWS_BOOKMARKS_BOOKMARK_BUBBLE_VIEW_H_
7 7
8 #include <memory> 8 #include <memory>
9 9
10 #include "base/compiler_specific.h"
11 #include "base/gtest_prod_util.h"
12 #include "base/macros.h" 10 #include "base/macros.h"
13 #include "base/strings/string16.h" 11 #include "base/strings/string16.h"
12 #include "build/build_config.h"
14 #include "chrome/browser/ui/bookmarks/recently_used_folders_combo_model.h" 13 #include "chrome/browser/ui/bookmarks/recently_used_folders_combo_model.h"
15 #include "chrome/browser/ui/desktop_ios_promotion/desktop_ios_promotion_footnote _delegate.h" 14 #include "chrome/browser/ui/desktop_ios_promotion/desktop_ios_promotion_footnote _delegate.h"
16 #include "chrome/browser/ui/sync/bubble_sync_promo_delegate.h" 15 #include "chrome/browser/ui/sync/bubble_sync_promo_delegate.h"
17 #include "chrome/browser/ui/views/location_bar/location_bar_bubble_delegate_view .h" 16 #include "chrome/browser/ui/views/location_bar/location_bar_bubble_delegate_view .h"
18 #include "ui/views/controls/button/button.h" 17 #include "ui/views/controls/button/button.h"
19 #include "ui/views/controls/combobox/combobox_listener.h" 18 #include "ui/views/controls/combobox/combobox_listener.h"
20 #include "url/gurl.h" 19 #include "url/gurl.h"
21 20
22 class Profile; 21 class Profile;
23 22
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 Profile* profile, 59 Profile* profile,
61 const GURL& url, 60 const GURL& url,
62 bool already_bookmarked); 61 bool already_bookmarked);
63 62
64 static void Hide(); 63 static void Hide();
65 64
66 static BookmarkBubbleView* bookmark_bubble() { return bookmark_bubble_; } 65 static BookmarkBubbleView* bookmark_bubble() { return bookmark_bubble_; }
67 66
68 ~BookmarkBubbleView() override; 67 ~BookmarkBubbleView() override;
69 68
70 // views::WidgetDelegate:
71 void WindowClosing() override;
72 bool AcceleratorPressed(const ui::Accelerator& accelerator) override;
73 gfx::ImageSkia GetWindowIcon() override;
74 bool ShouldShowWindowIcon() const override;
75
76 protected:
77 // views::BubbleDialogDelegateView method.
78 void Init() override;
79 base::string16 GetWindowTitle() const override;
80
81 private: 69 private:
82 friend class BookmarkBubbleViewTest; 70 friend class BookmarkBubbleViewTest;
83 friend class BookmarkBubbleViewBrowserTest; 71 friend class BookmarkBubbleViewBrowserTest;
84 FRIEND_TEST_ALL_PREFIXES(BookmarkBubbleViewTest, SyncPromoSignedIn);
85 FRIEND_TEST_ALL_PREFIXES(BookmarkBubbleViewTest, SyncPromoNotSignedIn);
86
87 // views::BubbleDialogDelegateView:
88 const char* GetClassName() const override;
89 View* GetInitiallyFocusedView() override;
90 View* CreateFootnoteView() override;
91 72
92 // Creates a BookmarkBubbleView. 73 // Creates a BookmarkBubbleView.
93 BookmarkBubbleView(views::View* anchor_view, 74 BookmarkBubbleView(views::View* anchor_view,
94 bookmarks::BookmarkBubbleObserver* observer, 75 bookmarks::BookmarkBubbleObserver* observer,
95 std::unique_ptr<BubbleSyncPromoDelegate> delegate, 76 std::unique_ptr<BubbleSyncPromoDelegate> delegate,
96 Profile* profile, 77 Profile* profile,
97 const GURL& url, 78 const GURL& url,
98 bool newly_bookmarked); 79 bool newly_bookmarked);
99 80
100 // Returns the title to display. 81 // Returns the name of the bookmark.
101 base::string16 GetTitle(); 82 base::string16 GetBookmarkName();
102 83
103 // Overridden from views::View: 84 // Closes the bubble, opens the edit dialog, or shows the iOS promo.
104 void GetAccessibleNodeData(ui::AXNodeData* node_data) override;
105
106 // Overridden from views::ButtonListener:
107 // Closes the bubble or opens the edit dialog.
108 void ButtonPressed(views::Button* sender, const ui::Event& event) override;
109
110 // Overridden from views::ComboboxListener:
111 void OnPerformAction(views::Combobox* combobox) override;
112
113 // Handle the message when the user presses a button.
114 void HandleButtonPressed(views::Button* sender); 85 void HandleButtonPressed(views::Button* sender);
115 86
116 // Shows the BookmarkEditor. 87 // Shows the BookmarkEditor.
117 void ShowEditor(); 88 void ShowEditor();
118 89
119 // Sets the title and parent of the node. 90 // Sets the bookmark name and parent of the node.
120 void ApplyEdits(); 91 void ApplyEdits();
121 92
122 // DesktopIOSPromotionFootnoteDelegate :
123 void OnIOSPromotionFootnoteLinkClicked() override;
124
125 #if defined(OS_WIN) 93 #if defined(OS_WIN)
126 // Check eligiblity to showthe iOS promotion from a specific entry point. 94 // Check eligibility to show the iOS promotion from a specific entry point.
127 bool IsIOSPromotionEligible( 95 bool IsIOSPromotionEligible(
128 desktop_ios_promotion::PromotionEntryPoint entry_point); 96 desktop_ios_promotion::PromotionEntryPoint entry_point);
129 97
130 // Shows the iOS promotion. 98 // Shows the iOS promotion.
131 void ShowIOSPromotion(desktop_ios_promotion::PromotionEntryPoint entry_point); 99 void ShowIOSPromotion(desktop_ios_promotion::PromotionEntryPoint entry_point);
132 #endif 100 #endif
133 101
102 // views::LocationBarBubbleDelegateView:
103 int GetDialogButtons() const override;
104 View* GetInitiallyFocusedView() override;
105 base::string16 GetWindowTitle() const override;
106 gfx::ImageSkia GetWindowIcon() override;
107 bool ShouldShowWindowIcon() const override;
108 void WindowClosing() override;
109 View* CreateFootnoteView() override;
110 const char* GetClassName() const override;
111 bool AcceleratorPressed(const ui::Accelerator& accelerator) override;
112 void GetAccessibleNodeData(ui::AXNodeData* node_data) override;
113 void Init() override;
114
115 // views::ButtonListener:
116 void ButtonPressed(views::Button* sender, const ui::Event& event) override;
117
118 // views::ComboboxListener:
119 void OnPerformAction(views::Combobox* combobox) override;
120
121 // DesktopIOSPromotionFootnoteDelegate:
122 void OnIOSPromotionFootnoteLinkClicked() override;
123
134 // The bookmark bubble, if we're showing one. 124 // The bookmark bubble, if we're showing one.
135 static BookmarkBubbleView* bookmark_bubble_; 125 static BookmarkBubbleView* bookmark_bubble_;
136 126
137 // Our observer, to notify when the bubble shows or hides. 127 // Our observer, to notify when the bubble shows or hides.
138 bookmarks::BookmarkBubbleObserver* observer_; 128 bookmarks::BookmarkBubbleObserver* observer_;
139 129
140 // Delegate, to handle clicks on the sign in link. 130 // Delegate, to handle clicks on the sign in link.
141 std::unique_ptr<BubbleSyncPromoDelegate> delegate_; 131 std::unique_ptr<BubbleSyncPromoDelegate> delegate_;
142 132
143 // The profile. 133 // The profile.
144 Profile* profile_; 134 Profile* profile_;
145 135
146 // The bookmark URL. 136 // The bookmark URL.
147 const GURL url_; 137 const GURL url_;
148 138
149 // If true, the page was just bookmarked. 139 // If true, the page was just bookmarked.
150 const bool newly_bookmarked_; 140 const bool newly_bookmarked_;
151 141
152 RecentlyUsedFoldersComboModel parent_model_; 142 RecentlyUsedFoldersComboModel parent_model_;
153 143
154 // Button for removing the bookmark. 144 // Button for removing the bookmark.
155 views::LabelButton* remove_button_; 145 views::LabelButton* remove_button_;
156 146
157 // Button to bring up the editor. 147 // Button to bring up the editor.
158 views::LabelButton* edit_button_; 148 views::LabelButton* edit_button_;
159 149
160 // Button to close the window. 150 // Button to save the bookmark.
161 views::LabelButton* close_button_; 151 views::LabelButton* save_button_;
162 152
163 // Textfield showing the title of the bookmark. 153 // Textfield showing the name of the bookmark.
164 views::Textfield* title_tf_; 154 views::Textfield* name_field_;
165 155
166 // Combobox showing a handful of folders the user can choose from, including 156 // Combobox showing a handful of folders the user can choose from, including
167 // the current parent. 157 // the current parent.
168 views::Combobox* parent_combobox_; 158 views::Combobox* parent_combobox_;
169 159
170 // Bookmark details view, contains the details of the bookmark with controls 160 // The regular bookmark bubble contents, with all the edit fields and dialog
171 // to edit it. 161 // buttons. TODO(tapted): Move the buttons to the DialogClientView.
172 std::unique_ptr<View> bookmark_details_view_; 162 views::View* bookmark_contents_view_;
173 163
174 // iOS promotion view. 164 // iOS promotion view.
175 DesktopIOSPromotionBubbleView* ios_promo_view_; 165 DesktopIOSPromotionBubbleView* ios_promo_view_;
176 166
177 // Footnote view. 167 // Footnote view.
178 views::View* footnote_view_; 168 views::View* footnote_view_;
179 169
180 // When the destructor is invoked should the bookmark be removed? 170 // When the destructor is invoked should the bookmark be removed?
181 bool remove_bookmark_; 171 bool remove_bookmark_;
182 172
183 // When the destructor is invoked should edits be applied? 173 // When the destructor is invoked should edits be applied?
184 bool apply_edits_; 174 bool apply_edits_;
185 175
186 // Whether the Windows to iOS promotion is shown to the user. 176 // Whether the Windows to iOS promotion is shown to the user.
187 bool is_showing_ios_promotion_; 177 bool is_showing_ios_promotion_;
188 178
189 DISALLOW_COPY_AND_ASSIGN(BookmarkBubbleView); 179 DISALLOW_COPY_AND_ASSIGN(BookmarkBubbleView);
190 }; 180 };
191 181
192 #endif // CHROME_BROWSER_UI_VIEWS_BOOKMARKS_BOOKMARK_BUBBLE_VIEW_H_ 182 #endif // CHROME_BROWSER_UI_VIEWS_BOOKMARKS_BOOKMARK_BUBBLE_VIEW_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698