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: |
36 static void ShowBubble(views::View* anchor_view, | 39 static void ShowBubble(views::View* anchor_view, |
37 BookmarkBubbleViewObserver* observer, | 40 bookmarks::BookmarkBubbleObserver* observer, |
38 scoped_ptr<BookmarkBubbleDelegate> delegate, | 41 scoped_ptr<BookmarkBubbleDelegate> delegate, |
39 Profile* profile, | 42 Profile* profile, |
40 const GURL& url, | 43 const GURL& url, |
41 bool newly_bookmarked); | 44 bool newly_bookmarked); |
42 | 45 |
43 static void Hide(); | 46 static void Hide(); |
44 | 47 |
45 static BookmarkBubbleView* bookmark_bubble() { return bookmark_bubble_; } | 48 static BookmarkBubbleView* bookmark_bubble() { return bookmark_bubble_; } |
46 | 49 |
47 ~BookmarkBubbleView() override; | 50 ~BookmarkBubbleView() override; |
(...skipping 10 matching lines...) Expand all Loading... |
58 friend class BookmarkBubbleViewTest; | 61 friend class BookmarkBubbleViewTest; |
59 FRIEND_TEST_ALL_PREFIXES(BookmarkBubbleViewTest, SyncPromoSignedIn); | 62 FRIEND_TEST_ALL_PREFIXES(BookmarkBubbleViewTest, SyncPromoSignedIn); |
60 FRIEND_TEST_ALL_PREFIXES(BookmarkBubbleViewTest, SyncPromoNotSignedIn); | 63 FRIEND_TEST_ALL_PREFIXES(BookmarkBubbleViewTest, SyncPromoNotSignedIn); |
61 | 64 |
62 // views::BubbleDelegateView: | 65 // views::BubbleDelegateView: |
63 const char* GetClassName() const override; | 66 const char* GetClassName() const override; |
64 views::View* GetInitiallyFocusedView() override; | 67 views::View* GetInitiallyFocusedView() override; |
65 | 68 |
66 // Creates a BookmarkBubbleView. | 69 // Creates a BookmarkBubbleView. |
67 BookmarkBubbleView(views::View* anchor_view, | 70 BookmarkBubbleView(views::View* anchor_view, |
68 BookmarkBubbleViewObserver* observer, | 71 bookmarks::BookmarkBubbleObserver* observer, |
69 scoped_ptr<BookmarkBubbleDelegate> delegate, | 72 scoped_ptr<BookmarkBubbleDelegate> delegate, |
70 Profile* profile, | 73 Profile* profile, |
71 const GURL& url, | 74 const GURL& url, |
72 bool newly_bookmarked); | 75 bool newly_bookmarked); |
73 | 76 |
74 // Returns the title to display. | 77 // Returns the title to display. |
75 base::string16 GetTitle(); | 78 base::string16 GetTitle(); |
76 | 79 |
77 // Overridden from views::View: | 80 // Overridden from views::View: |
78 void GetAccessibleState(ui::AXViewState* state) override; | 81 void GetAccessibleState(ui::AXViewState* state) override; |
(...skipping 11 matching lines...) Expand all Loading... |
90 // Shows the BookmarkEditor. | 93 // Shows the BookmarkEditor. |
91 void ShowEditor(); | 94 void ShowEditor(); |
92 | 95 |
93 // Sets the title and parent of the node. | 96 // Sets the title and parent of the node. |
94 void ApplyEdits(); | 97 void ApplyEdits(); |
95 | 98 |
96 // The bookmark bubble, if we're showing one. | 99 // The bookmark bubble, if we're showing one. |
97 static BookmarkBubbleView* bookmark_bubble_; | 100 static BookmarkBubbleView* bookmark_bubble_; |
98 | 101 |
99 // Our observer, to notify when the bubble shows or hides. | 102 // Our observer, to notify when the bubble shows or hides. |
100 BookmarkBubbleViewObserver* observer_; | 103 bookmarks::BookmarkBubbleObserver* observer_; |
101 | 104 |
102 // Delegate, to handle clicks on the sign in link. | 105 // Delegate, to handle clicks on the sign in link. |
103 scoped_ptr<BookmarkBubbleDelegate> delegate_; | 106 scoped_ptr<BookmarkBubbleDelegate> delegate_; |
104 | 107 |
105 // The profile. | 108 // The profile. |
106 Profile* profile_; | 109 Profile* profile_; |
107 | 110 |
108 // The bookmark URL. | 111 // The bookmark URL. |
109 const GURL url_; | 112 const GURL url_; |
110 | 113 |
(...skipping 24 matching lines...) Expand all Loading... |
135 // When the destructor is invoked should the bookmark be removed? | 138 // When the destructor is invoked should the bookmark be removed? |
136 bool remove_bookmark_; | 139 bool remove_bookmark_; |
137 | 140 |
138 // When the destructor is invoked should edits be applied? | 141 // When the destructor is invoked should edits be applied? |
139 bool apply_edits_; | 142 bool apply_edits_; |
140 | 143 |
141 DISALLOW_COPY_AND_ASSIGN(BookmarkBubbleView); | 144 DISALLOW_COPY_AND_ASSIGN(BookmarkBubbleView); |
142 }; | 145 }; |
143 | 146 |
144 #endif // CHROME_BROWSER_UI_VIEWS_BOOKMARKS_BOOKMARK_BUBBLE_VIEW_H_ | 147 #endif // CHROME_BROWSER_UI_VIEWS_BOOKMARKS_BOOKMARK_BUBBLE_VIEW_H_ |
OLD | NEW |