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

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

Issue 791623004: bookmarks: Move BookmarkModelObserver into 'bookmarks' namespace. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: android + sync + cocoa fixes Created 6 years 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>
11 11
12 #include "base/basictypes.h" 12 #include "base/basictypes.h"
13 #include "base/compiler_specific.h" 13 #include "base/compiler_specific.h"
14 #include "base/memory/ref_counted.h" 14 #include "base/memory/ref_counted.h"
15 #include "base/memory/scoped_ptr.h" 15 #include "base/memory/scoped_ptr.h"
16 #include "base/observer_list.h" 16 #include "base/observer_list.h"
17 #include "base/strings/string16.h" 17 #include "base/strings/string16.h"
18 #include "base/synchronization/lock.h" 18 #include "base/synchronization/lock.h"
19 #include "base/synchronization/waitable_event.h" 19 #include "base/synchronization/waitable_event.h"
20 #include "components/bookmarks/browser/bookmark_client.h" 20 #include "components/bookmarks/browser/bookmark_client.h"
21 #include "components/bookmarks/browser/bookmark_node.h" 21 #include "components/bookmarks/browser/bookmark_node.h"
22 #include "components/keyed_service/core/keyed_service.h" 22 #include "components/keyed_service/core/keyed_service.h"
23 #include "ui/gfx/image/image.h" 23 #include "ui/gfx/image/image.h"
24 #include "url/gurl.h" 24 #include "url/gurl.h"
25 25
26 class BookmarkModelObserver;
27 class PrefService; 26 class PrefService;
28 27
29 namespace base { 28 namespace base {
30 class FilePath; 29 class FilePath;
31 class SequencedTaskRunner; 30 class SequencedTaskRunner;
32 } 31 }
33 32
34 namespace bookmarks { 33 namespace bookmarks {
35 class BookmarkCodecTest; 34 class BookmarkCodecTest;
36 class BookmarkExpandedStateTracker; 35 class BookmarkExpandedStateTracker;
37 class BookmarkIndex; 36 class BookmarkIndex;
38 class BookmarkLoadDetails; 37 class BookmarkLoadDetails;
38 class BookmarkModelObserver;
39 class BookmarkStorage; 39 class BookmarkStorage;
40 class ScopedGroupBookmarkActions; 40 class ScopedGroupBookmarkActions;
41 class TestBookmarkClient; 41 class TestBookmarkClient;
42 struct BookmarkMatch; 42 struct BookmarkMatch;
43 } 43 }
44 44
45 namespace favicon_base { 45 namespace favicon_base {
46 struct FaviconImageResult; 46 struct FaviconImageResult;
47 } 47 }
48 48
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 // 'bookmark bar' node, 'other' node or 'mobile' node, or one of the root 105 // 'bookmark bar' node, 'other' node or 'mobile' node, or one of the root
106 // nodes supplied by the |client_|. 106 // nodes supplied by the |client_|.
107 bool is_permanent_node(const BookmarkNode* node) const { 107 bool is_permanent_node(const BookmarkNode* node) const {
108 return node && (node == &root_ || node->parent() == &root_); 108 return node && (node == &root_ || node->parent() == &root_);
109 } 109 }
110 110
111 // Returns the parent the last node was added to. This never returns NULL 111 // Returns the parent the last node was added to. This never returns NULL
112 // (as long as the model is loaded). 112 // (as long as the model is loaded).
113 const BookmarkNode* GetParentForNewNodes(); 113 const BookmarkNode* GetParentForNewNodes();
114 114
115 void AddObserver(BookmarkModelObserver* observer); 115 void AddObserver(bookmarks::BookmarkModelObserver* observer);
116 void RemoveObserver(BookmarkModelObserver* observer); 116 void RemoveObserver(bookmarks::BookmarkModelObserver* observer);
117 117
118 // Notifies the observers that an extensive set of changes is about to happen, 118 // Notifies the observers that an extensive set of changes is about to happen,
119 // such as during import or sync, so they can delay any expensive UI updates 119 // such as during import or sync, so they can delay any expensive UI updates
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
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after
410 BookmarkNode root_; 410 BookmarkNode root_;
411 411
412 BookmarkPermanentNode* bookmark_bar_node_; 412 BookmarkPermanentNode* bookmark_bar_node_;
413 BookmarkPermanentNode* other_node_; 413 BookmarkPermanentNode* other_node_;
414 BookmarkPermanentNode* mobile_node_; 414 BookmarkPermanentNode* mobile_node_;
415 415
416 // The maximum ID assigned to the bookmark nodes in the model. 416 // The maximum ID assigned to the bookmark nodes in the model.
417 int64 next_node_id_; 417 int64 next_node_id_;
418 418
419 // The observers. 419 // The observers.
420 ObserverList<BookmarkModelObserver> observers_; 420 ObserverList<bookmarks::BookmarkModelObserver> observers_;
421 421
422 // Set of nodes ordered by URL. This is not a map to avoid copying the 422 // Set of nodes ordered by URL. This is not a map to avoid copying the
423 // urls. 423 // urls.
424 // WARNING: |nodes_ordered_by_url_set_| is accessed on multiple threads. As 424 // WARNING: |nodes_ordered_by_url_set_| is accessed on multiple threads. As
425 // such, be sure and wrap all usage of it around |url_lock_|. 425 // such, be sure and wrap all usage of it around |url_lock_|.
426 typedef std::multiset<BookmarkNode*, NodeURLComparator> NodesOrderedByURLSet; 426 typedef std::multiset<BookmarkNode*, NodeURLComparator> NodesOrderedByURLSet;
427 NodesOrderedByURLSet nodes_ordered_by_url_set_; 427 NodesOrderedByURLSet nodes_ordered_by_url_set_;
428 base::Lock url_lock_; 428 base::Lock url_lock_;
429 429
430 // Used for loading favicons. 430 // Used for loading favicons.
(...skipping 10 matching lines...) Expand all
441 int extensive_changes_; 441 int extensive_changes_;
442 442
443 scoped_ptr<bookmarks::BookmarkExpandedStateTracker> expanded_state_tracker_; 443 scoped_ptr<bookmarks::BookmarkExpandedStateTracker> expanded_state_tracker_;
444 444
445 std::set<std::string> non_cloned_keys_; 445 std::set<std::string> non_cloned_keys_;
446 446
447 DISALLOW_COPY_AND_ASSIGN(BookmarkModel); 447 DISALLOW_COPY_AND_ASSIGN(BookmarkModel);
448 }; 448 };
449 449
450 #endif // COMPONENTS_BOOKMARKS_BROWSER_BOOKMARK_MODEL_H_ 450 #endif // COMPONENTS_BOOKMARKS_BROWSER_BOOKMARK_MODEL_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/bookmarks/bookmark_editor_view.h ('k') | components/bookmarks/browser/bookmark_model.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698