| 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/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 #include "base/gtest_prod_util.h" | 10 #include "base/gtest_prod_util.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/bookmark_bubble_delegate.h" | 13 #include "chrome/browser/ui/bookmarks/bookmark_bubble_delegate.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 "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 "url/gurl.h" | 18 #include "url/gurl.h" |
| 19 | 19 |
| 20 class BookmarkBubbleViewObserver; | |
| 21 class Profile; | 20 class Profile; |
| 22 | 21 |
| 22 namespace bookmarks { |
| 23 class BookmarkBubbleObserver; |
| 24 } |
| 25 |
| 23 namespace views { | 26 namespace views { |
| 24 class LabelButton; | 27 class LabelButton; |
| 25 class Textfield; | 28 class Textfield; |
| 26 } | 29 } |
| 27 | 30 |
| 28 // BookmarkBubbleView is a view intended to be used as the content of an | 31 // BookmarkBubbleView is a view intended to be used as the content of an |
| 29 // Bubble. BookmarkBubbleView provides views for unstarring and editing the | 32 // Bubble. BookmarkBubbleView provides views for unstarring and editing the |
| 30 // bookmark it is created with. Don't create a BookmarkBubbleView directly, | 33 // bookmark it is created with. Don't create a BookmarkBubbleView directly, |
| 31 // instead use the static Show method. | 34 // instead use the static Show method. |
| 32 class BookmarkBubbleView : public views::BubbleDelegateView, | 35 class BookmarkBubbleView : public views::BubbleDelegateView, |
| 33 public views::ButtonListener, | 36 public views::ButtonListener, |
| 34 public views::ComboboxListener { | 37 public views::ComboboxListener { |
| 35 public: | 38 public: |
| 39 // 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. |
| 36 static void ShowBubble(views::View* anchor_view, | 41 static void ShowBubble(views::View* anchor_view, |
| 37 BookmarkBubbleViewObserver* observer, | 42 const gfx::Rect& anchor_rect, |
| 43 gfx::NativeView parent_window, |
| 44 bookmarks::BookmarkBubbleObserver* observer, |
| 38 scoped_ptr<BookmarkBubbleDelegate> delegate, | 45 scoped_ptr<BookmarkBubbleDelegate> delegate, |
| 39 Profile* profile, | 46 Profile* profile, |
| 40 const GURL& url, | 47 const GURL& url, |
| 41 bool newly_bookmarked); | 48 bool newly_bookmarked); |
| 42 | 49 |
| 43 static void Hide(); | 50 static void Hide(); |
| 44 | 51 |
| 45 static BookmarkBubbleView* bookmark_bubble() { return bookmark_bubble_; } | 52 static BookmarkBubbleView* bookmark_bubble() { return bookmark_bubble_; } |
| 46 | 53 |
| 47 ~BookmarkBubbleView() override; | 54 ~BookmarkBubbleView() override; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 58 friend class BookmarkBubbleViewTest; | 65 friend class BookmarkBubbleViewTest; |
| 59 FRIEND_TEST_ALL_PREFIXES(BookmarkBubbleViewTest, SyncPromoSignedIn); | 66 FRIEND_TEST_ALL_PREFIXES(BookmarkBubbleViewTest, SyncPromoSignedIn); |
| 60 FRIEND_TEST_ALL_PREFIXES(BookmarkBubbleViewTest, SyncPromoNotSignedIn); | 67 FRIEND_TEST_ALL_PREFIXES(BookmarkBubbleViewTest, SyncPromoNotSignedIn); |
| 61 | 68 |
| 62 // views::BubbleDelegateView: | 69 // views::BubbleDelegateView: |
| 63 const char* GetClassName() const override; | 70 const char* GetClassName() const override; |
| 64 views::View* GetInitiallyFocusedView() override; | 71 views::View* GetInitiallyFocusedView() override; |
| 65 | 72 |
| 66 // Creates a BookmarkBubbleView. | 73 // Creates a BookmarkBubbleView. |
| 67 BookmarkBubbleView(views::View* anchor_view, | 74 BookmarkBubbleView(views::View* anchor_view, |
| 68 BookmarkBubbleViewObserver* observer, | 75 bookmarks::BookmarkBubbleObserver* observer, |
| 69 scoped_ptr<BookmarkBubbleDelegate> delegate, | 76 scoped_ptr<BookmarkBubbleDelegate> delegate, |
| 70 Profile* profile, | 77 Profile* profile, |
| 71 const GURL& url, | 78 const GURL& url, |
| 72 bool newly_bookmarked); | 79 bool newly_bookmarked); |
| 73 | 80 |
| 74 // Returns the title to display. | 81 // Returns the title to display. |
| 75 base::string16 GetTitle(); | 82 base::string16 GetTitle(); |
| 76 | 83 |
| 77 // Overridden from views::View: | 84 // Overridden from views::View: |
| 78 void GetAccessibleState(ui::AXViewState* state) override; | 85 void GetAccessibleState(ui::AXViewState* state) override; |
| (...skipping 11 matching lines...) Expand all Loading... |
| 90 // Shows the BookmarkEditor. | 97 // Shows the BookmarkEditor. |
| 91 void ShowEditor(); | 98 void ShowEditor(); |
| 92 | 99 |
| 93 // Sets the title and parent of the node. | 100 // Sets the title and parent of the node. |
| 94 void ApplyEdits(); | 101 void ApplyEdits(); |
| 95 | 102 |
| 96 // The bookmark bubble, if we're showing one. | 103 // The bookmark bubble, if we're showing one. |
| 97 static BookmarkBubbleView* bookmark_bubble_; | 104 static BookmarkBubbleView* bookmark_bubble_; |
| 98 | 105 |
| 99 // Our observer, to notify when the bubble shows or hides. | 106 // Our observer, to notify when the bubble shows or hides. |
| 100 BookmarkBubbleViewObserver* observer_; | 107 bookmarks::BookmarkBubbleObserver* observer_; |
| 101 | 108 |
| 102 // Delegate, to handle clicks on the sign in link. | 109 // Delegate, to handle clicks on the sign in link. |
| 103 scoped_ptr<BookmarkBubbleDelegate> delegate_; | 110 scoped_ptr<BookmarkBubbleDelegate> delegate_; |
| 104 | 111 |
| 105 // The profile. | 112 // The profile. |
| 106 Profile* profile_; | 113 Profile* profile_; |
| 107 | 114 |
| 108 // The bookmark URL. | 115 // The bookmark URL. |
| 109 const GURL url_; | 116 const GURL url_; |
| 110 | 117 |
| (...skipping 24 matching lines...) Expand all Loading... |
| 135 // When the destructor is invoked should the bookmark be removed? | 142 // When the destructor is invoked should the bookmark be removed? |
| 136 bool remove_bookmark_; | 143 bool remove_bookmark_; |
| 137 | 144 |
| 138 // When the destructor is invoked should edits be applied? | 145 // When the destructor is invoked should edits be applied? |
| 139 bool apply_edits_; | 146 bool apply_edits_; |
| 140 | 147 |
| 141 DISALLOW_COPY_AND_ASSIGN(BookmarkBubbleView); | 148 DISALLOW_COPY_AND_ASSIGN(BookmarkBubbleView); |
| 142 }; | 149 }; |
| 143 | 150 |
| 144 #endif // CHROME_BROWSER_UI_VIEWS_BOOKMARKS_BOOKMARK_BUBBLE_VIEW_H_ | 151 #endif // CHROME_BROWSER_UI_VIEWS_BOOKMARKS_BOOKMARK_BUBBLE_VIEW_H_ |
| OLD | NEW |