| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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 CHROME_BROWSER_BOOKMARKS_BOOKMARK_MODEL_H_ | 5 #ifndef CHROME_BROWSER_BOOKMARKS_BOOKMARK_MODEL_H_ |
| 6 #define CHROME_BROWSER_BOOKMARKS_BOOKMARK_MODEL_H_ | 6 #define CHROME_BROWSER_BOOKMARKS_BOOKMARK_MODEL_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <set> | 9 #include <set> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 285 | 285 |
| 286 void AddObserver(BookmarkModelObserver* observer); | 286 void AddObserver(BookmarkModelObserver* observer); |
| 287 void RemoveObserver(BookmarkModelObserver* observer); | 287 void RemoveObserver(BookmarkModelObserver* observer); |
| 288 | 288 |
| 289 // Notifies the observers that an extensive set of changes is about to happen, | 289 // Notifies the observers that an extensive set of changes is about to happen, |
| 290 // such as during import or sync, so they can delay any expensive UI updates | 290 // such as during import or sync, so they can delay any expensive UI updates |
| 291 // until it's finished. | 291 // until it's finished. |
| 292 void BeginExtensiveChanges(); | 292 void BeginExtensiveChanges(); |
| 293 void EndExtensiveChanges(); | 293 void EndExtensiveChanges(); |
| 294 | 294 |
| 295 // Notifies the observers that a set of changes initiated by a single user |
| 296 // action is about to happen and has completed. |
| 297 void BeginGroupedChanges(); |
| 298 void EndGroupedChanges(); |
| 299 |
| 295 // Returns true if this bookmark model is currently in a mode where extensive | 300 // Returns true if this bookmark model is currently in a mode where extensive |
| 296 // changes might happen, such as for import and sync. This is helpful for | 301 // changes might happen, such as for import and sync. This is helpful for |
| 297 // observers that are created after the mode has started, and want to check | 302 // observers that are created after the mode has started, and want to check |
| 298 // state during their own initializer, such as the NTP. | 303 // state during their own initializer, such as the NTP. |
| 299 bool IsDoingExtensiveChanges() const { return extensive_changes_ > 0; } | 304 bool IsDoingExtensiveChanges() const { return extensive_changes_ > 0; } |
| 300 | 305 |
| 301 // Removes the node at the given |index| from |parent|. Removing a folder node | 306 // Removes the node at the given |index| from |parent|. Removing a folder node |
| 302 // recursively removes all nodes. Observers are notified immediately. | 307 // recursively removes all nodes. Observers are notified immediately. |
| 303 void Remove(const BookmarkNode* parent, int index); | 308 void Remove(const BookmarkNode* parent, int index); |
| 304 | 309 |
| (...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 571 | 576 |
| 572 // See description of IsDoingExtensiveChanges above. | 577 // See description of IsDoingExtensiveChanges above. |
| 573 int extensive_changes_; | 578 int extensive_changes_; |
| 574 | 579 |
| 575 scoped_ptr<BookmarkExpandedStateTracker> expanded_state_tracker_; | 580 scoped_ptr<BookmarkExpandedStateTracker> expanded_state_tracker_; |
| 576 | 581 |
| 577 DISALLOW_COPY_AND_ASSIGN(BookmarkModel); | 582 DISALLOW_COPY_AND_ASSIGN(BookmarkModel); |
| 578 }; | 583 }; |
| 579 | 584 |
| 580 #endif // CHROME_BROWSER_BOOKMARKS_BOOKMARK_MODEL_H_ | 585 #endif // CHROME_BROWSER_BOOKMARKS_BOOKMARK_MODEL_H_ |
| OLD | NEW |