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
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_UI_BOOKMARKS_RECENTLY_USED_FOLDERS_COMBO_MODEL_H_
6 #define CHROME_BROWSER_UI_BOOKMARKS_RECENTLY_USED_FOLDERS_COMBO_MODEL_H_
10 #include "base/basictypes.h"
11 #include "base/compiler_specific.h"
12 #include "ui/base/models/combobox_model.h"
17 // Model for the combobox showing the list of folders to choose from. The
18 // list always contains the Bookmarks Bar, Other Bookmarks and the parent
19 // folder. The list also contains an extra item that shows the text
20 // "Choose Another Folder...".
21 class RecentlyUsedFoldersComboModel
: public ui::ComboboxModel
{
23 RecentlyUsedFoldersComboModel(BookmarkModel
* model
, const BookmarkNode
* node
);
24 virtual ~RecentlyUsedFoldersComboModel();
26 // Overridden from ui::ComboboxModel:
27 virtual int GetItemCount() const OVERRIDE
;
28 virtual string16
GetItemAt(int index
) OVERRIDE
;
29 virtual bool IsItemSeparatorAt(int index
) OVERRIDE
;
30 virtual int GetDefaultIndex() const OVERRIDE
;
32 // If necessary this function moves |node| into the corresponding folder for
33 // the given |selected_index|.
34 void MaybeChangeParent(const BookmarkNode
* node
, int selected_index
);
37 // Returns the node at the specified |index|.
38 const BookmarkNode
* GetNodeAt(int index
);
40 // Removes |node| from |items_|. Does nothing if |node| is not in |items_|.
41 void RemoveNode(const BookmarkNode
* node
);
44 std::vector
<Item
> items_
;
46 BookmarkModel
* bookmark_model_
;
48 // The index of the original parent folder.
49 int node_parent_index_
;
51 DISALLOW_COPY_AND_ASSIGN(RecentlyUsedFoldersComboModel
);
54 #endif // CHROME_BROWSER_UI_BOOKMARKS_RECENTLY_USED_FOLDERS_COMBO_MODEL_H_