Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 COMPONENTS_BOOKMARKS_BROWSER_BOOKMARK_NODE_DATA_H_ | 5 #ifndef COMPONENTS_BOOKMARKS_BROWSER_BOOKMARK_NODE_DATA_H_ |
| 6 #define COMPONENTS_BOOKMARKS_BROWSER_BOOKMARK_NODE_DATA_H_ | 6 #define COMPONENTS_BOOKMARKS_BROWSER_BOOKMARK_NODE_DATA_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 142 const base::FilePath& profile_path) const; | 142 const base::FilePath& profile_path) const; |
| 143 | 143 |
| 144 // Convenience for getting the first node. Returns NULL if the data doesn't | 144 // Convenience for getting the first node. Returns NULL if the data doesn't |
| 145 // match any nodes or there is more than one node. | 145 // match any nodes or there is more than one node. |
| 146 const BookmarkNode* GetFirstNode(BookmarkModel* model, | 146 const BookmarkNode* GetFirstNode(BookmarkModel* model, |
| 147 const base::FilePath& profile_path) const; | 147 const base::FilePath& profile_path) const; |
| 148 | 148 |
| 149 // Do we contain valid data? | 149 // Do we contain valid data? |
| 150 bool is_valid() const { return !elements.empty(); } | 150 bool is_valid() const { return !elements.empty(); } |
| 151 | 151 |
| 152 // Number of elements. | |
| 153 size_t num_elements() const { return elements.size(); } | |
| 154 | |
| 152 // Returns true if there is a single url. | 155 // Returns true if there is a single url. |
| 153 bool has_single_url() const { return is_valid() && elements[0].is_url; } | 156 bool has_single_url() const { |
| 154 | 157 return num_elements() == 1 && elements[0].is_url; |
| 155 // Number of elements. | 158 } |
| 156 size_t size() const { return elements.size(); } | |
|
sky
2015/01/26 16:23:41
It's more comment to use size() for members like t
tfarina
2015/01/28 16:32:54
Done.
| |
| 157 | 159 |
| 158 // Clears the data. | 160 // Clears the data. |
| 159 void Clear(); | 161 void Clear(); |
| 160 | 162 |
| 161 // Sets |profile_path_|. This is useful for the constructors/readers that | 163 // Sets |profile_path_|. This is useful for the constructors/readers that |
| 162 // don't set it. This should only be called if the profile path is not | 164 // don't set it. This should only be called if the profile path is not |
| 163 // already set. | 165 // already set. |
| 164 void SetOriginatingProfilePath(const base::FilePath& profile_path); | 166 void SetOriginatingProfilePath(const base::FilePath& profile_path); |
| 165 | 167 |
| 166 // Returns true if this data is from the specified profile path. | 168 // Returns true if this data is from the specified profile path. |
| 167 bool IsFromProfilePath(const base::FilePath& profile_path) const; | 169 bool IsFromProfilePath(const base::FilePath& profile_path) const; |
| 168 | 170 |
| 169 // The actual elements written to the clipboard. | 171 // The actual elements written to the clipboard. |
| 170 std::vector<Element> elements; | 172 std::vector<Element> elements; |
| 171 | 173 |
| 172 private: | 174 private: |
| 173 // Path of the profile we originated from. | 175 // Path of the profile we originated from. |
| 174 base::FilePath profile_path_; | 176 base::FilePath profile_path_; |
| 175 }; | 177 }; |
| 176 | 178 |
| 177 } // namespace bookmarks | 179 } // namespace bookmarks |
| 178 | 180 |
| 179 #endif // COMPONENTS_BOOKMARKS_BROWSER_BOOKMARK_NODE_DATA_H_ | 181 #endif // COMPONENTS_BOOKMARKS_BROWSER_BOOKMARK_NODE_DATA_H_ |
| OLD | NEW |