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" | |
14 #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" |
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 Profile; | 20 class Profile; |
21 | 21 |
22 namespace bookmarks { | 22 namespace bookmarks { |
23 class BookmarkBubbleObserver; | 23 class BookmarkBubbleObserver; |
24 } | 24 } |
(...skipping 10 matching lines...) Expand all Loading... |
35 class BookmarkBubbleView : public views::BubbleDelegateView, | 35 class BookmarkBubbleView : public views::BubbleDelegateView, |
36 public views::ButtonListener, | 36 public views::ButtonListener, |
37 public views::ComboboxListener { | 37 public views::ComboboxListener { |
38 public: | 38 public: |
39 // If |anchor_view| is null, |anchor_rect| is used to anchor the bubble and | 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. | 40 // |parent_window| is used to ensure the bubble closes if the parent closes. |
41 static void ShowBubble(views::View* anchor_view, | 41 static void ShowBubble(views::View* anchor_view, |
42 const gfx::Rect& anchor_rect, | 42 const gfx::Rect& anchor_rect, |
43 gfx::NativeView parent_window, | 43 gfx::NativeView parent_window, |
44 bookmarks::BookmarkBubbleObserver* observer, | 44 bookmarks::BookmarkBubbleObserver* observer, |
45 scoped_ptr<BookmarkBubbleDelegate> delegate, | 45 scoped_ptr<BubbleSyncPromoDelegate> delegate, |
46 Profile* profile, | 46 Profile* profile, |
47 const GURL& url, | 47 const GURL& url, |
48 bool already_bookmarked); | 48 bool already_bookmarked); |
49 | 49 |
50 static void Hide(); | 50 static void Hide(); |
51 | 51 |
52 static BookmarkBubbleView* bookmark_bubble() { return bookmark_bubble_; } | 52 static BookmarkBubbleView* bookmark_bubble() { return bookmark_bubble_; } |
53 | 53 |
54 ~BookmarkBubbleView() override; | 54 ~BookmarkBubbleView() override; |
55 | 55 |
(...skipping 10 matching lines...) Expand all Loading... |
66 FRIEND_TEST_ALL_PREFIXES(BookmarkBubbleViewTest, SyncPromoSignedIn); | 66 FRIEND_TEST_ALL_PREFIXES(BookmarkBubbleViewTest, SyncPromoSignedIn); |
67 FRIEND_TEST_ALL_PREFIXES(BookmarkBubbleViewTest, SyncPromoNotSignedIn); | 67 FRIEND_TEST_ALL_PREFIXES(BookmarkBubbleViewTest, SyncPromoNotSignedIn); |
68 | 68 |
69 // views::BubbleDelegateView: | 69 // views::BubbleDelegateView: |
70 const char* GetClassName() const override; | 70 const char* GetClassName() const override; |
71 views::View* GetInitiallyFocusedView() override; | 71 views::View* GetInitiallyFocusedView() override; |
72 | 72 |
73 // Creates a BookmarkBubbleView. | 73 // Creates a BookmarkBubbleView. |
74 BookmarkBubbleView(views::View* anchor_view, | 74 BookmarkBubbleView(views::View* anchor_view, |
75 bookmarks::BookmarkBubbleObserver* observer, | 75 bookmarks::BookmarkBubbleObserver* observer, |
76 scoped_ptr<BookmarkBubbleDelegate> delegate, | 76 scoped_ptr<BubbleSyncPromoDelegate> delegate, |
77 Profile* profile, | 77 Profile* profile, |
78 const GURL& url, | 78 const GURL& url, |
79 bool newly_bookmarked); | 79 bool newly_bookmarked); |
80 | 80 |
81 // Returns the title to display. | 81 // Returns the title to display. |
82 base::string16 GetTitle(); | 82 base::string16 GetTitle(); |
83 | 83 |
84 // Overridden from views::View: | 84 // Overridden from views::View: |
85 void GetAccessibleState(ui::AXViewState* state) override; | 85 void GetAccessibleState(ui::AXViewState* state) override; |
86 | 86 |
(...skipping 13 matching lines...) Expand all Loading... |
100 // Sets the title and parent of the node. | 100 // Sets the title and parent of the node. |
101 void ApplyEdits(); | 101 void ApplyEdits(); |
102 | 102 |
103 // The bookmark bubble, if we're showing one. | 103 // The bookmark bubble, if we're showing one. |
104 static BookmarkBubbleView* bookmark_bubble_; | 104 static BookmarkBubbleView* bookmark_bubble_; |
105 | 105 |
106 // Our observer, to notify when the bubble shows or hides. | 106 // Our observer, to notify when the bubble shows or hides. |
107 bookmarks::BookmarkBubbleObserver* observer_; | 107 bookmarks::BookmarkBubbleObserver* observer_; |
108 | 108 |
109 // Delegate, to handle clicks on the sign in link. | 109 // Delegate, to handle clicks on the sign in link. |
110 scoped_ptr<BookmarkBubbleDelegate> delegate_; | 110 scoped_ptr<BubbleSyncPromoDelegate> delegate_; |
111 | 111 |
112 // The profile. | 112 // The profile. |
113 Profile* profile_; | 113 Profile* profile_; |
114 | 114 |
115 // The bookmark URL. | 115 // The bookmark URL. |
116 const GURL url_; | 116 const GURL url_; |
117 | 117 |
118 // If true, the page was just bookmarked. | 118 // If true, the page was just bookmarked. |
119 const bool newly_bookmarked_; | 119 const bool newly_bookmarked_; |
120 | 120 |
(...skipping 21 matching lines...) Expand all Loading... |
142 // When the destructor is invoked should the bookmark be removed? | 142 // When the destructor is invoked should the bookmark be removed? |
143 bool remove_bookmark_; | 143 bool remove_bookmark_; |
144 | 144 |
145 // When the destructor is invoked should edits be applied? | 145 // When the destructor is invoked should edits be applied? |
146 bool apply_edits_; | 146 bool apply_edits_; |
147 | 147 |
148 DISALLOW_COPY_AND_ASSIGN(BookmarkBubbleView); | 148 DISALLOW_COPY_AND_ASSIGN(BookmarkBubbleView); |
149 }; | 149 }; |
150 | 150 |
151 #endif // CHROME_BROWSER_UI_VIEWS_BOOKMARKS_BOOKMARK_BUBBLE_VIEW_H_ | 151 #endif // CHROME_BROWSER_UI_VIEWS_BOOKMARKS_BOOKMARK_BUBBLE_VIEW_H_ |
OLD | NEW |