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

Side by Side Diff: components/bookmarks/browser/bookmark_node_data.h

Issue 870293002: bookmarks: BookmarkNodeData's size() cleanups. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: review Created 5 years, 10 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
OLDNEW
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 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 // Returns true if there is a single url. 152 // Returns true if there is a single url.
153 bool has_single_url() const { return is_valid() && elements[0].is_url; } 153 bool has_single_url() const { return size() == 1 && elements[0].is_url; }
154 154
155 // Number of elements. 155 // Number of elements.
156 size_t size() const { return elements.size(); } 156 size_t size() const { return elements.size(); }
157 157
158 // Clears the data. 158 // Clears the data.
159 void Clear(); 159 void Clear();
160 160
161 // Sets |profile_path_|. This is useful for the constructors/readers that 161 // 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 162 // don't set it. This should only be called if the profile path is not
163 // already set. 163 // already set.
164 void SetOriginatingProfilePath(const base::FilePath& profile_path); 164 void SetOriginatingProfilePath(const base::FilePath& profile_path);
165 165
166 // Returns true if this data is from the specified profile path. 166 // Returns true if this data is from the specified profile path.
167 bool IsFromProfilePath(const base::FilePath& profile_path) const; 167 bool IsFromProfilePath(const base::FilePath& profile_path) const;
168 168
169 // The actual elements written to the clipboard. 169 // The actual elements written to the clipboard.
170 std::vector<Element> elements; 170 std::vector<Element> elements;
171 171
172 private: 172 private:
173 // Path of the profile we originated from. 173 // Path of the profile we originated from.
174 base::FilePath profile_path_; 174 base::FilePath profile_path_;
175 }; 175 };
176 176
177 } // namespace bookmarks 177 } // namespace bookmarks
178 178
179 #endif // COMPONENTS_BOOKMARKS_BROWSER_BOOKMARK_NODE_DATA_H_ 179 #endif // COMPONENTS_BOOKMARKS_BROWSER_BOOKMARK_NODE_DATA_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/bookmarks/bookmark_menu_delegate.cc ('k') | components/bookmarks/browser/bookmark_node_data.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698