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

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: fix ALL_MATCHES (in response to recent changes) 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 BookmarkModel(Profile* profile, bool index_urls);
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 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 const std::vector<const BookmarkNode*>& ordered_nodes); 205 const std::vector<const BookmarkNode*>& ordered_nodes);
204 206
205 // Sets the date when the folder was modified. 207 // Sets the date when the folder was modified.
206 void SetDateFolderModified(const BookmarkNode* node, const base::Time time); 208 void SetDateFolderModified(const BookmarkNode* node, const base::Time time);
207 209
208 // Resets the 'date modified' time of the node to 0. This is used during 210 // Resets the 'date modified' time of the node to 0. This is used during
209 // importing to exclude the newly created folders from showing up in the 211 // importing to exclude the newly created folders from showing up in the
210 // combobox of most recently modified folders. 212 // combobox of most recently modified folders.
211 void ResetDateFolderModified(const BookmarkNode* node); 213 void ResetDateFolderModified(const BookmarkNode* node);
212 214
213 void GetBookmarksWithTitlesMatching( 215 // Returns up to |max_count| of bookmarks containing each term from |text|
216 // in either the title or the URL.
217 void GetBookmarksMatching(
214 const base::string16& text, 218 const base::string16& text,
215 size_t max_count, 219 size_t max_count,
216 std::vector<BookmarkTitleMatch>* matches); 220 std::vector<BookmarkMatch>* matches);
217 221
218 // Sets the store to NULL, making it so the BookmarkModel does not persist 222 // Sets the store to NULL, making it so the BookmarkModel does not persist
219 // any changes to disk. This is only useful during testing to speed up 223 // any changes to disk. This is only useful during testing to speed up
220 // testing. 224 // testing.
221 void ClearStore(); 225 void ClearStore();
222 226
223 // Returns the next node ID. 227 // Returns the next node ID.
224 int64 next_node_id() const { return next_node_id_; } 228 int64 next_node_id() const { return next_node_id_; }
225 229
226 // Returns the object responsible for tracking the set of expanded nodes in 230 // Returns the object responsible for tracking the set of expanded nodes in
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
378 base::Lock url_lock_; 382 base::Lock url_lock_;
379 383
380 // Used for loading favicons. 384 // Used for loading favicons.
381 base::CancelableTaskTracker cancelable_task_tracker_; 385 base::CancelableTaskTracker cancelable_task_tracker_;
382 386
383 // Reads/writes bookmarks to disk. 387 // Reads/writes bookmarks to disk.
384 scoped_refptr<BookmarkStorage> store_; 388 scoped_refptr<BookmarkStorage> store_;
385 389
386 scoped_ptr<BookmarkIndex> index_; 390 scoped_ptr<BookmarkIndex> index_;
387 391
392 // True if URLs are stored in the BookmarkIndex in addition to bookmark
393 // titles.
394 const bool index_urls_;
395
388 base::WaitableEvent loaded_signal_; 396 base::WaitableEvent loaded_signal_;
389 397
390 // See description of IsDoingExtensiveChanges above. 398 // See description of IsDoingExtensiveChanges above.
391 int extensive_changes_; 399 int extensive_changes_;
392 400
393 scoped_ptr<BookmarkExpandedStateTracker> expanded_state_tracker_; 401 scoped_ptr<BookmarkExpandedStateTracker> expanded_state_tracker_;
394 402
395 DISALLOW_COPY_AND_ASSIGN(BookmarkModel); 403 DISALLOW_COPY_AND_ASSIGN(BookmarkModel);
396 }; 404 };
397 405
398 #endif // CHROME_BROWSER_BOOKMARKS_BOOKMARK_MODEL_H_ 406 #endif // CHROME_BROWSER_BOOKMARKS_BOOKMARK_MODEL_H_
OLDNEW
« no previous file with comments | « chrome/browser/bookmarks/bookmark_index_unittest.cc ('k') | chrome/browser/bookmarks/bookmark_model.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698