Chromium Code Reviews| 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/sync/bubble_sync_promo_delegate.h" | 15 #include "chrome/browser/ui/sync/bubble_sync_promo_delegate.h" |
| 16 #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" |
| 17 #include "ui/views/controls/button/button.h" | 17 #include "ui/views/controls/button/button.h" |
| 18 #include "ui/views/controls/combobox/combobox_listener.h" | 18 #include "ui/views/controls/combobox/combobox_listener.h" |
| 19 #include "url/gurl.h" | 19 #include "url/gurl.h" |
| 20 | 20 |
| 21 class Profile; | 21 class Profile; |
| 22 | 22 |
| 23 class DesktopIOSPromotionBubbleView; | |
| 24 | |
| 23 namespace bookmarks { | 25 namespace bookmarks { |
| 24 class BookmarkBubbleObserver; | 26 class BookmarkBubbleObserver; |
| 25 } | 27 } |
| 26 | 28 |
| 27 namespace views { | 29 namespace views { |
| 28 class LabelButton; | 30 class LabelButton; |
| 29 class Textfield; | 31 class Textfield; |
| 30 } | 32 } |
| 31 | 33 |
| 32 // BookmarkBubbleView is a view intended to be used as the content of an | 34 // BookmarkBubbleView is a view intended to be used as the content of an |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 53 | 55 |
| 54 static void Hide(); | 56 static void Hide(); |
| 55 | 57 |
| 56 static BookmarkBubbleView* bookmark_bubble() { return bookmark_bubble_; } | 58 static BookmarkBubbleView* bookmark_bubble() { return bookmark_bubble_; } |
| 57 | 59 |
| 58 ~BookmarkBubbleView() override; | 60 ~BookmarkBubbleView() override; |
| 59 | 61 |
| 60 // views::WidgetDelegate: | 62 // views::WidgetDelegate: |
| 61 void WindowClosing() override; | 63 void WindowClosing() override; |
| 62 bool AcceleratorPressed(const ui::Accelerator& accelerator) override; | 64 bool AcceleratorPressed(const ui::Accelerator& accelerator) override; |
| 65 gfx::ImageSkia GetWindowIcon() override; | |
| 66 bool ShouldShowWindowIcon() const override; | |
| 63 | 67 |
| 64 protected: | 68 protected: |
| 65 // views::BubbleDialogDelegateView method. | 69 // views::BubbleDialogDelegateView method. |
| 66 void Init() override; | 70 void Init() override; |
| 67 base::string16 GetWindowTitle() const override; | 71 base::string16 GetWindowTitle() const override; |
| 68 | 72 |
| 69 private: | 73 private: |
| 70 friend class BookmarkBubbleViewTest; | 74 friend class BookmarkBubbleViewTest; |
| 75 friend class BookmarkBubbleBrowserTest; | |
| 71 FRIEND_TEST_ALL_PREFIXES(BookmarkBubbleViewTest, SyncPromoSignedIn); | 76 FRIEND_TEST_ALL_PREFIXES(BookmarkBubbleViewTest, SyncPromoSignedIn); |
| 72 FRIEND_TEST_ALL_PREFIXES(BookmarkBubbleViewTest, SyncPromoNotSignedIn); | 77 FRIEND_TEST_ALL_PREFIXES(BookmarkBubbleViewTest, SyncPromoNotSignedIn); |
| 73 | 78 |
| 74 // views::BubbleDialogDelegateView: | 79 // views::BubbleDialogDelegateView: |
| 75 const char* GetClassName() const override; | 80 const char* GetClassName() const override; |
| 76 View* GetInitiallyFocusedView() override; | 81 View* GetInitiallyFocusedView() override; |
| 77 View* CreateFootnoteView() override; | 82 View* CreateFootnoteView() override; |
| 78 | 83 |
| 79 // Creates a BookmarkBubbleView. | 84 // Creates a BookmarkBubbleView. |
| 80 BookmarkBubbleView(views::View* anchor_view, | 85 BookmarkBubbleView(views::View* anchor_view, |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 99 | 104 |
| 100 // Handle the message when the user presses a button. | 105 // Handle the message when the user presses a button. |
| 101 void HandleButtonPressed(views::Button* sender); | 106 void HandleButtonPressed(views::Button* sender); |
| 102 | 107 |
| 103 // Shows the BookmarkEditor. | 108 // Shows the BookmarkEditor. |
| 104 void ShowEditor(); | 109 void ShowEditor(); |
| 105 | 110 |
| 106 // Sets the title and parent of the node. | 111 // Sets the title and parent of the node. |
| 107 void ApplyEdits(); | 112 void ApplyEdits(); |
| 108 | 113 |
| 114 #if defined(OS_WIN) | |
| 115 // Shows the iOS promotion. | |
| 116 void ShowIOSPromotion(); | |
| 117 #endif | |
| 118 | |
| 109 // The bookmark bubble, if we're showing one. | 119 // The bookmark bubble, if we're showing one. |
| 110 static BookmarkBubbleView* bookmark_bubble_; | 120 static BookmarkBubbleView* bookmark_bubble_; |
| 111 | 121 |
| 112 // Our observer, to notify when the bubble shows or hides. | 122 // Our observer, to notify when the bubble shows or hides. |
| 113 bookmarks::BookmarkBubbleObserver* observer_; | 123 bookmarks::BookmarkBubbleObserver* observer_; |
| 114 | 124 |
| 115 // Delegate, to handle clicks on the sign in link. | 125 // Delegate, to handle clicks on the sign in link. |
| 116 std::unique_ptr<BubbleSyncPromoDelegate> delegate_; | 126 std::unique_ptr<BubbleSyncPromoDelegate> delegate_; |
| 117 | 127 |
| 118 // The profile. | 128 // The profile. |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 135 // Button to close the window. | 145 // Button to close the window. |
| 136 views::LabelButton* close_button_; | 146 views::LabelButton* close_button_; |
| 137 | 147 |
| 138 // Textfield showing the title of the bookmark. | 148 // Textfield showing the title of the bookmark. |
| 139 views::Textfield* title_tf_; | 149 views::Textfield* title_tf_; |
| 140 | 150 |
| 141 // Combobox showing a handful of folders the user can choose from, including | 151 // Combobox showing a handful of folders the user can choose from, including |
| 142 // the current parent. | 152 // the current parent. |
| 143 views::Combobox* parent_combobox_; | 153 views::Combobox* parent_combobox_; |
| 144 | 154 |
| 155 // Bookmark details view, contains the details of the bookmark with controls | |
| 156 // to edit it. | |
| 157 View* bookmark_details_view_; | |
|
sky
2017/03/29 21:54:37
I believe you leak this.
mrefaat
2017/03/30 17:37:15
Done.
| |
| 158 | |
| 159 // iOS promotion view. | |
| 160 DesktopIOSPromotionBubbleView* ios_promo_view_; | |
| 161 | |
| 145 // When the destructor is invoked should the bookmark be removed? | 162 // When the destructor is invoked should the bookmark be removed? |
| 146 bool remove_bookmark_; | 163 bool remove_bookmark_; |
| 147 | 164 |
| 148 // When the destructor is invoked should edits be applied? | 165 // When the destructor is invoked should edits be applied? |
| 149 bool apply_edits_; | 166 bool apply_edits_; |
| 150 | 167 |
| 168 // Whether the Windows to iOS promotion is shown to the user. | |
| 169 bool is_showing_ios_promotion_; | |
| 170 | |
| 151 DISALLOW_COPY_AND_ASSIGN(BookmarkBubbleView); | 171 DISALLOW_COPY_AND_ASSIGN(BookmarkBubbleView); |
| 152 }; | 172 }; |
| 153 | 173 |
| 154 #endif // CHROME_BROWSER_UI_VIEWS_BOOKMARKS_BOOKMARK_BUBBLE_VIEW_H_ | 174 #endif // CHROME_BROWSER_UI_VIEWS_BOOKMARKS_BOOKMARK_BUBBLE_VIEW_H_ |
| OLD | NEW |