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

Side by Side Diff: components/bookmarks/browser/bookmark_model.h

Issue 1105413002: Avoid conversion of index to BookmarkNode pointer unnacessarily. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Changes as per review comments. Created 5 years, 7 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 #ifndef COMPONENTS_BOOKMARKS_BROWSER_BOOKMARK_MODEL_H_ 5 #ifndef COMPONENTS_BOOKMARKS_BROWSER_BOOKMARK_MODEL_H_
6 #define COMPONENTS_BOOKMARKS_BROWSER_BOOKMARK_MODEL_H_ 6 #define COMPONENTS_BOOKMARKS_BROWSER_BOOKMARK_MODEL_H_
7 7
8 #include <map> 8 #include <map>
9 #include <set> 9 #include <set>
10 #include <vector> 10 #include <vector>
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 // until it's finished. 120 // until it's finished.
121 void BeginExtensiveChanges(); 121 void BeginExtensiveChanges();
122 void EndExtensiveChanges(); 122 void EndExtensiveChanges();
123 123
124 // Returns true if this bookmark model is currently in a mode where extensive 124 // Returns true if this bookmark model is currently in a mode where extensive
125 // changes might happen, such as for import and sync. This is helpful for 125 // changes might happen, such as for import and sync. This is helpful for
126 // observers that are created after the mode has started, and want to check 126 // observers that are created after the mode has started, and want to check
127 // state during their own initializer, such as the NTP. 127 // state during their own initializer, such as the NTP.
128 bool IsDoingExtensiveChanges() const { return extensive_changes_ > 0; } 128 bool IsDoingExtensiveChanges() const { return extensive_changes_ > 0; }
129 129
130 // Removes the node at the given |index| from |parent|. Removing a folder node 130 // Removes |node| from the model and deletes it. Removing a folder node
131 // recursively removes all nodes. Observers are notified immediately. 131 // recursively removes all nodes. Observers are notified immediately.
132 void Remove(const BookmarkNode* parent, int index); 132 void Remove(const BookmarkNode* node);
133 133
134 // Removes all the non-permanent bookmark nodes that are editable by the user. 134 // Removes all the non-permanent bookmark nodes that are editable by the user.
135 // Observers are only notified when all nodes have been removed. There is no 135 // Observers are only notified when all nodes have been removed. There is no
136 // notification for individual node removals. 136 // notification for individual node removals.
137 void RemoveAllUserBookmarks(); 137 void RemoveAllUserBookmarks();
138 138
139 // Moves |node| to |new_parent| and inserts it at the given |index|. 139 // Moves |node| to |new_parent| and inserts it at the given |index|.
140 void Move(const BookmarkNode* node, 140 void Move(const BookmarkNode* node,
141 const BookmarkNode* new_parent, 141 const BookmarkNode* new_parent,
142 int index); 142 int index);
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after
442 scoped_ptr<BookmarkExpandedStateTracker> expanded_state_tracker_; 442 scoped_ptr<BookmarkExpandedStateTracker> expanded_state_tracker_;
443 443
444 std::set<std::string> non_cloned_keys_; 444 std::set<std::string> non_cloned_keys_;
445 445
446 DISALLOW_COPY_AND_ASSIGN(BookmarkModel); 446 DISALLOW_COPY_AND_ASSIGN(BookmarkModel);
447 }; 447 };
448 448
449 } // namespace bookmarks 449 } // namespace bookmarks
450 450
451 #endif // COMPONENTS_BOOKMARKS_BROWSER_BOOKMARK_MODEL_H_ 451 #endif // COMPONENTS_BOOKMARKS_BROWSER_BOOKMARK_MODEL_H_
OLDNEW
« no previous file with comments | « components/bookmarks/browser/bookmark_index_unittest.cc ('k') | components/bookmarks/browser/bookmark_model.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698