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" | |
17 | 16 |
18 class BookmarkBubbleViewObserver; | 17 class BookmarkBubbleViewObserver; |
19 class Profile; | 18 class Profile; |
20 | 19 |
21 namespace views { | 20 namespace views { |
22 class LabelButton; | 21 class LabelButton; |
23 class Textfield; | 22 class Textfield; |
24 } | 23 } |
25 | 24 |
26 // BookmarkBubbleView is a view intended to be used as the content of an | 25 // BookmarkBubbleView is a view intended to be used as the content of an |
27 // Bubble. BookmarkBubbleView provides views for unstarring and editing the | 26 // Bubble. BookmarkBubbleView provides views for unstarring and editing the |
28 // bookmark it is created with. Don't create a BookmarkBubbleView directly, | 27 // bookmark it is created with. Don't create a BookmarkBubbleView directly, |
29 // instead use the static Show method. | 28 // instead use the static Show method. |
30 class BookmarkBubbleView : public views::BubbleDelegateView, | 29 class BookmarkBubbleView : public views::BubbleDelegateView, |
31 public views::LinkListener, | |
32 public views::ButtonListener, | 30 public views::ButtonListener, |
33 public views::ComboboxListener { | 31 public views::ComboboxListener { |
34 public: | 32 public: |
35 static void ShowBubble(views::View* anchor_view, | 33 static void ShowBubble(views::View* anchor_view, |
36 BookmarkBubbleViewObserver* observer, | 34 BookmarkBubbleViewObserver* observer, |
37 Profile* profile, | 35 Profile* profile, |
38 const GURL& url, | 36 const GURL& url, |
39 bool newly_bookmarked); | 37 bool newly_bookmarked); |
40 | 38 |
41 static bool IsShowing(); | 39 static bool IsShowing(); |
(...skipping 19 matching lines...) Expand all Loading... |
61 // Creates a BookmarkBubbleView. | 59 // Creates a BookmarkBubbleView. |
62 BookmarkBubbleView(views::View* anchor_view, | 60 BookmarkBubbleView(views::View* anchor_view, |
63 BookmarkBubbleViewObserver* observer, | 61 BookmarkBubbleViewObserver* observer, |
64 Profile* profile, | 62 Profile* profile, |
65 const GURL& url, | 63 const GURL& url, |
66 bool newly_bookmarked); | 64 bool newly_bookmarked); |
67 | 65 |
68 // Returns the title to display. | 66 // Returns the title to display. |
69 string16 GetTitle(); | 67 string16 GetTitle(); |
70 | 68 |
71 // Overridden from views::LinkListener: | 69 // Overridden from views::View: |
72 // Either unstars the item or shows the bookmark editor (depending upon which | 70 virtual gfx::Size GetMinimumSize() OVERRIDE; |
73 // link was clicked). | |
74 virtual void LinkClicked(views::Link* source, int event_flags) OVERRIDE; | |
75 | 71 |
76 // Overridden from views::ButtonListener: | 72 // Overridden from views::ButtonListener: |
77 // Closes the bubble or opens the edit dialog. | 73 // Closes the bubble or opens the edit dialog. |
78 virtual void ButtonPressed(views::Button* sender, | 74 virtual void ButtonPressed(views::Button* sender, |
79 const ui::Event& event) OVERRIDE; | 75 const ui::Event& event) OVERRIDE; |
80 | 76 |
81 // Overridden from views::ComboboxListener: | 77 // Overridden from views::ComboboxListener: |
82 virtual void OnSelectedIndexChanged(views::Combobox* combobox) OVERRIDE; | 78 virtual void OnSelectedIndexChanged(views::Combobox* combobox) OVERRIDE; |
83 | 79 |
84 // Handle the message when the user presses a button. | 80 // Handle the message when the user presses a button. |
(...skipping 15 matching lines...) Expand all Loading... |
100 Profile* profile_; | 96 Profile* profile_; |
101 | 97 |
102 // The bookmark URL. | 98 // The bookmark URL. |
103 const GURL url_; | 99 const GURL url_; |
104 | 100 |
105 // If true, the page was just bookmarked. | 101 // If true, the page was just bookmarked. |
106 const bool newly_bookmarked_; | 102 const bool newly_bookmarked_; |
107 | 103 |
108 RecentlyUsedFoldersComboModel parent_model_; | 104 RecentlyUsedFoldersComboModel parent_model_; |
109 | 105 |
110 // Link for removing/unstarring the bookmark. | 106 // Button for removing the bookmark. |
111 views::Link* remove_link_; | 107 views::LabelButton* remove_button_; |
112 | 108 |
113 // Button to bring up the editor. | 109 // Button to bring up the editor. |
114 views::LabelButton* edit_button_; | 110 views::LabelButton* edit_button_; |
115 | 111 |
116 // Button to close the window. | 112 // Button to close the window. |
117 views::LabelButton* close_button_; | 113 views::LabelButton* close_button_; |
118 | 114 |
119 // Textfield showing the title of the bookmark. | 115 // Textfield showing the title of the bookmark. |
120 views::Textfield* title_tf_; | 116 views::Textfield* title_tf_; |
121 | 117 |
122 // Combobox showing a handful of folders the user can choose from, including | 118 // Combobox showing a handful of folders the user can choose from, including |
123 // the current parent. | 119 // the current parent. |
124 views::Combobox* parent_combobox_; | 120 views::Combobox* parent_combobox_; |
125 | 121 |
126 // When the destructor is invoked should the bookmark be removed? | 122 // When the destructor is invoked should the bookmark be removed? |
127 bool remove_bookmark_; | 123 bool remove_bookmark_; |
128 | 124 |
129 // When the destructor is invoked should edits be applied? | 125 // When the destructor is invoked should edits be applied? |
130 bool apply_edits_; | 126 bool apply_edits_; |
131 | 127 |
132 DISALLOW_COPY_AND_ASSIGN(BookmarkBubbleView); | 128 DISALLOW_COPY_AND_ASSIGN(BookmarkBubbleView); |
133 }; | 129 }; |
134 | 130 |
135 #endif // CHROME_BROWSER_UI_VIEWS_BOOKMARKS_BOOKMARK_BUBBLE_VIEW_H_ | 131 #endif // CHROME_BROWSER_UI_VIEWS_BOOKMARKS_BOOKMARK_BUBBLE_VIEW_H_ |
OLD | NEW |