| 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 "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
| 9 #include "base/gtest_prod_util.h" | 9 #include "base/gtest_prod_util.h" |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| 11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
| 12 #include "base/strings/string16.h" | 12 #include "base/strings/string16.h" |
| 13 #include "chrome/browser/ui/bookmarks/recently_used_folders_combo_model.h" | 13 #include "chrome/browser/ui/bookmarks/recently_used_folders_combo_model.h" |
| 14 #include "chrome/browser/ui/sync/bubble_sync_promo_delegate.h" | 14 #include "chrome/browser/ui/sync/bubble_sync_promo_delegate.h" |
| 15 #include "ui/views/bubble/bubble_delegate.h" | 15 #include "ui/views/bubble/bubble_delegate.h" |
| 16 #include "ui/views/controls/button/button.h" | 16 #include "ui/views/controls/button/button.h" |
| 17 #include "ui/views/controls/combobox/combobox_listener.h" | 17 #include "ui/views/controls/combobox/combobox_listener.h" |
| 18 #include "ui/views/widget/widget_observer_view.h" |
| 18 #include "url/gurl.h" | 19 #include "url/gurl.h" |
| 19 | 20 |
| 20 class Profile; | 21 class Profile; |
| 21 | 22 |
| 22 namespace bookmarks { | 23 namespace bookmarks { |
| 23 class BookmarkBubbleObserver; | 24 class BookmarkBubbleObserver; |
| 24 } | 25 } |
| 25 | 26 |
| 26 namespace views { | 27 namespace views { |
| 27 class LabelButton; | 28 class LabelButton; |
| 28 class Textfield; | 29 class Textfield; |
| 29 } | 30 } |
| 30 | 31 |
| 31 // BookmarkBubbleView is a view intended to be used as the content of an | 32 // BookmarkBubbleView is a view intended to be used as the content of an |
| 32 // Bubble. BookmarkBubbleView provides views for unstarring and editing the | 33 // Bubble. BookmarkBubbleView provides views for unstarring and editing the |
| 33 // bookmark it is created with. Don't create a BookmarkBubbleView directly, | 34 // bookmark it is created with. Don't create a BookmarkBubbleView directly, |
| 34 // instead use the static Show method. | 35 // instead use the static Show method. |
| 35 class BookmarkBubbleView : public views::BubbleDelegateView, | 36 class BookmarkBubbleView : public views::BubbleDelegateView, |
| 36 public views::ButtonListener, | 37 public views::ButtonListener, |
| 37 public views::ComboboxListener { | 38 public views::ComboboxListener { |
| 38 public: | 39 public: |
| 39 // If |anchor_view| is null, |anchor_rect| is used to anchor the bubble and | 40 // If |anchor_view| is null, |anchor_rect| is used to anchor the bubble and |
| 40 // |parent_window| is used to ensure the bubble closes if the parent closes. | 41 // |parent_window| is used to ensure the bubble closes if the parent closes. |
| 41 static void ShowBubble(views::View* anchor_view, | 42 static void ShowBubble(views::WidgetObserverView* anchor_view, |
| 42 const gfx::Rect& anchor_rect, | 43 const gfx::Rect& anchor_rect, |
| 43 gfx::NativeView parent_window, | 44 gfx::NativeView parent_window, |
| 44 bookmarks::BookmarkBubbleObserver* observer, | 45 bookmarks::BookmarkBubbleObserver* observer, |
| 45 scoped_ptr<BubbleSyncPromoDelegate> delegate, | 46 scoped_ptr<BubbleSyncPromoDelegate> delegate, |
| 46 Profile* profile, | 47 Profile* profile, |
| 47 const GURL& url, | 48 const GURL& url, |
| 48 bool already_bookmarked); | 49 bool already_bookmarked); |
| 49 | 50 |
| 50 static void Hide(); | 51 static void Hide(); |
| 51 | 52 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 64 private: | 65 private: |
| 65 friend class BookmarkBubbleViewTest; | 66 friend class BookmarkBubbleViewTest; |
| 66 FRIEND_TEST_ALL_PREFIXES(BookmarkBubbleViewTest, SyncPromoSignedIn); | 67 FRIEND_TEST_ALL_PREFIXES(BookmarkBubbleViewTest, SyncPromoSignedIn); |
| 67 FRIEND_TEST_ALL_PREFIXES(BookmarkBubbleViewTest, SyncPromoNotSignedIn); | 68 FRIEND_TEST_ALL_PREFIXES(BookmarkBubbleViewTest, SyncPromoNotSignedIn); |
| 68 | 69 |
| 69 // views::BubbleDelegateView: | 70 // views::BubbleDelegateView: |
| 70 const char* GetClassName() const override; | 71 const char* GetClassName() const override; |
| 71 views::View* GetInitiallyFocusedView() override; | 72 views::View* GetInitiallyFocusedView() override; |
| 72 | 73 |
| 73 // Creates a BookmarkBubbleView. | 74 // Creates a BookmarkBubbleView. |
| 74 BookmarkBubbleView(views::View* anchor_view, | 75 BookmarkBubbleView(views::WidgetObserverView* anchor_view, |
| 75 bookmarks::BookmarkBubbleObserver* observer, | 76 bookmarks::BookmarkBubbleObserver* observer, |
| 76 scoped_ptr<BubbleSyncPromoDelegate> delegate, | 77 scoped_ptr<BubbleSyncPromoDelegate> delegate, |
| 77 Profile* profile, | 78 Profile* profile, |
| 78 const GURL& url, | 79 const GURL& url, |
| 79 bool newly_bookmarked); | 80 bool newly_bookmarked); |
| 80 | 81 |
| 81 // Returns the title to display. | 82 // Returns the title to display. |
| 82 base::string16 GetTitle(); | 83 base::string16 GetTitle(); |
| 83 | 84 |
| 84 // Overridden from views::View: | 85 // Overridden from views::View: |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 // When the destructor is invoked should the bookmark be removed? | 143 // When the destructor is invoked should the bookmark be removed? |
| 143 bool remove_bookmark_; | 144 bool remove_bookmark_; |
| 144 | 145 |
| 145 // When the destructor is invoked should edits be applied? | 146 // When the destructor is invoked should edits be applied? |
| 146 bool apply_edits_; | 147 bool apply_edits_; |
| 147 | 148 |
| 148 DISALLOW_COPY_AND_ASSIGN(BookmarkBubbleView); | 149 DISALLOW_COPY_AND_ASSIGN(BookmarkBubbleView); |
| 149 }; | 150 }; |
| 150 | 151 |
| 151 #endif // CHROME_BROWSER_UI_VIEWS_BOOKMARKS_BOOKMARK_BUBBLE_VIEW_H_ | 152 #endif // CHROME_BROWSER_UI_VIEWS_BOOKMARKS_BOOKMARK_BUBBLE_VIEW_H_ |
| OLD | NEW |