OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_RECENTLY_FOLDERS_COMBO_MODEL_H_ | 5 #ifndef CHROME_BROWSER_BOOKMARKS_RECENTLY_USED_FOLDERS_COMBO_MODEL_H_ |
6 #define CHROME_BROWSER_RECENTLY_FOLDERS_COMBO_MODEL_H_ | 6 #define CHROME_BROWSER_BOOKMARKS_RECENTLY_USED_FOLDERS_COMBO_MODEL_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "app/combobox_model.h" | 11 #include "app/combobox_model.h" |
12 #include "chrome/browser/bookmarks/bookmark_model.h" | 12 #include "chrome/browser/bookmarks/bookmark_model.h" |
13 | 13 |
14 // Model for the combobox showing the list of folders to choose from. The | 14 // Model for the combobox showing the list of folders to choose from. The |
15 // list always contains the bookmark bar, other node and parent. The list | 15 // list always contains the bookmark bar, other node and parent. The list |
16 // also contains an extra item that shows the text 'Choose another folder...'. | 16 // also contains an extra item that shows the text 'Choose another folder...'. |
17 class RecentlyUsedFoldersComboModel : public ComboboxModel { | 17 class RecentlyUsedFoldersComboModel : public ComboboxModel { |
18 public: | 18 public: |
19 RecentlyUsedFoldersComboModel(BookmarkModel* model, const BookmarkNode* node); | 19 RecentlyUsedFoldersComboModel(BookmarkModel* model, const BookmarkNode* node); |
20 | 20 |
21 // Overridden from ComboboxModel: | 21 // Overridden from ComboboxModel: |
22 virtual int GetItemCount(); | 22 virtual int GetItemCount(); |
23 virtual std::wstring GetItemAt(int index); | 23 virtual std::wstring GetItemAt(int index); |
24 | 24 |
25 // Returns the node at the specified index. | 25 // Returns the node at the specified |index|. |
26 const BookmarkNode* GetNodeAt(int index); | 26 const BookmarkNode* GetNodeAt(int index); |
27 | 27 |
28 // Returns the index of the original parent folder. | 28 // Returns the index of the original parent folder. |
29 int node_parent_index() const { return node_parent_index_; } | 29 int node_parent_index() const { return node_parent_index_; } |
30 | 30 |
31 private: | 31 private: |
32 // Removes |node| from |nodes_|. Does nothing if |node| is not in |nodes_|. | 32 // Removes |node| from |nodes_|. Does nothing if |node| is not in |nodes_|. |
33 void RemoveNode(const BookmarkNode* node); | 33 void RemoveNode(const BookmarkNode* node); |
34 | 34 |
35 std::vector<const BookmarkNode*> nodes_; | 35 std::vector<const BookmarkNode*> nodes_; |
36 int node_parent_index_; | 36 int node_parent_index_; |
37 | 37 |
38 DISALLOW_COPY_AND_ASSIGN(RecentlyUsedFoldersComboModel); | 38 DISALLOW_COPY_AND_ASSIGN(RecentlyUsedFoldersComboModel); |
39 }; | 39 }; |
40 | 40 |
41 #endif // CHROME_BROWSER_RECENTLY_FOLDERS_COMBO_MODEL_H_ | 41 #endif // CHROME_BROWSER_BOOKMARKS_RECENTLY_USED_FOLDERS_COMBO_MODEL_H_ |
OLD | NEW |