| 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_BOOKMARKS_RECENTLY_USED_FOLDERS_COMBO_MODEL_H_ | 5 #ifndef CHROME_BROWSER_BOOKMARKS_RECENTLY_USED_FOLDERS_COMBO_MODEL_H_ |
| 6 #define CHROME_BROWSER_BOOKMARKS_RECENTLY_USED_FOLDERS_COMBO_MODEL_H_ | 6 #define CHROME_BROWSER_BOOKMARKS_RECENTLY_USED_FOLDERS_COMBO_MODEL_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/string16.h" | 10 #include "base/basictypes.h" |
| 11 #include "chrome/browser/bookmarks/bookmark_model.h" | 11 #include "base/compiler_specific.h" |
| 12 #include "ui/base/models/combobox_model.h" | 12 #include "ui/base/models/combobox_model.h" |
| 13 | 13 |
| 14 class BookmarkModel; |
| 15 class BookmarkNode; |
| 16 |
| 14 // Model for the combobox showing the list of folders to choose from. The | 17 // 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 | 18 // 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...'. | 19 // also contains an extra item that shows the text 'Choose another folder...'. |
| 17 class RecentlyUsedFoldersComboModel : public ui::ComboboxModel { | 20 class RecentlyUsedFoldersComboModel : public ui::ComboboxModel { |
| 18 public: | 21 public: |
| 19 RecentlyUsedFoldersComboModel(BookmarkModel* model, const BookmarkNode* node); | 22 RecentlyUsedFoldersComboModel(BookmarkModel* model, const BookmarkNode* node); |
| 20 virtual ~RecentlyUsedFoldersComboModel(); | 23 virtual ~RecentlyUsedFoldersComboModel(); |
| 21 | 24 |
| 22 // Overridden from ui::ComboboxModel: | 25 // Overridden from ui::ComboboxModel: |
| 23 virtual int GetItemCount() const OVERRIDE; | 26 virtual int GetItemCount() const OVERRIDE; |
| 24 virtual string16 GetItemAt(int index) OVERRIDE; | 27 virtual string16 GetItemAt(int index) OVERRIDE; |
| 25 | 28 |
| 26 // Returns the node at the specified |index|. | 29 // Returns the node at the specified |index|. |
| 27 const BookmarkNode* GetNodeAt(int index); | 30 const BookmarkNode* GetNodeAt(int index); |
| 28 | 31 |
| 29 // Returns the index of the original parent folder. | 32 // Returns the index of the original parent folder. |
| 30 int node_parent_index() const { return node_parent_index_; } | 33 int node_parent_index() const { return node_parent_index_; } |
| 31 | 34 |
| 32 private: | 35 private: |
| 33 // Removes |node| from |nodes_|. Does nothing if |node| is not in |nodes_|. | 36 // Removes |node| from |nodes_|. Does nothing if |node| is not in |nodes_|. |
| 34 void RemoveNode(const BookmarkNode* node); | 37 void RemoveNode(const BookmarkNode* node); |
| 35 | 38 |
| 36 std::vector<const BookmarkNode*> nodes_; | 39 std::vector<const BookmarkNode*> nodes_; |
| 37 int node_parent_index_; | 40 int node_parent_index_; |
| 38 | 41 |
| 39 DISALLOW_COPY_AND_ASSIGN(RecentlyUsedFoldersComboModel); | 42 DISALLOW_COPY_AND_ASSIGN(RecentlyUsedFoldersComboModel); |
| 40 }; | 43 }; |
| 41 | 44 |
| 42 #endif // CHROME_BROWSER_BOOKMARKS_RECENTLY_USED_FOLDERS_COMBO_MODEL_H_ | 45 #endif // CHROME_BROWSER_BOOKMARKS_RECENTLY_USED_FOLDERS_COMBO_MODEL_H_ |
| OLD | NEW |