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

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

Issue 422673002: Move BookmarkNodeData into bookmarks namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix mac Created 6 years, 5 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 | Annotate | Revision Log
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 #include "components/bookmarks/browser/bookmark_node_data.h" 5 #include "components/bookmarks/browser/bookmark_node_data.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/pickle.h" 10 #include "base/pickle.h"
11 #include "base/strings/string_util.h" 11 #include "base/strings/string_util.h"
12 #include "base/strings/utf_string_conversions.h" 12 #include "base/strings/utf_string_conversions.h"
13 #include "components/bookmarks/browser/bookmark_utils.h" 13 #include "components/bookmarks/browser/bookmark_utils.h"
14 #include "ui/base/clipboard/scoped_clipboard_writer.h" 14 #include "ui/base/clipboard/scoped_clipboard_writer.h"
15 15
16 namespace bookmarks {
17
16 const char* BookmarkNodeData::kClipboardFormatString = 18 const char* BookmarkNodeData::kClipboardFormatString =
17 "chromium/x-bookmark-entries"; 19 "chromium/x-bookmark-entries";
18 20
19 BookmarkNodeData::Element::Element() : is_url(false), id_(0) { 21 BookmarkNodeData::Element::Element() : is_url(false), id_(0) {
20 } 22 }
21 23
22 BookmarkNodeData::Element::Element(const BookmarkNode* node) 24 BookmarkNodeData::Element::Element(const BookmarkNode* node)
23 : is_url(node->is_url()), 25 : is_url(node->is_url()),
24 url(node->url()), 26 url(node->url()),
25 title(node->GetTitle()), 27 title(node->GetTitle()),
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
244 246
245 std::vector<const BookmarkNode*> BookmarkNodeData::GetNodes( 247 std::vector<const BookmarkNode*> BookmarkNodeData::GetNodes(
246 BookmarkModel* model, 248 BookmarkModel* model,
247 const base::FilePath& profile_path) const { 249 const base::FilePath& profile_path) const {
248 std::vector<const BookmarkNode*> nodes; 250 std::vector<const BookmarkNode*> nodes;
249 251
250 if (!IsFromProfilePath(profile_path)) 252 if (!IsFromProfilePath(profile_path))
251 return nodes; 253 return nodes;
252 254
253 for (size_t i = 0; i < elements.size(); ++i) { 255 for (size_t i = 0; i < elements.size(); ++i) {
254 const BookmarkNode* node = 256 const BookmarkNode* node = GetBookmarkNodeByID(model, elements[i].id_);
255 bookmarks::GetBookmarkNodeByID(model, elements[i].id_);
256 if (!node) { 257 if (!node) {
257 nodes.clear(); 258 nodes.clear();
258 return nodes; 259 return nodes;
259 } 260 }
260 nodes.push_back(node); 261 nodes.push_back(node);
261 } 262 }
262 return nodes; 263 return nodes;
263 } 264 }
264 265
265 const BookmarkNode* BookmarkNodeData::GetFirstNode( 266 const BookmarkNode* BookmarkNodeData::GetFirstNode(
(...skipping 12 matching lines...) Expand all
278 const base::FilePath& profile_path) { 279 const base::FilePath& profile_path) {
279 DCHECK(profile_path_.empty()); 280 DCHECK(profile_path_.empty());
280 profile_path_ = profile_path; 281 profile_path_ = profile_path;
281 } 282 }
282 283
283 bool BookmarkNodeData::IsFromProfilePath( 284 bool BookmarkNodeData::IsFromProfilePath(
284 const base::FilePath& profile_path) const { 285 const base::FilePath& profile_path) const {
285 // An empty path means the data is not associated with any profile. 286 // An empty path means the data is not associated with any profile.
286 return !profile_path_.empty() && profile_path_ == profile_path; 287 return !profile_path_.empty() && profile_path_ == profile_path;
287 } 288 }
289
290 } // namespace bookmarks
OLDNEW
« no previous file with comments | « components/bookmarks/browser/bookmark_node_data.h ('k') | components/bookmarks/browser/bookmark_node_data_ios.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698