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/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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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::LocationBarBubbleDelegateView: | 69 // views::LocationBarBubbleDelegateView: |
| 70 int GetDialogButtons() const override; |
71 View* GetInitiallyFocusedView() override; | 71 View* GetInitiallyFocusedView() override; |
72 base::string16 GetWindowTitle() const override; | 72 base::string16 GetWindowTitle() const override; |
73 gfx::ImageSkia GetWindowIcon() override; | 73 gfx::ImageSkia GetWindowIcon() override; |
74 bool ShouldShowWindowIcon() const override; | 74 bool ShouldShowWindowIcon() const override; |
75 void WindowClosing() override; | 75 void WindowClosing() override; |
76 View* CreateFootnoteView() override; | 76 View* CreateFootnoteView() override; |
77 const char* GetClassName() const override; | 77 const char* GetClassName() const override; |
78 bool AcceleratorPressed(const ui::Accelerator& accelerator) override; | 78 bool AcceleratorPressed(const ui::Accelerator& accelerator) override; |
79 void GetAccessibleNodeData(ui::AXNodeData* node_data) override; | 79 void GetAccessibleNodeData(ui::AXNodeData* node_data) override; |
80 | 80 |
81 // views::ButtonListener: | 81 // views::ButtonListener: |
82 void ButtonPressed(views::Button* sender, const ui::Event& event) override; | 82 void ButtonPressed(views::Button* sender, const ui::Event& event) override; |
83 | 83 |
84 // views::ComboboxListener: | 84 // views::ComboboxListener: |
85 void OnPerformAction(views::Combobox* combobox) override; | 85 void OnPerformAction(views::Combobox* combobox) override; |
86 | 86 |
87 // DesktopIOSPromotionFootnoteDelegate: | 87 // DesktopIOSPromotionFootnoteDelegate: |
88 void OnIOSPromotionFootnoteLinkClicked() override; | 88 void OnIOSPromotionFootnoteLinkClicked() override; |
89 | 89 |
90 protected: | 90 protected: |
91 // views::LocationBarBubbleDelegateView: | 91 // views::LocationBarBubbleDelegateView: |
92 void Init() override; | 92 void Init() override; |
93 | 93 |
94 private: | 94 private: |
95 friend class BookmarkBubbleViewTest; | 95 friend class BookmarkBubbleViewTest; |
96 friend class BookmarkBubbleViewBrowserTest; | 96 friend class BookmarkBubbleViewBrowserTest; |
97 FRIEND_TEST_ALL_PREFIXES(BookmarkBubbleViewTest, SyncPromoSignedIn); | |
98 FRIEND_TEST_ALL_PREFIXES(BookmarkBubbleViewTest, SyncPromoNotSignedIn); | |
99 | 97 |
100 // Creates a BookmarkBubbleView. | 98 // Creates a BookmarkBubbleView. |
101 BookmarkBubbleView(views::View* anchor_view, | 99 BookmarkBubbleView(views::View* anchor_view, |
102 bookmarks::BookmarkBubbleObserver* observer, | 100 bookmarks::BookmarkBubbleObserver* observer, |
103 std::unique_ptr<BubbleSyncPromoDelegate> delegate, | 101 std::unique_ptr<BubbleSyncPromoDelegate> delegate, |
104 Profile* profile, | 102 Profile* profile, |
105 const GURL& url, | 103 const GURL& url, |
106 bool newly_bookmarked); | 104 bool newly_bookmarked); |
107 | 105 |
108 // Returns the title to display. | 106 // Returns the name of the bookmark. |
109 base::string16 GetTitle(); | 107 base::string16 GetBookmarkName(); |
110 | 108 |
111 // Handle the message when the user presses a button. | 109 // Closes the bubble, opens the edit dialog, or shows the iOS promo. |
112 void HandleButtonPressed(views::Button* sender); | 110 void HandleButtonPressed(views::Button* sender); |
113 | 111 |
114 // Shows the BookmarkEditor. | 112 // Shows the BookmarkEditor. |
115 void ShowEditor(); | 113 void ShowEditor(); |
116 | 114 |
117 // Sets the title and parent of the node. | 115 // Sets the bookmark name and parent of the node. |
118 void ApplyEdits(); | 116 void ApplyEdits(); |
119 | 117 |
120 #if defined(OS_WIN) | 118 #if defined(OS_WIN) |
121 // Check eligiblity to showthe iOS promotion from a specific entry point. | 119 // Check eligibility to show the iOS promotion from a specific entry point. |
122 bool IsIOSPromotionEligible( | 120 bool IsIOSPromotionEligible( |
123 desktop_ios_promotion::PromotionEntryPoint entry_point); | 121 desktop_ios_promotion::PromotionEntryPoint entry_point); |
124 | 122 |
125 // Shows the iOS promotion. | 123 // Shows the iOS promotion. |
126 void ShowIOSPromotion(desktop_ios_promotion::PromotionEntryPoint entry_point); | 124 void ShowIOSPromotion(desktop_ios_promotion::PromotionEntryPoint entry_point); |
127 #endif | 125 #endif |
128 | 126 |
129 // The bookmark bubble, if we're showing one. | 127 // The bookmark bubble, if we're showing one. |
130 static BookmarkBubbleView* bookmark_bubble_; | 128 static BookmarkBubbleView* bookmark_bubble_; |
131 | 129 |
(...skipping 13 matching lines...) Expand all Loading... |
145 const bool newly_bookmarked_; | 143 const bool newly_bookmarked_; |
146 | 144 |
147 RecentlyUsedFoldersComboModel parent_model_; | 145 RecentlyUsedFoldersComboModel parent_model_; |
148 | 146 |
149 // Button for removing the bookmark. | 147 // Button for removing the bookmark. |
150 views::LabelButton* remove_button_; | 148 views::LabelButton* remove_button_; |
151 | 149 |
152 // Button to bring up the editor. | 150 // Button to bring up the editor. |
153 views::LabelButton* edit_button_; | 151 views::LabelButton* edit_button_; |
154 | 152 |
155 // Button to close the window. | 153 // Button to save the bookmark. |
156 views::LabelButton* close_button_; | 154 views::LabelButton* save_button_; |
157 | 155 |
158 // Textfield showing the title of the bookmark. | 156 // Textfield showing the name of the bookmark. |
159 views::Textfield* title_tf_; | 157 views::Textfield* name_field_; |
160 | 158 |
161 // Combobox showing a handful of folders the user can choose from, including | 159 // Combobox showing a handful of folders the user can choose from, including |
162 // the current parent. | 160 // the current parent. |
163 views::Combobox* parent_combobox_; | 161 views::Combobox* parent_combobox_; |
164 | 162 |
165 // Bookmark details view, contains the details of the bookmark with controls | 163 // The regular bookmark bubble contents, with all the edit fields and dialog |
166 // to edit it. | 164 // buttons. TODO(tapted): Move the buttons to the DialogClientView. |
167 std::unique_ptr<View> bookmark_details_view_; | 165 views::View* bookmark_contents_view_; |
168 | 166 |
169 // iOS promotion view. | 167 // iOS promotion view. |
170 DesktopIOSPromotionBubbleView* ios_promo_view_; | 168 DesktopIOSPromotionBubbleView* ios_promo_view_; |
171 | 169 |
172 // Footnote view. | 170 // Footnote view. |
173 views::View* footnote_view_; | 171 views::View* footnote_view_; |
174 | 172 |
175 // When the destructor is invoked should the bookmark be removed? | 173 // When the destructor is invoked should the bookmark be removed? |
176 bool remove_bookmark_; | 174 bool remove_bookmark_; |
177 | 175 |
178 // When the destructor is invoked should edits be applied? | 176 // When the destructor is invoked should edits be applied? |
179 bool apply_edits_; | 177 bool apply_edits_; |
180 | 178 |
181 // Whether the Windows to iOS promotion is shown to the user. | 179 // Whether the Windows to iOS promotion is shown to the user. |
182 bool is_showing_ios_promotion_; | 180 bool is_showing_ios_promotion_; |
183 | 181 |
184 DISALLOW_COPY_AND_ASSIGN(BookmarkBubbleView); | 182 DISALLOW_COPY_AND_ASSIGN(BookmarkBubbleView); |
185 }; | 183 }; |
186 | 184 |
187 #endif // CHROME_BROWSER_UI_VIEWS_BOOKMARKS_BOOKMARK_BUBBLE_VIEW_H_ | 185 #endif // CHROME_BROWSER_UI_VIEWS_BOOKMARKS_BOOKMARK_BUBBLE_VIEW_H_ |
OLD | NEW |