Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(300)

Side by Side Diff: components/bookmarks/browser/bookmark_utils.cc

Issue 549193002: Skip managed bookmarks at the BookmarkChangeProcessor. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix test Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/chrome_tests.gypi ('k') | ui/base/models/tree_node_iterator.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "components/bookmarks/browser/bookmark_utils.h" 5 #include "components/bookmarks/browser/bookmark_utils.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/bind.h"
10 #include "base/files/file_path.h" 11 #include "base/files/file_path.h"
11 #include "base/i18n/case_conversion.h" 12 #include "base/i18n/case_conversion.h"
12 #include "base/i18n/string_search.h" 13 #include "base/i18n/string_search.h"
13 #include "base/metrics/user_metrics_action.h" 14 #include "base/metrics/user_metrics_action.h"
14 #include "base/prefs/pref_service.h" 15 #include "base/prefs/pref_service.h"
15 #include "base/strings/utf_string_conversions.h" 16 #include "base/strings/utf_string_conversions.h"
16 #include "base/time/time.h" 17 #include "base/time/time.h"
17 #include "components/bookmarks/browser/bookmark_client.h" 18 #include "components/bookmarks/browser/bookmark_client.h"
18 #include "components/bookmarks/browser/bookmark_model.h" 19 #include "components/bookmarks/browser/bookmark_model.h"
19 #include "components/bookmarks/browser/scoped_group_bookmark_actions.h" 20 #include "components/bookmarks/browser/scoped_group_bookmark_actions.h"
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 bool CanPasteFromClipboard(BookmarkModel* model, const BookmarkNode* node) { 208 bool CanPasteFromClipboard(BookmarkModel* model, const BookmarkNode* node) {
208 if (!node || !model->client()->CanBeEditedByUser(node)) 209 if (!node || !model->client()->CanBeEditedByUser(node))
209 return false; 210 return false;
210 return BookmarkNodeData::ClipboardContainsBookmarks(); 211 return BookmarkNodeData::ClipboardContainsBookmarks();
211 } 212 }
212 213
213 std::vector<const BookmarkNode*> GetMostRecentlyModifiedUserFolders( 214 std::vector<const BookmarkNode*> GetMostRecentlyModifiedUserFolders(
214 BookmarkModel* model, 215 BookmarkModel* model,
215 size_t max_count) { 216 size_t max_count) {
216 std::vector<const BookmarkNode*> nodes; 217 std::vector<const BookmarkNode*> nodes;
217 ui::TreeNodeIterator<const BookmarkNode> iterator(model->root_node(), 218 ui::TreeNodeIterator<const BookmarkNode> iterator(
218 PruneInvisibleFolders); 219 model->root_node(), base::Bind(&PruneInvisibleFolders));
219 220
220 while (iterator.has_next()) { 221 while (iterator.has_next()) {
221 const BookmarkNode* parent = iterator.Next(); 222 const BookmarkNode* parent = iterator.Next();
222 if (!model->client()->CanBeEditedByUser(parent)) 223 if (!model->client()->CanBeEditedByUser(parent))
223 continue; 224 continue;
224 if (parent->is_folder() && parent->date_folder_modified() > Time()) { 225 if (parent->is_folder() && parent->date_folder_modified() > Time()) {
225 if (max_count == 0) { 226 if (max_count == 0) {
226 nodes.push_back(parent); 227 nodes.push_back(parent);
227 } else { 228 } else {
228 std::vector<const BookmarkNode*>::iterator i = 229 std::vector<const BookmarkNode*>::iterator i =
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
437 } 438 }
438 return false; 439 return false;
439 } 440 }
440 441
441 const BookmarkNode* GetBookmarkNodeByID(const BookmarkModel* model, int64 id) { 442 const BookmarkNode* GetBookmarkNodeByID(const BookmarkModel* model, int64 id) {
442 // TODO(sky): TreeNode needs a method that visits all nodes using a predicate. 443 // TODO(sky): TreeNode needs a method that visits all nodes using a predicate.
443 return GetNodeByID(model->root_node(), id); 444 return GetNodeByID(model->root_node(), id);
444 } 445 }
445 446
446 } // namespace bookmarks 447 } // namespace bookmarks
OLDNEW
« no previous file with comments | « chrome/chrome_tests.gypi ('k') | ui/base/models/tree_node_iterator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698