| 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" | 10 #include "base/compiler_specific.h" |
| 11 #include "base/gtest_prod_util.h" | 11 #include "base/gtest_prod_util.h" |
| 12 #include "base/macros.h" | 12 #include "base/macros.h" |
| 13 #include "base/strings/string16.h" | 13 #include "base/strings/string16.h" |
| 14 #include "chrome/browser/ui/bookmarks/recently_used_folders_combo_model.h" | 14 #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" |
| 15 #include "chrome/browser/ui/sync/bubble_sync_promo_delegate.h" | 16 #include "chrome/browser/ui/sync/bubble_sync_promo_delegate.h" |
| 16 #include "chrome/browser/ui/views/location_bar/location_bar_bubble_delegate_view
.h" | 17 #include "chrome/browser/ui/views/location_bar/location_bar_bubble_delegate_view
.h" |
| 17 #include "ui/views/controls/button/button.h" | 18 #include "ui/views/controls/button/button.h" |
| 18 #include "ui/views/controls/combobox/combobox_listener.h" | 19 #include "ui/views/controls/combobox/combobox_listener.h" |
| 19 #include "url/gurl.h" | 20 #include "url/gurl.h" |
| 20 | 21 |
| 21 class Profile; | 22 class Profile; |
| 22 | 23 |
| 23 class DesktopIOSPromotionBubbleView; | 24 class DesktopIOSPromotionBubbleView; |
| 24 | 25 |
| 25 namespace bookmarks { | 26 namespace bookmarks { |
| 26 class BookmarkBubbleObserver; | 27 class BookmarkBubbleObserver; |
| 27 } | 28 } |
| 28 | 29 |
| 30 #if defined(OS_WIN) |
| 31 namespace desktop_ios_promotion { |
| 32 enum class PromotionEntryPoint; |
| 33 } |
| 34 #endif |
| 35 |
| 29 namespace views { | 36 namespace views { |
| 30 class LabelButton; | 37 class LabelButton; |
| 31 class Textfield; | 38 class Textfield; |
| 32 } | 39 } |
| 33 | 40 |
| 34 // BookmarkBubbleView is a view intended to be used as the content of an | 41 // BookmarkBubbleView is a view intended to be used as the content of an |
| 35 // Bubble. BookmarkBubbleView provides views for unstarring and editing the | 42 // Bubble. BookmarkBubbleView provides views for unstarring and editing the |
| 36 // bookmark it is created with. Don't create a BookmarkBubbleView directly, | 43 // bookmark it is created with. Don't create a BookmarkBubbleView directly, |
| 37 // instead use the static Show method. | 44 // instead use the static Show method. |
| 38 class BookmarkBubbleView : public LocationBarBubbleDelegateView, | 45 class BookmarkBubbleView : public LocationBarBubbleDelegateView, |
| 39 public views::ButtonListener, | 46 public views::ButtonListener, |
| 40 public views::ComboboxListener { | 47 public views::ComboboxListener, |
| 48 public DesktopIOSPromotionFootnoteDelegate { |
| 41 public: | 49 public: |
| 42 // If |anchor_view| is null, |anchor_rect| is used to anchor the bubble and | 50 // If |anchor_view| is null, |anchor_rect| is used to anchor the bubble and |
| 43 // |parent_window| is used to ensure the bubble closes if the parent closes. | 51 // |parent_window| is used to ensure the bubble closes if the parent closes. |
| 44 // Returns the newly created bubble's Widget or nullptr in case when the | 52 // Returns the newly created bubble's Widget or nullptr in case when the |
| 45 // bubble already exists. | 53 // bubble already exists. |
| 46 static views::Widget* ShowBubble( | 54 static views::Widget* ShowBubble( |
| 47 views::View* anchor_view, | 55 views::View* anchor_view, |
| 48 const gfx::Rect& anchor_rect, | 56 const gfx::Rect& anchor_rect, |
| 49 gfx::NativeView parent_window, | 57 gfx::NativeView parent_window, |
| 50 bookmarks::BookmarkBubbleObserver* observer, | 58 bookmarks::BookmarkBubbleObserver* observer, |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 | 112 |
| 105 // Handle the message when the user presses a button. | 113 // Handle the message when the user presses a button. |
| 106 void HandleButtonPressed(views::Button* sender); | 114 void HandleButtonPressed(views::Button* sender); |
| 107 | 115 |
| 108 // Shows the BookmarkEditor. | 116 // Shows the BookmarkEditor. |
| 109 void ShowEditor(); | 117 void ShowEditor(); |
| 110 | 118 |
| 111 // Sets the title and parent of the node. | 119 // Sets the title and parent of the node. |
| 112 void ApplyEdits(); | 120 void ApplyEdits(); |
| 113 | 121 |
| 122 // DesktopIOSPromotionFootnoteDelegate : |
| 123 void OnIOSPromotionFootnoteLinkClicked() override; |
| 124 |
| 114 #if defined(OS_WIN) | 125 #if defined(OS_WIN) |
| 126 // Check eligiblity to showthe iOS promotion from a specific entry point. |
| 127 bool IsIOSPromotionEligible( |
| 128 desktop_ios_promotion::PromotionEntryPoint entry_point); |
| 129 |
| 115 // Shows the iOS promotion. | 130 // Shows the iOS promotion. |
| 116 void ShowIOSPromotion(); | 131 void ShowIOSPromotion(desktop_ios_promotion::PromotionEntryPoint entry_point); |
| 117 #endif | 132 #endif |
| 118 | 133 |
| 119 // The bookmark bubble, if we're showing one. | 134 // The bookmark bubble, if we're showing one. |
| 120 static BookmarkBubbleView* bookmark_bubble_; | 135 static BookmarkBubbleView* bookmark_bubble_; |
| 121 | 136 |
| 122 // Our observer, to notify when the bubble shows or hides. | 137 // Our observer, to notify when the bubble shows or hides. |
| 123 bookmarks::BookmarkBubbleObserver* observer_; | 138 bookmarks::BookmarkBubbleObserver* observer_; |
| 124 | 139 |
| 125 // Delegate, to handle clicks on the sign in link. | 140 // Delegate, to handle clicks on the sign in link. |
| 126 std::unique_ptr<BubbleSyncPromoDelegate> delegate_; | 141 std::unique_ptr<BubbleSyncPromoDelegate> delegate_; |
| (...skipping 25 matching lines...) Expand all Loading... |
| 152 // the current parent. | 167 // the current parent. |
| 153 views::Combobox* parent_combobox_; | 168 views::Combobox* parent_combobox_; |
| 154 | 169 |
| 155 // Bookmark details view, contains the details of the bookmark with controls | 170 // Bookmark details view, contains the details of the bookmark with controls |
| 156 // to edit it. | 171 // to edit it. |
| 157 std::unique_ptr<View> bookmark_details_view_; | 172 std::unique_ptr<View> bookmark_details_view_; |
| 158 | 173 |
| 159 // iOS promotion view. | 174 // iOS promotion view. |
| 160 DesktopIOSPromotionBubbleView* ios_promo_view_; | 175 DesktopIOSPromotionBubbleView* ios_promo_view_; |
| 161 | 176 |
| 177 // Footnote view. |
| 178 views::View* footnote_view_; |
| 179 |
| 162 // When the destructor is invoked should the bookmark be removed? | 180 // When the destructor is invoked should the bookmark be removed? |
| 163 bool remove_bookmark_; | 181 bool remove_bookmark_; |
| 164 | 182 |
| 165 // When the destructor is invoked should edits be applied? | 183 // When the destructor is invoked should edits be applied? |
| 166 bool apply_edits_; | 184 bool apply_edits_; |
| 167 | 185 |
| 168 // Whether the Windows to iOS promotion is shown to the user. | 186 // Whether the Windows to iOS promotion is shown to the user. |
| 169 bool is_showing_ios_promotion_; | 187 bool is_showing_ios_promotion_; |
| 170 | 188 |
| 171 DISALLOW_COPY_AND_ASSIGN(BookmarkBubbleView); | 189 DISALLOW_COPY_AND_ASSIGN(BookmarkBubbleView); |
| 172 }; | 190 }; |
| 173 | 191 |
| 174 #endif // CHROME_BROWSER_UI_VIEWS_BOOKMARKS_BOOKMARK_BUBBLE_VIEW_H_ | 192 #endif // CHROME_BROWSER_UI_VIEWS_BOOKMARKS_BOOKMARK_BUBBLE_VIEW_H_ |
| OLD | NEW |