OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 "build/build_config.h" | 8 #include "build/build_config.h" |
9 | 9 |
10 #include <set> | 10 #include <set> |
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
317 size_t max_count, | 317 size_t max_count, |
318 std::vector<bookmark_utils::TitleMatch>* matches); | 318 std::vector<bookmark_utils::TitleMatch>* matches); |
319 | 319 |
320 Profile* profile() const { return profile_; } | 320 Profile* profile() const { return profile_; } |
321 | 321 |
322 // Sets the store to NULL, making it so the BookmarkModel does not persist | 322 // Sets the store to NULL, making it so the BookmarkModel does not persist |
323 // any changes to disk. This is only useful during testing to speed up | 323 // any changes to disk. This is only useful during testing to speed up |
324 // testing. | 324 // testing. |
325 void ClearStore(); | 325 void ClearStore(); |
326 | 326 |
| 327 // Sets/returns whether or not bookmark IDs are persisted or not. |
| 328 bool PersistIDs() const { return persist_ids_; } |
| 329 void SetPersistIDs(bool value); |
| 330 |
327 private: | 331 private: |
328 // Used to order BookmarkNodes by URL. | 332 // Used to order BookmarkNodes by URL. |
329 class NodeURLComparator { | 333 class NodeURLComparator { |
330 public: | 334 public: |
331 bool operator()(BookmarkNode* n1, BookmarkNode* n2) const { | 335 bool operator()(BookmarkNode* n1, BookmarkNode* n2) const { |
332 return n1->GetURL() < n2->GetURL(); | 336 return n1->GetURL() < n2->GetURL(); |
333 } | 337 } |
334 }; | 338 }; |
335 | 339 |
336 // Implementation of IsBookmarked. Before calling this the caller must | 340 // Implementation of IsBookmarked. Before calling this the caller must |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
411 // Sets the maximum node ID to the given value. | 415 // Sets the maximum node ID to the given value. |
412 // This is used by BookmarkCodec to report the maximum ID after it's done | 416 // This is used by BookmarkCodec to report the maximum ID after it's done |
413 // decoding since during decoding codec can assign IDs to nodes if IDs are | 417 // decoding since during decoding codec can assign IDs to nodes if IDs are |
414 // persisted. | 418 // persisted. |
415 void set_next_node_id(int id) { next_node_id_ = id; } | 419 void set_next_node_id(int id) { next_node_id_ = id; } |
416 | 420 |
417 // Creates and returns a new LoadDetails. It's up to the caller to delete | 421 // Creates and returns a new LoadDetails. It's up to the caller to delete |
418 // the returned object. | 422 // the returned object. |
419 BookmarkStorage::LoadDetails* CreateLoadDetails(); | 423 BookmarkStorage::LoadDetails* CreateLoadDetails(); |
420 | 424 |
| 425 // Registers bookmarks related prefs. |
| 426 void RegisterPreferences(); |
| 427 // Loads bookmark related preferences. |
| 428 void LoadPreferences(); |
| 429 |
421 NotificationRegistrar registrar_; | 430 NotificationRegistrar registrar_; |
422 | 431 |
423 Profile* profile_; | 432 Profile* profile_; |
424 | 433 |
425 // Whether the initial set of data has been loaded. | 434 // Whether the initial set of data has been loaded. |
426 bool loaded_; | 435 bool loaded_; |
427 | 436 |
| 437 // Whether to persist bookmark IDs. |
| 438 bool persist_ids_; |
| 439 |
428 // The root node. This contains the bookmark bar node and the 'other' node as | 440 // The root node. This contains the bookmark bar node and the 'other' node as |
429 // children. | 441 // children. |
430 BookmarkNode root_; | 442 BookmarkNode root_; |
431 | 443 |
432 BookmarkNode* bookmark_bar_node_; | 444 BookmarkNode* bookmark_bar_node_; |
433 BookmarkNode* other_node_; | 445 BookmarkNode* other_node_; |
434 | 446 |
435 // The maximum ID assigned to the bookmark nodes in the model. | 447 // The maximum ID assigned to the bookmark nodes in the model. |
436 int next_node_id_; | 448 int next_node_id_; |
437 | 449 |
(...skipping 15 matching lines...) Expand all Loading... |
453 scoped_refptr<BookmarkStorage> store_; | 465 scoped_refptr<BookmarkStorage> store_; |
454 | 466 |
455 scoped_ptr<BookmarkIndex> index_; | 467 scoped_ptr<BookmarkIndex> index_; |
456 | 468 |
457 base::WaitableEvent loaded_signal_; | 469 base::WaitableEvent loaded_signal_; |
458 | 470 |
459 DISALLOW_COPY_AND_ASSIGN(BookmarkModel); | 471 DISALLOW_COPY_AND_ASSIGN(BookmarkModel); |
460 }; | 472 }; |
461 | 473 |
462 #endif // CHROME_BROWSER_BOOKMARKS_BOOKMARK_MODEL_H_ | 474 #endif // CHROME_BROWSER_BOOKMARKS_BOOKMARK_MODEL_H_ |
OLD | NEW |