Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(337)

Side by Side Diff: chrome/browser/ui/views/bookmarks/bookmark_bubble_view.h

Issue 18603006: Bookmark sync promo for Views. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: BookmarkBubbleView independant from browser, layout_constants and CAPS for enum Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/strings/string16.h" 11 #include "base/strings/string16.h"
11 #include "chrome/browser/ui/bookmarks/recently_used_folders_combo_model.h" 12 #include "chrome/browser/ui/bookmarks/recently_used_folders_combo_model.h"
12 #include "ui/views/bubble/bubble_delegate.h" 13 #include "ui/views/bubble/bubble_delegate.h"
13 #include "ui/views/controls/button/button.h" 14 #include "ui/views/controls/button/button.h"
14 #include "ui/views/controls/combobox/combobox_listener.h" 15 #include "ui/views/controls/combobox/combobox_listener.h"
15 #include "url/gurl.h" 16 #include "url/gurl.h"
16 17
17 class BookmarkBubbleViewObserver; 18 class BookmarkBubbleViewObserver;
18 class Profile; 19 class Profile;
19 20
20 namespace views { 21 namespace views {
21 class LabelButton; 22 class LabelButton;
22 class Textfield; 23 class Textfield;
23 } 24 }
24 25
25 // BookmarkBubbleView is a view intended to be used as the content of an 26 // BookmarkBubbleView is a view intended to be used as the content of an
26 // Bubble. BookmarkBubbleView provides views for unstarring and editing the 27 // Bubble. BookmarkBubbleView provides views for unstarring and editing the
27 // bookmark it is created with. Don't create a BookmarkBubbleView directly, 28 // bookmark it is created with. Don't create a BookmarkBubbleView directly,
28 // instead use the static Show method. 29 // instead use the static Show method.
29 class BookmarkBubbleView : public views::BubbleDelegateView, 30 class BookmarkBubbleView : public views::BubbleDelegateView,
30 public views::ButtonListener, 31 public views::ButtonListener,
31 public views::ComboboxListener { 32 public views::ComboboxListener {
32 public: 33 public:
33 static void ShowBubble(views::View* anchor_view, 34 static void ShowBubble(views::View* anchor_view,
34 BookmarkBubbleViewObserver* observer, 35 BookmarkBubbleViewObserver* observer,
35 Profile* profile, 36 Profile* profile,
36 const GURL& url, 37 const GURL& url,
37 bool newly_bookmarked); 38 bool newly_bookmarked,
39 views::View* sync_promo_view);
38 40
39 static bool IsShowing(); 41 static bool IsShowing();
40 42
41 static void Hide(); 43 static void Hide();
42 44
43 virtual ~BookmarkBubbleView(); 45 virtual ~BookmarkBubbleView();
44 46
45 // views::BubbleDelegateView method. 47 // views::BubbleDelegateView method.
46 virtual views::View* GetInitiallyFocusedView() OVERRIDE; 48 virtual views::View* GetInitiallyFocusedView() OVERRIDE;
47 49
48 // views::WidgetDelegate method. 50 // views::WidgetDelegate method.
49 virtual void WindowClosing() OVERRIDE; 51 virtual void WindowClosing() OVERRIDE;
50 52
51 // views::View method. 53 // views::View method.
52 virtual bool AcceleratorPressed(const ui::Accelerator& accelerator) OVERRIDE; 54 virtual bool AcceleratorPressed(const ui::Accelerator& accelerator) OVERRIDE;
53 55
54 protected: 56 protected:
55 // views::BubbleDelegateView method. 57 // views::BubbleDelegateView method.
56 virtual void Init() OVERRIDE; 58 virtual void Init() OVERRIDE;
57 59
58 private: 60 private:
61 friend class BookmarkBubbleViewBrowserTest;
62 FRIEND_TEST_ALL_PREFIXES(BookmarkBubbleViewBrowserTest,
63 SyncPromoSignedIn);
64 FRIEND_TEST_ALL_PREFIXES(BookmarkBubbleViewBrowserTest,
65 SyncPromoNotSignedIn);
66
59 // Creates a BookmarkBubbleView. 67 // Creates a BookmarkBubbleView.
60 BookmarkBubbleView(views::View* anchor_view, 68 BookmarkBubbleView(views::View* anchor_view,
61 BookmarkBubbleViewObserver* observer, 69 BookmarkBubbleViewObserver* observer,
62 Profile* profile, 70 Profile* profile,
63 const GURL& url, 71 const GURL& url,
64 bool newly_bookmarked); 72 bool newly_bookmarked,
73 views::View* sync_promo_view);
65 74
66 // Returns the title to display. 75 // Returns the title to display.
67 string16 GetTitle(); 76 string16 GetTitle();
68 77
69 // Overridden from views::View: 78 // Overridden from views::View:
70 virtual gfx::Size GetMinimumSize() OVERRIDE; 79 virtual gfx::Size GetMinimumSize() OVERRIDE;
71 80
72 // Overridden from views::ButtonListener: 81 // Overridden from views::ButtonListener:
73 // Closes the bubble or opens the edit dialog. 82 // Closes the bubble or opens the edit dialog.
74 virtual void ButtonPressed(views::Button* sender, 83 virtual void ButtonPressed(views::Button* sender,
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 // Button to close the window. 121 // Button to close the window.
113 views::LabelButton* close_button_; 122 views::LabelButton* close_button_;
114 123
115 // Textfield showing the title of the bookmark. 124 // Textfield showing the title of the bookmark.
116 views::Textfield* title_tf_; 125 views::Textfield* title_tf_;
117 126
118 // Combobox showing a handful of folders the user can choose from, including 127 // Combobox showing a handful of folders the user can choose from, including
119 // the current parent. 128 // the current parent.
120 views::Combobox* parent_combobox_; 129 views::Combobox* parent_combobox_;
121 130
131 // Bookmark sync promo view, if displayed.
132 views::View* sync_promo_view_;
133
122 // When the destructor is invoked should the bookmark be removed? 134 // When the destructor is invoked should the bookmark be removed?
123 bool remove_bookmark_; 135 bool remove_bookmark_;
124 136
125 // When the destructor is invoked should edits be applied? 137 // When the destructor is invoked should edits be applied?
126 bool apply_edits_; 138 bool apply_edits_;
127 139
128 DISALLOW_COPY_AND_ASSIGN(BookmarkBubbleView); 140 DISALLOW_COPY_AND_ASSIGN(BookmarkBubbleView);
129 }; 141 };
130 142
131 #endif // CHROME_BROWSER_UI_VIEWS_BOOKMARKS_BOOKMARK_BUBBLE_VIEW_H_ 143 #endif // CHROME_BROWSER_UI_VIEWS_BOOKMARKS_BOOKMARK_BUBBLE_VIEW_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698