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 25 matching lines...) Expand all Loading... |
36 class Profile; | 36 class Profile; |
37 | 37 |
38 namespace base { | 38 namespace base { |
39 class SequencedTaskRunner; | 39 class SequencedTaskRunner; |
40 } | 40 } |
41 | 41 |
42 namespace chrome { | 42 namespace chrome { |
43 struct FaviconImageResult; | 43 struct FaviconImageResult; |
44 } | 44 } |
45 | 45 |
| 46 namespace bookmark_utils { |
| 47 class ScopedGroupBookmarkActions; |
| 48 } |
| 49 |
46 // BookmarkNode --------------------------------------------------------------- | 50 // BookmarkNode --------------------------------------------------------------- |
47 | 51 |
48 // BookmarkNode contains information about a starred entry: title, URL, favicon, | 52 // BookmarkNode contains information about a starred entry: title, URL, favicon, |
49 // id and type. BookmarkNodes are returned from BookmarkModel. | 53 // id and type. BookmarkNodes are returned from BookmarkModel. |
50 class BookmarkNode : public ui::TreeNode<BookmarkNode> { | 54 class BookmarkNode : public ui::TreeNode<BookmarkNode> { |
51 public: | 55 public: |
52 enum Type { | 56 enum Type { |
53 URL, | 57 URL, |
54 FOLDER, | 58 FOLDER, |
55 BOOKMARK_BAR, | 59 BOOKMARK_BAR, |
(...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
431 void SetNodeSyncTransactionVersion(const BookmarkNode* node, | 435 void SetNodeSyncTransactionVersion(const BookmarkNode* node, |
432 int64 sync_transaction_version); | 436 int64 sync_transaction_version); |
433 | 437 |
434 // Returns the profile that corresponds to this BookmarkModel. | 438 // Returns the profile that corresponds to this BookmarkModel. |
435 Profile* profile() { return profile_; } | 439 Profile* profile() { return profile_; } |
436 | 440 |
437 private: | 441 private: |
438 friend class BookmarkCodecTest; | 442 friend class BookmarkCodecTest; |
439 friend class BookmarkModelTest; | 443 friend class BookmarkModelTest; |
440 friend class BookmarkStorage; | 444 friend class BookmarkStorage; |
| 445 friend class bookmark_utils::ScopedGroupBookmarkActions; |
441 | 446 |
442 // Used to order BookmarkNodes by URL. | 447 // Used to order BookmarkNodes by URL. |
443 class NodeURLComparator { | 448 class NodeURLComparator { |
444 public: | 449 public: |
445 bool operator()(const BookmarkNode* n1, const BookmarkNode* n2) const { | 450 bool operator()(const BookmarkNode* n1, const BookmarkNode* n2) const { |
446 return n1->url() < n2->url(); | 451 return n1->url() < n2->url(); |
447 } | 452 } |
448 }; | 453 }; |
449 | 454 |
450 // Implementation of IsBookmarked. Before calling this the caller must obtain | 455 // Implementation of IsBookmarked. Before calling this the caller must obtain |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
506 // Invoked from the node to load the favicon. Requests the favicon from the | 511 // Invoked from the node to load the favicon. Requests the favicon from the |
507 // favicon service. | 512 // favicon service. |
508 void LoadFavicon(BookmarkNode* node); | 513 void LoadFavicon(BookmarkNode* node); |
509 | 514 |
510 // Called to notify the observers that the favicon has been loaded. | 515 // Called to notify the observers that the favicon has been loaded. |
511 void FaviconLoaded(const BookmarkNode* node); | 516 void FaviconLoaded(const BookmarkNode* node); |
512 | 517 |
513 // If we're waiting on a favicon for node, the load request is canceled. | 518 // If we're waiting on a favicon for node, the load request is canceled. |
514 void CancelPendingFaviconLoadRequests(BookmarkNode* node); | 519 void CancelPendingFaviconLoadRequests(BookmarkNode* node); |
515 | 520 |
| 521 // Notifies the observers that a set of changes initiated by a single user |
| 522 // action is about to happen and has completed. |
| 523 void BeginGroupedChanges(); |
| 524 void EndGroupedChanges(); |
| 525 |
516 // content::NotificationObserver: | 526 // content::NotificationObserver: |
517 virtual void Observe(int type, | 527 virtual void Observe(int type, |
518 const content::NotificationSource& source, | 528 const content::NotificationSource& source, |
519 const content::NotificationDetails& details) OVERRIDE; | 529 const content::NotificationDetails& details) OVERRIDE; |
520 | 530 |
521 // Generates and returns the next node ID. | 531 // Generates and returns the next node ID. |
522 int64 generate_next_node_id(); | 532 int64 generate_next_node_id(); |
523 | 533 |
524 // Sets the maximum node ID to the given value. | 534 // Sets the maximum node ID to the given value. |
525 // This is used by BookmarkCodec to report the maximum ID after it's done | 535 // This is used by BookmarkCodec to report the maximum ID after it's done |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
571 | 581 |
572 // See description of IsDoingExtensiveChanges above. | 582 // See description of IsDoingExtensiveChanges above. |
573 int extensive_changes_; | 583 int extensive_changes_; |
574 | 584 |
575 scoped_ptr<BookmarkExpandedStateTracker> expanded_state_tracker_; | 585 scoped_ptr<BookmarkExpandedStateTracker> expanded_state_tracker_; |
576 | 586 |
577 DISALLOW_COPY_AND_ASSIGN(BookmarkModel); | 587 DISALLOW_COPY_AND_ASSIGN(BookmarkModel); |
578 }; | 588 }; |
579 | 589 |
580 #endif // CHROME_BROWSER_BOOKMARKS_BOOKMARK_MODEL_H_ | 590 #endif // CHROME_BROWSER_BOOKMARKS_BOOKMARK_MODEL_H_ |
OLD | NEW |