OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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_VIEWS_BOOKMARK_BUBBLE_VIEW_H__ | 5 #ifndef CHROME_BROWSER_VIEWS_BOOKMARK_BUBBLE_VIEW_H__ |
6 #define CHROME_BROWSER_VIEWS_BOOKMARK_BUBBLE_VIEW_H__ | 6 #define CHROME_BROWSER_VIEWS_BOOKMARK_BUBBLE_VIEW_H__ |
7 | 7 |
8 #include "base/gfx/rect.h" | 8 #include "base/gfx/rect.h" |
9 #include "chrome/browser/views/info_bubble.h" | 9 #include "chrome/browser/views/info_bubble.h" |
10 #include "chrome/views/combo_box.h" | 10 #include "chrome/views/combo_box.h" |
11 #include "chrome/views/link.h" | 11 #include "chrome/views/link.h" |
12 #include "chrome/views/native_button.h" | 12 #include "chrome/views/native_button.h" |
13 #include "chrome/views/view.h" | 13 #include "chrome/views/view.h" |
14 #include "googleurl/src/gurl.h" | 14 #include "googleurl/src/gurl.h" |
15 | 15 |
16 class Profile; | 16 class Profile; |
17 | 17 |
18 class BookmarkBarModel; | 18 class BookmarkModel; |
19 class BookmarkBarNode; | 19 class BookmarkNode; |
20 | 20 |
21 namespace ChromeViews { | 21 namespace ChromeViews { |
22 class CheckBox; | 22 class CheckBox; |
23 class TextField; | 23 class TextField; |
24 } | 24 } |
25 | 25 |
26 // 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 |
27 // InfoBubble. BookmarkBubbleView provides views for unstarring and editting | 27 // InfoBubble. BookmarkBubbleView provides views for unstarring and editting |
28 // the bookmark it is created with. Don't create a BookmarkBubbleView directly, | 28 // the bookmark it is created with. Don't create a BookmarkBubbleView directly, |
29 // instead use the static Show method. | 29 // instead use the static Show method. |
(...skipping 20 matching lines...) Expand all Loading... |
50 | 50 |
51 // Override to close on return. | 51 // Override to close on return. |
52 virtual bool AcceleratorPressed(const ChromeViews::Accelerator& accelerator); | 52 virtual bool AcceleratorPressed(const ChromeViews::Accelerator& accelerator); |
53 | 53 |
54 private: | 54 private: |
55 // Model for the combobox showing the list of folders to choose from. The | 55 // Model for the combobox showing the list of folders to choose from. The |
56 // list always contains the bookmark bar, other node and parent. The list | 56 // list always contains the bookmark bar, other node and parent. The list |
57 // also contains an extra item that shows the text 'Choose another folder...'. | 57 // also contains an extra item that shows the text 'Choose another folder...'. |
58 class RecentlyUsedFoldersModel : public ChromeViews::ComboBox::Model { | 58 class RecentlyUsedFoldersModel : public ChromeViews::ComboBox::Model { |
59 public: | 59 public: |
60 RecentlyUsedFoldersModel(BookmarkBarModel* bb_model, BookmarkBarNode* node); | 60 RecentlyUsedFoldersModel(BookmarkModel* bb_model, BookmarkNode* node); |
61 | 61 |
62 // ComboBox::Model methods. Call through to nodes_. | 62 // ComboBox::Model methods. Call through to nodes_. |
63 virtual int GetItemCount(ChromeViews::ComboBox* source); | 63 virtual int GetItemCount(ChromeViews::ComboBox* source); |
64 virtual std::wstring GetItemAt(ChromeViews::ComboBox* source, int index); | 64 virtual std::wstring GetItemAt(ChromeViews::ComboBox* source, int index); |
65 | 65 |
66 // Returns the node at the specified index. | 66 // Returns the node at the specified index. |
67 BookmarkBarNode* GetNodeAt(int index); | 67 BookmarkNode* GetNodeAt(int index); |
68 | 68 |
69 // Returns the index of the original parent folder. | 69 // Returns the index of the original parent folder. |
70 int node_parent_index() const { return node_parent_index_; } | 70 int node_parent_index() const { return node_parent_index_; } |
71 | 71 |
72 private: | 72 private: |
73 // Removes node from nodes_. Does nothing if node is not in nodes_. | 73 // Removes node from nodes_. Does nothing if node is not in nodes_. |
74 void RemoveNode(BookmarkBarNode* node); | 74 void RemoveNode(BookmarkNode* node); |
75 | 75 |
76 std::vector<BookmarkBarNode*> nodes_; | 76 std::vector<BookmarkNode*> nodes_; |
77 int node_parent_index_; | 77 int node_parent_index_; |
78 | 78 |
79 DISALLOW_EVIL_CONSTRUCTORS(RecentlyUsedFoldersModel); | 79 DISALLOW_EVIL_CONSTRUCTORS(RecentlyUsedFoldersModel); |
80 }; | 80 }; |
81 | 81 |
82 // Creates a BookmarkBubbleView. | 82 // Creates a BookmarkBubbleView. |
83 // |title| is the title of the page. If newly_bookmarked is false, title is | 83 // |title| is the title of the page. If newly_bookmarked is false, title is |
84 // ignored and the title of the bookmark is fetched from the database. | 84 // ignored and the title of the bookmark is fetched from the database. |
85 BookmarkBubbleView(InfoBubbleDelegate* delegate, | 85 BookmarkBubbleView(InfoBubbleDelegate* delegate, |
86 Profile* profile, | 86 Profile* profile, |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 | 154 |
155 // ComboBox showing a handful of folders the user can choose from, including | 155 // ComboBox showing a handful of folders the user can choose from, including |
156 // the current parent. | 156 // the current parent. |
157 ChromeViews::ComboBox* parent_combobox_; | 157 ChromeViews::ComboBox* parent_combobox_; |
158 | 158 |
159 DISALLOW_EVIL_CONSTRUCTORS(BookmarkBubbleView); | 159 DISALLOW_EVIL_CONSTRUCTORS(BookmarkBubbleView); |
160 }; | 160 }; |
161 | 161 |
162 #endif // CHROME_BROWSER_VIEWS_BOOKMARK_BUBBLE_VIEW_H__ | 162 #endif // CHROME_BROWSER_VIEWS_BOOKMARK_BUBBLE_VIEW_H__ |
163 | 163 |
OLD | NEW |