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/strings/string16.h" | 10 #include "base/strings/string16.h" |
11 #include "chrome/browser/ui/bookmarks/recently_used_folders_combo_model.h" | 11 #include "chrome/browser/ui/bookmarks/recently_used_folders_combo_model.h" |
12 #include "googleurl/src/gurl.h" | 12 #include "googleurl/src/gurl.h" |
13 #include "ui/views/bubble/bubble_delegate.h" | 13 #include "ui/views/bubble/bubble_delegate.h" |
14 #include "ui/views/controls/button/button.h" | 14 #include "ui/views/controls/button/button.h" |
15 #include "ui/views/controls/combobox/combobox_listener.h" | 15 #include "ui/views/controls/combobox/combobox_listener.h" |
| 16 #include "ui/views/controls/link_listener.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, |
| 31 public views::LinkListener, |
30 public views::ButtonListener, | 32 public views::ButtonListener, |
31 public views::ComboboxListener { | 33 public views::ComboboxListener { |
32 public: | 34 public: |
33 static void ShowBubble(views::View* anchor_view, | 35 static void ShowBubble(views::View* anchor_view, |
34 BookmarkBubbleViewObserver* observer, | 36 BookmarkBubbleViewObserver* observer, |
35 Profile* profile, | 37 Profile* profile, |
36 const GURL& url, | 38 const GURL& url, |
37 bool newly_bookmarked); | 39 bool newly_bookmarked); |
38 | 40 |
39 static bool IsShowing(); | 41 static bool IsShowing(); |
(...skipping 19 matching lines...) Expand all Loading... |
59 // Creates a BookmarkBubbleView. | 61 // Creates a BookmarkBubbleView. |
60 BookmarkBubbleView(views::View* anchor_view, | 62 BookmarkBubbleView(views::View* anchor_view, |
61 BookmarkBubbleViewObserver* observer, | 63 BookmarkBubbleViewObserver* observer, |
62 Profile* profile, | 64 Profile* profile, |
63 const GURL& url, | 65 const GURL& url, |
64 bool newly_bookmarked); | 66 bool newly_bookmarked); |
65 | 67 |
66 // Returns the title to display. | 68 // Returns the title to display. |
67 string16 GetTitle(); | 69 string16 GetTitle(); |
68 | 70 |
69 // Overridden from views::View: | 71 // Overridden from views::LinkListener: |
70 virtual gfx::Size GetMinimumSize() OVERRIDE; | 72 // Either unstars the item or shows the bookmark editor (depending upon which |
71 virtual void ViewHierarchyChanged( | 73 // link was clicked). |
72 const ViewHierarchyChangedDetails& details) OVERRIDE; | 74 virtual void LinkClicked(views::Link* source, int event_flags) OVERRIDE; |
73 | 75 |
74 // Overridden from views::ButtonListener: | 76 // Overridden from views::ButtonListener: |
75 // Closes the bubble or opens the edit dialog. | 77 // Closes the bubble or opens the edit dialog. |
76 virtual void ButtonPressed(views::Button* sender, | 78 virtual void ButtonPressed(views::Button* sender, |
77 const ui::Event& event) OVERRIDE; | 79 const ui::Event& event) OVERRIDE; |
78 | 80 |
79 // Overridden from views::ComboboxListener: | 81 // Overridden from views::ComboboxListener: |
80 virtual void OnSelectedIndexChanged(views::Combobox* combobox) OVERRIDE; | 82 virtual void OnSelectedIndexChanged(views::Combobox* combobox) OVERRIDE; |
81 | 83 |
82 // Handle the message when the user presses a button. | 84 // Handle the message when the user presses a button. |
(...skipping 15 matching lines...) Expand all Loading... |
98 Profile* profile_; | 100 Profile* profile_; |
99 | 101 |
100 // The bookmark URL. | 102 // The bookmark URL. |
101 const GURL url_; | 103 const GURL url_; |
102 | 104 |
103 // If true, the page was just bookmarked. | 105 // If true, the page was just bookmarked. |
104 const bool newly_bookmarked_; | 106 const bool newly_bookmarked_; |
105 | 107 |
106 RecentlyUsedFoldersComboModel parent_model_; | 108 RecentlyUsedFoldersComboModel parent_model_; |
107 | 109 |
108 // Button for removing the bookmark. | 110 // Link for removing/unstarring the bookmark. |
109 views::LabelButton* remove_button_; | 111 views::Link* remove_link_; |
110 | 112 |
111 // Button to bring up the editor. | 113 // Button to bring up the editor. |
112 views::LabelButton* edit_button_; | 114 views::LabelButton* edit_button_; |
113 | 115 |
114 // Button to close the window. | 116 // Button to close the window. |
115 views::LabelButton* close_button_; | 117 views::LabelButton* close_button_; |
116 | 118 |
117 // Textfield showing the title of the bookmark. | 119 // Textfield showing the title of the bookmark. |
118 views::Textfield* title_tf_; | 120 views::Textfield* title_tf_; |
119 | 121 |
120 // Combobox showing a handful of folders the user can choose from, including | 122 // Combobox showing a handful of folders the user can choose from, including |
121 // the current parent. | 123 // the current parent. |
122 views::Combobox* parent_combobox_; | 124 views::Combobox* parent_combobox_; |
123 | 125 |
124 // When the destructor is invoked should the bookmark be removed? | 126 // When the destructor is invoked should the bookmark be removed? |
125 bool remove_bookmark_; | 127 bool remove_bookmark_; |
126 | 128 |
127 // When the destructor is invoked should edits be applied? | 129 // When the destructor is invoked should edits be applied? |
128 bool apply_edits_; | 130 bool apply_edits_; |
129 | 131 |
130 DISALLOW_COPY_AND_ASSIGN(BookmarkBubbleView); | 132 DISALLOW_COPY_AND_ASSIGN(BookmarkBubbleView); |
131 }; | 133 }; |
132 | 134 |
133 #endif // CHROME_BROWSER_UI_VIEWS_BOOKMARKS_BOOKMARK_BUBBLE_VIEW_H_ | 135 #endif // CHROME_BROWSER_UI_VIEWS_BOOKMARKS_BOOKMARK_BUBBLE_VIEW_H_ |
OLD | NEW |