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