| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <set> | 9 #include <set> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 favicon_load_handle_ = handle; | 108 favicon_load_handle_ = handle; |
| 109 } | 109 } |
| 110 | 110 |
| 111 // Accessor method for controlling the visibility of a bookmark node/sub-tree. | 111 // Accessor method for controlling the visibility of a bookmark node/sub-tree. |
| 112 // Note that visibility is not propagated down the tree hierarchy so if a | 112 // Note that visibility is not propagated down the tree hierarchy so if a |
| 113 // parent node is marked as invisible, a child node may return "Visible". This | 113 // parent node is marked as invisible, a child node may return "Visible". This |
| 114 // function is primarily useful when traversing the model to generate a UI | 114 // function is primarily useful when traversing the model to generate a UI |
| 115 // representation but we may want to suppress some nodes. | 115 // representation but we may want to suppress some nodes. |
| 116 // TODO(yfriedman): Remove this when enable-synced-bookmarks-folder is | 116 // TODO(yfriedman): Remove this when enable-synced-bookmarks-folder is |
| 117 // no longer a command line flag. | 117 // no longer a command line flag. |
| 118 bool IsVisible() const; | 118 virtual bool IsVisible() const; |
| 119 | 119 |
| 120 // TODO(sky): Consider adding last visit time here, it'll greatly simplify | 120 // TODO(sky): Consider adding last visit time here, it'll greatly simplify |
| 121 // HistoryContentsProvider. | 121 // HistoryContentsProvider. |
| 122 | 122 |
| 123 private: | 123 private: |
| 124 friend class BookmarkModel; | 124 friend class BookmarkModel; |
| 125 | 125 |
| 126 // A helper function to initialize various fields during construction. | 126 // A helper function to initialize various fields during construction. |
| 127 void Initialize(int64 id); | 127 void Initialize(int64 id); |
| 128 | 128 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 151 // Whether the favicon has been loaded. | 151 // Whether the favicon has been loaded. |
| 152 bool is_favicon_loaded_; | 152 bool is_favicon_loaded_; |
| 153 | 153 |
| 154 // If non-zero, it indicates we're loading the favicon and this is the handle | 154 // If non-zero, it indicates we're loading the favicon and this is the handle |
| 155 // from the HistoryService. | 155 // from the HistoryService. |
| 156 HistoryService::Handle favicon_load_handle_; | 156 HistoryService::Handle favicon_load_handle_; |
| 157 | 157 |
| 158 DISALLOW_COPY_AND_ASSIGN(BookmarkNode); | 158 DISALLOW_COPY_AND_ASSIGN(BookmarkNode); |
| 159 }; | 159 }; |
| 160 | 160 |
| 161 // BookmarkPermanentNode ------------------------------------------------------ |
| 162 |
| 163 // The permanent nodes are the three special top level nodes "bookmark_bar", |
| 164 // "synced" and "other". Their visibility is dependent on information from the |
| 165 // profile, hence this special subclass to accomodate them. |
| 166 class BookmarkPermanentNode : public BookmarkNode { |
| 167 public: |
| 168 // Creates a new node with |id| and |url|. |
| 169 BookmarkPermanentNode(int64 id, const GURL& url, Profile* profile); |
| 170 |
| 171 virtual ~BookmarkPermanentNode(); |
| 172 virtual bool IsVisible() const; |
| 173 |
| 174 private: |
| 175 Profile* profile_; |
| 176 |
| 177 DISALLOW_COPY_AND_ASSIGN(BookmarkPermanentNode); |
| 178 }; |
| 179 |
| 161 // BookmarkModel -------------------------------------------------------------- | 180 // BookmarkModel -------------------------------------------------------------- |
| 162 | 181 |
| 163 // BookmarkModel provides a directed acyclic graph of URLs and folders. | 182 // BookmarkModel provides a directed acyclic graph of URLs and folders. |
| 164 // Three graphs are provided for the three entry points: those on the 'bookmarks | 183 // Three graphs are provided for the three entry points: those on the 'bookmarks |
| 165 // bar', those in the 'other bookmarks' folder and those in the 'synced' folder. | 184 // bar', those in the 'other bookmarks' folder and those in the 'synced' folder. |
| 166 // | 185 // |
| 167 // An observer may be attached to observe relevant events. | 186 // An observer may be attached to observe relevant events. |
| 168 // | 187 // |
| 169 // You should NOT directly create a BookmarkModel, instead go through the | 188 // You should NOT directly create a BookmarkModel, instead go through the |
| 170 // Profile. | 189 // Profile. |
| (...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 454 scoped_ptr<BookmarkIndex> index_; | 473 scoped_ptr<BookmarkIndex> index_; |
| 455 | 474 |
| 456 base::WaitableEvent loaded_signal_; | 475 base::WaitableEvent loaded_signal_; |
| 457 | 476 |
| 458 scoped_ptr<BookmarkExpandedStateTracker> expanded_state_tracker_; | 477 scoped_ptr<BookmarkExpandedStateTracker> expanded_state_tracker_; |
| 459 | 478 |
| 460 DISALLOW_COPY_AND_ASSIGN(BookmarkModel); | 479 DISALLOW_COPY_AND_ASSIGN(BookmarkModel); |
| 461 }; | 480 }; |
| 462 | 481 |
| 463 #endif // CHROME_BROWSER_BOOKMARKS_BOOKMARK_MODEL_H_ | 482 #endif // CHROME_BROWSER_BOOKMARKS_BOOKMARK_MODEL_H_ |
| OLD | NEW |