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

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

Issue 242823002: Extract GetNodeByID() method from BookmarkModel. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: revert a change in bookmarks_helper.cc that colides with a wstring and cq does not like that Created 6 years, 8 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
« no previous file with comments | « chrome/browser/bookmarks/bookmark_model.cc ('k') | chrome/browser/bookmarks/bookmark_utils.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "chrome/browser/bookmarks/bookmark_node_data.h" 5 #include "chrome/browser/bookmarks/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 "chrome/browser/bookmarks/bookmark_model.h" 13 #include "chrome/browser/bookmarks/bookmark_utils.h"
14 #include "ui/base/clipboard/scoped_clipboard_writer.h" 14 #include "ui/base/clipboard/scoped_clipboard_writer.h"
15 15
16 const char* BookmarkNodeData::kClipboardFormatString = 16 const char* BookmarkNodeData::kClipboardFormatString =
17 "chromium/x-bookmark-entries"; 17 "chromium/x-bookmark-entries";
18 18
19 BookmarkNodeData::Element::Element() : is_url(false), id_(0) { 19 BookmarkNodeData::Element::Element() : is_url(false), id_(0) {
20 } 20 }
21 21
22 BookmarkNodeData::Element::Element(const BookmarkNode* node) 22 BookmarkNodeData::Element::Element(const BookmarkNode* node)
23 : is_url(node->is_url()), 23 : is_url(node->is_url()),
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
243 243
244 std::vector<const BookmarkNode*> BookmarkNodeData::GetNodes( 244 std::vector<const BookmarkNode*> BookmarkNodeData::GetNodes(
245 BookmarkModel* model, 245 BookmarkModel* model,
246 const base::FilePath& profile_path) const { 246 const base::FilePath& profile_path) const {
247 std::vector<const BookmarkNode*> nodes; 247 std::vector<const BookmarkNode*> nodes;
248 248
249 if (!IsFromProfilePath(profile_path)) 249 if (!IsFromProfilePath(profile_path))
250 return nodes; 250 return nodes;
251 251
252 for (size_t i = 0; i < elements.size(); ++i) { 252 for (size_t i = 0; i < elements.size(); ++i) {
253 const BookmarkNode* node = model->GetNodeByID(elements[i].id_); 253 const BookmarkNode* node = GetBookmarkNodeByID(model, elements[i].id_);
254 if (!node) { 254 if (!node) {
255 nodes.clear(); 255 nodes.clear();
256 return nodes; 256 return nodes;
257 } 257 }
258 nodes.push_back(node); 258 nodes.push_back(node);
259 } 259 }
260 return nodes; 260 return nodes;
261 } 261 }
262 262
263 const BookmarkNode* BookmarkNodeData::GetFirstNode( 263 const BookmarkNode* BookmarkNodeData::GetFirstNode(
(...skipping 12 matching lines...) Expand all
276 const base::FilePath& profile_path) { 276 const base::FilePath& profile_path) {
277 DCHECK(profile_path_.empty()); 277 DCHECK(profile_path_.empty());
278 profile_path_ = profile_path; 278 profile_path_ = profile_path;
279 } 279 }
280 280
281 bool BookmarkNodeData::IsFromProfilePath( 281 bool BookmarkNodeData::IsFromProfilePath(
282 const base::FilePath& profile_path) const { 282 const base::FilePath& profile_path) const {
283 // An empty path means the data is not associated with any profile. 283 // An empty path means the data is not associated with any profile.
284 return !profile_path_.empty() && profile_path_ == profile_path; 284 return !profile_path_.empty() && profile_path_ == profile_path;
285 } 285 }
OLDNEW
« no previous file with comments | « chrome/browser/bookmarks/bookmark_model.cc ('k') | chrome/browser/bookmarks/bookmark_utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698