OLD | NEW |
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/macros.h" | 10 #include "base/macros.h" |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 Profile* profile, | 59 Profile* profile, |
60 const GURL& url, | 60 const GURL& url, |
61 bool already_bookmarked); | 61 bool already_bookmarked); |
62 | 62 |
63 static void Hide(); | 63 static void Hide(); |
64 | 64 |
65 static BookmarkBubbleView* bookmark_bubble() { return bookmark_bubble_; } | 65 static BookmarkBubbleView* bookmark_bubble() { return bookmark_bubble_; } |
66 | 66 |
67 ~BookmarkBubbleView() override; | 67 ~BookmarkBubbleView() override; |
68 | 68 |
69 // views::LocationBarBubbleDelegateView: | 69 // LocationBarBubbleDelegateView: |
70 int GetDialogButtons() const override; | 70 int GetDialogButtons() const override; |
| 71 base::string16 GetDialogButtonLabel(ui::DialogButton button) const override; |
71 View* GetInitiallyFocusedView() override; | 72 View* GetInitiallyFocusedView() override; |
72 base::string16 GetWindowTitle() const override; | 73 base::string16 GetWindowTitle() const override; |
73 gfx::ImageSkia GetWindowIcon() override; | 74 gfx::ImageSkia GetWindowIcon() override; |
74 bool ShouldShowWindowIcon() const override; | 75 bool ShouldShowWindowIcon() const override; |
75 void WindowClosing() override; | 76 void WindowClosing() override; |
76 View* CreateFootnoteView() override; | 77 views::View* CreateExtraView() override; |
| 78 bool GetExtraViewPadding(int* padding) override; |
| 79 views::View* CreateFootnoteView() override; |
| 80 bool Cancel() override; |
| 81 bool Accept() override; |
| 82 bool Close() override; |
| 83 void UpdateButton(views::LabelButton* button, ui::DialogButton type) override; |
77 const char* GetClassName() const override; | 84 const char* GetClassName() const override; |
78 bool AcceleratorPressed(const ui::Accelerator& accelerator) override; | |
79 void GetAccessibleNodeData(ui::AXNodeData* node_data) override; | 85 void GetAccessibleNodeData(ui::AXNodeData* node_data) override; |
80 | 86 |
81 // views::ButtonListener: | 87 // views::ButtonListener: |
82 void ButtonPressed(views::Button* sender, const ui::Event& event) override; | 88 void ButtonPressed(views::Button* sender, const ui::Event& event) override; |
83 | 89 |
84 // views::ComboboxListener: | 90 // views::ComboboxListener: |
85 void OnPerformAction(views::Combobox* combobox) override; | 91 void OnPerformAction(views::Combobox* combobox) override; |
86 | 92 |
87 // DesktopIOSPromotionFootnoteDelegate: | 93 // DesktopIOSPromotionFootnoteDelegate: |
88 void OnIOSPromotionFootnoteLinkClicked() override; | 94 void OnIOSPromotionFootnoteLinkClicked() override; |
89 | 95 |
90 protected: | 96 protected: |
91 // views::LocationBarBubbleDelegateView: | 97 // LocationBarBubbleDelegateView: |
92 void Init() override; | 98 void Init() override; |
93 | 99 |
94 private: | 100 private: |
95 friend class BookmarkBubbleViewTest; | 101 friend class BookmarkBubbleViewTest; |
96 friend class BookmarkBubbleViewBrowserTest; | 102 friend class BookmarkBubbleViewBrowserTest; |
97 | 103 |
98 // Creates a BookmarkBubbleView. | 104 // Creates a BookmarkBubbleView. |
99 BookmarkBubbleView(views::View* anchor_view, | 105 BookmarkBubbleView(views::View* anchor_view, |
100 bookmarks::BookmarkBubbleObserver* observer, | 106 bookmarks::BookmarkBubbleObserver* observer, |
101 std::unique_ptr<BubbleSyncPromoDelegate> delegate, | 107 std::unique_ptr<BubbleSyncPromoDelegate> delegate, |
102 Profile* profile, | 108 Profile* profile, |
103 const GURL& url, | 109 const GURL& url, |
104 bool newly_bookmarked); | 110 bool newly_bookmarked); |
105 | 111 |
106 // Returns the name of the bookmark. | 112 // Returns the name of the bookmark. |
107 base::string16 GetBookmarkName(); | 113 base::string16 GetBookmarkName(); |
108 | 114 |
109 // Closes the bubble, opens the edit dialog, or shows the iOS promo. | |
110 void HandleButtonPressed(views::Button* sender); | |
111 | |
112 // Shows the BookmarkEditor. | 115 // Shows the BookmarkEditor. |
113 void ShowEditor(); | 116 void ShowEditor(); |
114 | 117 |
115 // Sets the bookmark name and parent of the node. | 118 // Sets the bookmark name and parent of the node. |
116 void ApplyEdits(); | 119 void ApplyEdits(); |
117 | 120 |
118 #if defined(OS_WIN) | 121 #if defined(OS_WIN) |
119 // Check eligibility to show the iOS promotion from a specific entry point. | 122 // Check eligibility to show the iOS promotion from a specific entry point. |
120 bool IsIOSPromotionEligible( | 123 bool IsIOSPromotionEligible( |
121 desktop_ios_promotion::PromotionEntryPoint entry_point); | 124 desktop_ios_promotion::PromotionEntryPoint entry_point); |
(...skipping 15 matching lines...) Expand all Loading... |
137 Profile* profile_; | 140 Profile* profile_; |
138 | 141 |
139 // The bookmark URL. | 142 // The bookmark URL. |
140 const GURL url_; | 143 const GURL url_; |
141 | 144 |
142 // If true, the page was just bookmarked. | 145 // If true, the page was just bookmarked. |
143 const bool newly_bookmarked_; | 146 const bool newly_bookmarked_; |
144 | 147 |
145 RecentlyUsedFoldersComboModel parent_model_; | 148 RecentlyUsedFoldersComboModel parent_model_; |
146 | 149 |
147 // Button for removing the bookmark. | |
148 views::LabelButton* remove_button_; | |
149 | |
150 // Button to bring up the editor. | 150 // Button to bring up the editor. |
151 views::LabelButton* edit_button_; | 151 views::LabelButton* edit_button_ = nullptr; |
152 | |
153 // Button to save the bookmark. | |
154 views::LabelButton* save_button_; | |
155 | 152 |
156 // Textfield showing the name of the bookmark. | 153 // Textfield showing the name of the bookmark. |
157 views::Textfield* name_field_; | 154 views::Textfield* name_field_ = nullptr; |
158 | 155 |
159 // 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 |
160 // the current parent. | 157 // the current parent. |
161 views::Combobox* parent_combobox_; | 158 views::Combobox* parent_combobox_ = nullptr; |
162 | 159 |
163 // The regular bookmark bubble contents, with all the edit fields and dialog | 160 // The regular bookmark bubble contents, with all the edit fields and dialog |
164 // buttons. TODO(tapted): Move the buttons to the DialogClientView. | 161 // buttons. TODO(tapted): Move the buttons to the DialogClientView. |
165 views::View* bookmark_contents_view_; | 162 views::View* bookmark_contents_view_ = nullptr; |
166 | 163 |
167 // iOS promotion view. | 164 // iOS promotion view. |
168 DesktopIOSPromotionBubbleView* ios_promo_view_; | 165 DesktopIOSPromotionBubbleView* ios_promo_view_ = nullptr; |
169 | 166 |
170 // Footnote view. | 167 // Footnote view. |
171 views::View* footnote_view_; | 168 views::View* footnote_view_ = nullptr; |
172 | 169 |
173 // When the destructor is invoked should the bookmark be removed? | 170 // When the destructor is invoked should the bookmark be removed? |
174 bool remove_bookmark_; | 171 bool remove_bookmark_ = false; |
175 | 172 |
176 // When the destructor is invoked should edits be applied? | 173 // When the destructor is invoked should edits be applied? |
177 bool apply_edits_; | 174 bool apply_edits_ = true; |
178 | 175 |
179 // Whether the Windows to iOS promotion is shown to the user. | 176 // Whether the Windows to iOS promotion is shown to the user. |
180 bool is_showing_ios_promotion_; | 177 bool is_showing_ios_promotion_ = false; |
181 | 178 |
182 DISALLOW_COPY_AND_ASSIGN(BookmarkBubbleView); | 179 DISALLOW_COPY_AND_ASSIGN(BookmarkBubbleView); |
183 }; | 180 }; |
184 | 181 |
185 #endif // CHROME_BROWSER_UI_VIEWS_BOOKMARKS_BOOKMARK_BUBBLE_VIEW_H_ | 182 #endif // CHROME_BROWSER_UI_VIEWS_BOOKMARKS_BOOKMARK_BUBBLE_VIEW_H_ |
OLD | NEW |