OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #include "chrome/browser/bookmarks/recently_used_folders_combo_model.h" | 5 #include "chrome/browser/bookmarks/recently_used_folders_combo_model.h" |
6 | 6 |
7 #include "chrome/browser/bookmarks/bookmark_utils.h" | 7 #include "chrome/browser/bookmarks/bookmark_utils.h" |
8 #include "grit/generated_resources.h" | 8 #include "grit/generated_resources.h" |
9 #include "ui/base/l10n/l10n_util.h" | 9 #include "ui/base/l10n/l10n_util.h" |
10 | 10 |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 } | 53 } |
54 | 54 |
55 RecentlyUsedFoldersComboModel::~RecentlyUsedFoldersComboModel() {} | 55 RecentlyUsedFoldersComboModel::~RecentlyUsedFoldersComboModel() {} |
56 | 56 |
57 int RecentlyUsedFoldersComboModel::GetItemCount() { | 57 int RecentlyUsedFoldersComboModel::GetItemCount() { |
58 return static_cast<int>(nodes_.size() + 1); | 58 return static_cast<int>(nodes_.size() + 1); |
59 } | 59 } |
60 | 60 |
61 string16 RecentlyUsedFoldersComboModel::GetItemAt(int index) { | 61 string16 RecentlyUsedFoldersComboModel::GetItemAt(int index) { |
62 if (index == static_cast<int>(nodes_.size())) | 62 if (index == static_cast<int>(nodes_.size())) |
63 return l10n_util::GetStringUTF16(IDS_BOOMARK_BUBBLE_CHOOSER_ANOTHER_FOLDER); | 63 return |
| 64 l10n_util::GetStringUTF16(IDS_BOOKMARK_BUBBLE_CHOOSER_ANOTHER_FOLDER); |
64 return nodes_[index]->GetTitle(); | 65 return nodes_[index]->GetTitle(); |
65 } | 66 } |
66 | 67 |
67 const BookmarkNode* RecentlyUsedFoldersComboModel::GetNodeAt(int index) { | 68 const BookmarkNode* RecentlyUsedFoldersComboModel::GetNodeAt(int index) { |
68 if (index < 0 || index >= static_cast<int>(nodes_.size())) | 69 if (index < 0 || index >= static_cast<int>(nodes_.size())) |
69 return NULL; | 70 return NULL; |
70 return nodes_[index]; | 71 return nodes_[index]; |
71 } | 72 } |
72 | 73 |
73 void RecentlyUsedFoldersComboModel::RemoveNode(const BookmarkNode* node) { | 74 void RecentlyUsedFoldersComboModel::RemoveNode(const BookmarkNode* node) { |
74 std::vector<const BookmarkNode*>::iterator it = std::find(nodes_.begin(), | 75 std::vector<const BookmarkNode*>::iterator it = std::find(nodes_.begin(), |
75 nodes_.end(), | 76 nodes_.end(), |
76 node); | 77 node); |
77 if (it != nodes_.end()) | 78 if (it != nodes_.end()) |
78 nodes_.erase(it); | 79 nodes_.erase(it); |
79 } | 80 } |
OLD | NEW |