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

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

Issue 184663002: Omnibox: Make URLs of Bookmarks Searchable (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 8 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 | Annotate | Revision Log
OLDNEW
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 14 matching lines...) Expand all
25 #include "content/public/browser/notification_observer.h" 25 #include "content/public/browser/notification_observer.h"
26 #include "content/public/browser/notification_registrar.h" 26 #include "content/public/browser/notification_registrar.h"
27 #include "ui/gfx/image/image.h" 27 #include "ui/gfx/image/image.h"
28 #include "url/gurl.h" 28 #include "url/gurl.h"
29 29
30 class BookmarkExpandedStateTracker; 30 class BookmarkExpandedStateTracker;
31 class BookmarkIndex; 31 class BookmarkIndex;
32 class BookmarkLoadDetails; 32 class BookmarkLoadDetails;
33 class BookmarkModelObserver; 33 class BookmarkModelObserver;
34 class BookmarkStorage; 34 class BookmarkStorage;
35 struct BookmarkTitleMatch; 35 struct BookmarkMatch;
36 class Profile; 36 class Profile;
37 class ScopedGroupBookmarkActions; 37 class ScopedGroupBookmarkActions;
38 38
39 namespace base { 39 namespace base {
40 class SequencedTaskRunner; 40 class SequencedTaskRunner;
41 } 41 }
42 42
43 namespace chrome { 43 namespace chrome {
44 struct FaviconImageResult; 44 struct FaviconImageResult;
45 } 45 }
46 46
47 // BookmarkModel -------------------------------------------------------------- 47 // BookmarkModel --------------------------------------------------------------
48 48
49 // BookmarkModel provides a directed acyclic graph of URLs and folders. 49 // BookmarkModel provides a directed acyclic graph of URLs and folders.
50 // Three graphs are provided for the three entry points: those on the 'bookmarks 50 // Three graphs are provided for the three entry points: those on the 'bookmarks
51 // bar', those in the 'other bookmarks' folder and those in the 'mobile' folder. 51 // bar', those in the 'other bookmarks' folder and those in the 'mobile' folder.
52 // 52 //
53 // An observer may be attached to observe relevant events. 53 // An observer may be attached to observe relevant events.
54 // 54 //
55 // You should NOT directly create a BookmarkModel, instead go through the 55 // You should NOT directly create a BookmarkModel, instead go through the
56 // BookmarkModelFactory. 56 // BookmarkModelFactory.
57 class BookmarkModel : public content::NotificationObserver, 57 class BookmarkModel : public content::NotificationObserver,
58 public BookmarkService, 58 public BookmarkService,
59 public KeyedService { 59 public KeyedService {
60 public: 60 public:
61 explicit BookmarkModel(Profile* profile); 61 // |index_urls| says whether URLs should be stored in the BookmarkIndex
62 // in addition to bookmark titles.
63 explicit BookmarkModel(Profile* profile, bool index_urls);
sky 2014/04/21 23:09:01 Remove explicit
Mark P 2014/04/21 23:41:36 Done.
62 virtual ~BookmarkModel(); 64 virtual ~BookmarkModel();
63 65
64 // Invoked prior to destruction to release any necessary resources. 66 // Invoked prior to destruction to release any necessary resources.
65 virtual void Shutdown() OVERRIDE; 67 virtual void Shutdown() OVERRIDE;
66 68
67 // Loads the bookmarks. This is called upon creation of the 69 // Loads the bookmarks. This is called upon creation of the
68 // BookmarkModel. You need not invoke this directly. 70 // BookmarkModel. You need not invoke this directly.
69 // All load operations will be executed on |task_runner|. 71 // All load operations will be executed on |task_runner|.
70 void Load(const scoped_refptr<base::SequencedTaskRunner>& task_runner); 72 void Load(const scoped_refptr<base::SequencedTaskRunner>& task_runner);
71 73
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 const std::vector<const BookmarkNode*>& ordered_nodes); 208 const std::vector<const BookmarkNode*>& ordered_nodes);
207 209
208 // Sets the date when the folder was modified. 210 // Sets the date when the folder was modified.
209 void SetDateFolderModified(const BookmarkNode* node, const base::Time time); 211 void SetDateFolderModified(const BookmarkNode* node, const base::Time time);
210 212
211 // Resets the 'date modified' time of the node to 0. This is used during 213 // Resets the 'date modified' time of the node to 0. This is used during
212 // importing to exclude the newly created folders from showing up in the 214 // importing to exclude the newly created folders from showing up in the
213 // combobox of most recently modified folders. 215 // combobox of most recently modified folders.
214 void ResetDateFolderModified(const BookmarkNode* node); 216 void ResetDateFolderModified(const BookmarkNode* node);
215 217
216 void GetBookmarksWithTitlesMatching( 218 // Returns up to |max_count| of bookmarks containing each term from |text|
219 // in either the title or the URL.
220 void GetBookmarksMatching(
217 const base::string16& text, 221 const base::string16& text,
218 size_t max_count, 222 size_t max_count,
219 std::vector<BookmarkTitleMatch>* matches); 223 std::vector<BookmarkMatch>* matches);
220 224
221 // Sets the store to NULL, making it so the BookmarkModel does not persist 225 // Sets the store to NULL, making it so the BookmarkModel does not persist
222 // any changes to disk. This is only useful during testing to speed up 226 // any changes to disk. This is only useful during testing to speed up
223 // testing. 227 // testing.
224 void ClearStore(); 228 void ClearStore();
225 229
226 // Returns the next node ID. 230 // Returns the next node ID.
227 int64 next_node_id() const { return next_node_id_; } 231 int64 next_node_id() const { return next_node_id_; }
228 232
229 // Returns the object responsible for tracking the set of expanded nodes in 233 // Returns the object responsible for tracking the set of expanded nodes in
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
384 base::Lock url_lock_; 388 base::Lock url_lock_;
385 389
386 // Used for loading favicons. 390 // Used for loading favicons.
387 base::CancelableTaskTracker cancelable_task_tracker_; 391 base::CancelableTaskTracker cancelable_task_tracker_;
388 392
389 // Reads/writes bookmarks to disk. 393 // Reads/writes bookmarks to disk.
390 scoped_refptr<BookmarkStorage> store_; 394 scoped_refptr<BookmarkStorage> store_;
391 395
392 scoped_ptr<BookmarkIndex> index_; 396 scoped_ptr<BookmarkIndex> index_;
393 397
398 // True if URLs are stored in the BookmarkIndex in addition to bookmark
399 // titles.
400 const bool index_urls_;
401
394 base::WaitableEvent loaded_signal_; 402 base::WaitableEvent loaded_signal_;
395 403
396 // See description of IsDoingExtensiveChanges above. 404 // See description of IsDoingExtensiveChanges above.
397 int extensive_changes_; 405 int extensive_changes_;
398 406
399 scoped_ptr<BookmarkExpandedStateTracker> expanded_state_tracker_; 407 scoped_ptr<BookmarkExpandedStateTracker> expanded_state_tracker_;
400 408
401 DISALLOW_COPY_AND_ASSIGN(BookmarkModel); 409 DISALLOW_COPY_AND_ASSIGN(BookmarkModel);
402 }; 410 };
403 411
404 #endif // CHROME_BROWSER_BOOKMARKS_BOOKMARK_MODEL_H_ 412 #endif // CHROME_BROWSER_BOOKMARKS_BOOKMARK_MODEL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698