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 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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. | 327 // Sets/returns whether or not bookmark IDs are persisted or not. |
328 bool PersistIDs() const { return persist_ids_; } | 328 bool PersistIDs() const { return persist_ids_; } |
329 void SetPersistIDs(bool value); | 329 void SetPersistIDs(bool value); |
330 | 330 |
331 // Returns whether the bookmarks file changed externally. | |
332 bool file_changed() const { return file_changed_; } | |
333 | |
331 private: | 334 private: |
332 // Used to order BookmarkNodes by URL. | 335 // Used to order BookmarkNodes by URL. |
333 class NodeURLComparator { | 336 class NodeURLComparator { |
334 public: | 337 public: |
335 bool operator()(BookmarkNode* n1, BookmarkNode* n2) const { | 338 bool operator()(BookmarkNode* n1, BookmarkNode* n2) const { |
336 return n1->GetURL() < n2->GetURL(); | 339 return n1->GetURL() < n2->GetURL(); |
337 } | 340 } |
338 }; | 341 }; |
339 | 342 |
340 // Implementation of IsBookmarked. Before calling this the caller must | 343 // Implementation of IsBookmarked. Before calling this the caller must |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
411 | 414 |
412 // Generates and returns the next node ID. | 415 // Generates and returns the next node ID. |
413 int generate_next_node_id(); | 416 int generate_next_node_id(); |
414 | 417 |
415 // Sets the maximum node ID to the given value. | 418 // Sets the maximum node ID to the given value. |
416 // This is used by BookmarkCodec to report the maximum ID after it's done | 419 // This is used by BookmarkCodec to report the maximum ID after it's done |
417 // decoding since during decoding codec can assign IDs to nodes if IDs are | 420 // decoding since during decoding codec can assign IDs to nodes if IDs are |
418 // persisted. | 421 // persisted. |
419 void set_next_node_id(int id) { next_node_id_ = id; } | 422 void set_next_node_id(int id) { next_node_id_ = id; } |
420 | 423 |
424 // Records that the bookmarks file was changed externally. | |
425 void SetFileChanged(); | |
426 | |
421 // Creates and returns a new LoadDetails. It's up to the caller to delete | 427 // Creates and returns a new LoadDetails. It's up to the caller to delete |
422 // the returned object. | 428 // the returned object. |
423 BookmarkStorage::LoadDetails* CreateLoadDetails(); | 429 BookmarkStorage::LoadDetails* CreateLoadDetails(); |
424 | 430 |
425 // Registers bookmarks related prefs. | 431 // Registers bookmarks related prefs. |
426 void RegisterPreferences(); | 432 void RegisterPreferences(); |
427 // Loads bookmark related preferences. | 433 // Loads bookmark related preferences. |
428 void LoadPreferences(); | 434 void LoadPreferences(); |
429 | 435 |
430 NotificationRegistrar registrar_; | 436 NotificationRegistrar registrar_; |
431 | 437 |
432 Profile* profile_; | 438 Profile* profile_; |
433 | 439 |
434 // Whether the initial set of data has been loaded. | 440 // Whether the initial set of data has been loaded. |
435 bool loaded_; | 441 bool loaded_; |
436 | 442 |
437 // Whether to persist bookmark IDs. | 443 // Whether to persist bookmark IDs. |
438 bool persist_ids_; | 444 bool persist_ids_; |
439 | 445 |
446 // Whether the bookmarks file was changed manulaly by the user. | |
447 bool file_changed_; | |
sky
2009/05/28 19:13:17
manulaly -> manually
Can you also add this is set
Munjal (Google)
2009/05/28 19:17:52
Done. I used "externally" instead of "manually" as
| |
448 | |
440 // The root node. This contains the bookmark bar node and the 'other' node as | 449 // The root node. This contains the bookmark bar node and the 'other' node as |
441 // children. | 450 // children. |
442 BookmarkNode root_; | 451 BookmarkNode root_; |
443 | 452 |
444 BookmarkNode* bookmark_bar_node_; | 453 BookmarkNode* bookmark_bar_node_; |
445 BookmarkNode* other_node_; | 454 BookmarkNode* other_node_; |
446 | 455 |
447 // The maximum ID assigned to the bookmark nodes in the model. | 456 // The maximum ID assigned to the bookmark nodes in the model. |
448 int next_node_id_; | 457 int next_node_id_; |
449 | 458 |
(...skipping 15 matching lines...) Expand all Loading... | |
465 scoped_refptr<BookmarkStorage> store_; | 474 scoped_refptr<BookmarkStorage> store_; |
466 | 475 |
467 scoped_ptr<BookmarkIndex> index_; | 476 scoped_ptr<BookmarkIndex> index_; |
468 | 477 |
469 base::WaitableEvent loaded_signal_; | 478 base::WaitableEvent loaded_signal_; |
470 | 479 |
471 DISALLOW_COPY_AND_ASSIGN(BookmarkModel); | 480 DISALLOW_COPY_AND_ASSIGN(BookmarkModel); |
472 }; | 481 }; |
473 | 482 |
474 #endif // CHROME_BROWSER_BOOKMARKS_BOOKMARK_MODEL_H_ | 483 #endif // CHROME_BROWSER_BOOKMARKS_BOOKMARK_MODEL_H_ |
OLD | NEW |