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

Side by Side Diff: components/enhanced_bookmarks/enhanced_bookmark_utils.cc

Issue 1203713002: Limit access to ChromeBookmarkClient to bookmarks code (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@cleanup_bookmark_client
Patch Set: Rebase Created 5 years, 6 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
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/enhanced_bookmarks/enhanced_bookmark_utils.h" 5 #include "components/enhanced_bookmarks/enhanced_bookmark_utils.h"
6 6
7 #include "components/bookmarks/browser/bookmark_model.h" 7 #include "components/bookmarks/browser/bookmark_model.h"
8 8
9 using bookmarks::BookmarkModel; 9 using bookmarks::BookmarkModel;
10 using bookmarks::BookmarkNode; 10 using bookmarks::BookmarkNode;
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 return true; 44 return true;
45 } 45 }
46 return false; 46 return false;
47 } 47 }
48 48
49 const BookmarkNode* RootLevelFolderForNode(const BookmarkNode* node, 49 const BookmarkNode* RootLevelFolderForNode(const BookmarkNode* node,
50 BookmarkModel* model) { 50 BookmarkModel* model) {
51 // This helper function doesn't work for managed bookmarks. This checks that 51 // This helper function doesn't work for managed bookmarks. This checks that
52 // |node| is editable by the user, which currently covers all the other 52 // |node| is editable by the user, which currently covers all the other
53 // bookmarks except the managed bookmarks. 53 // bookmarks except the managed bookmarks.
54 DCHECK(model->client()->CanBeEditedByUser(node)); 54 DCHECK(model->CanBeEditedByUser(node));
55 55
56 const std::vector<const BookmarkNode*> root_folders(RootLevelFolders(model)); 56 const std::vector<const BookmarkNode*> root_folders(RootLevelFolders(model));
57 const BookmarkNode* top = node; 57 const BookmarkNode* top = node;
58 while (top && 58 while (top &&
59 std::find(root_folders.begin(), root_folders.end(), top) == 59 std::find(root_folders.begin(), root_folders.end(), top) ==
60 root_folders.end()) { 60 root_folders.end()) {
61 top = top->parent(); 61 top = top->parent();
62 } 62 }
63 return top; 63 return top;
64 } 64 }
65 65
66 } // namespace enhanced_bookmarks 66 } // namespace enhanced_bookmarks
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698