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

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

Issue 10821097: Removing instances of profile_->GetBookmarkModel() as part of converting BookmarkModel to a PKS. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 4 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 (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/string_util.h" 11 #include "base/string_util.h"
12 #include "base/utf_string_conversions.h" 12 #include "base/utf_string_conversions.h"
13 #include "chrome/browser/bookmarks/bookmark_model.h" 13 #include "chrome/browser/bookmarks/bookmark_model.h"
14 #include "chrome/browser/bookmarks/bookmark_model_factory.h"
14 #include "chrome/browser/profiles/profile.h" 15 #include "chrome/browser/profiles/profile.h"
15 #include "chrome/common/url_constants.h" 16 #include "chrome/common/url_constants.h"
16 #include "net/base/escape.h" 17 #include "net/base/escape.h"
17 #include "ui/base/clipboard/scoped_clipboard_writer.h" 18 #include "ui/base/clipboard/scoped_clipboard_writer.h"
18 19
19 #if defined(OS_MACOSX) 20 #if defined(OS_MACOSX)
20 #include "chrome/browser/bookmarks/bookmark_pasteboard_helper_mac.h" 21 #include "chrome/browser/bookmarks/bookmark_pasteboard_helper_mac.h"
21 #else 22 #else
22 #include "chrome/browser/browser_process.h" 23 #include "chrome/browser/browser_process.h"
23 #endif 24 #endif
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after
312 } 313 }
313 314
314 std::vector<const BookmarkNode*> BookmarkNodeData::GetNodes( 315 std::vector<const BookmarkNode*> BookmarkNodeData::GetNodes(
315 Profile* profile) const { 316 Profile* profile) const {
316 std::vector<const BookmarkNode*> nodes; 317 std::vector<const BookmarkNode*> nodes;
317 318
318 if (!IsFromProfile(profile)) 319 if (!IsFromProfile(profile))
319 return nodes; 320 return nodes;
320 321
321 for (size_t i = 0; i < elements.size(); ++i) { 322 for (size_t i = 0; i < elements.size(); ++i) {
322 const BookmarkNode* node = 323 const BookmarkNode* node = BookmarkModelFactory::GetForProfile(
323 profile->GetBookmarkModel()->GetNodeByID(elements[i].id_); 324 profile)->GetNodeByID(elements[i].id_);
324 if (!node) { 325 if (!node) {
325 nodes.clear(); 326 nodes.clear();
326 return nodes; 327 return nodes;
327 } 328 }
328 nodes.push_back(node); 329 nodes.push_back(node);
329 } 330 }
330 return nodes; 331 return nodes;
331 } 332 }
332 333
333 const BookmarkNode* BookmarkNodeData::GetFirstNode(Profile* profile) const { 334 const BookmarkNode* BookmarkNodeData::GetFirstNode(Profile* profile) const {
(...skipping 10 matching lines...) Expand all
344 DCHECK(profile_path_.empty()); 345 DCHECK(profile_path_.empty());
345 346
346 if (profile) 347 if (profile)
347 profile_path_ = profile->GetPath(); 348 profile_path_ = profile->GetPath();
348 } 349 }
349 350
350 bool BookmarkNodeData::IsFromProfile(Profile* profile) const { 351 bool BookmarkNodeData::IsFromProfile(Profile* profile) const {
351 // An empty path means the data is not associated with any profile. 352 // An empty path means the data is not associated with any profile.
352 return !profile_path_.empty() && profile_path_ == profile->GetPath(); 353 return !profile_path_.empty() && profile_path_ == profile->GetPath();
353 } 354 }
OLDNEW
« no previous file with comments | « chrome/browser/bookmarks/bookmark_model_unittest.cc ('k') | chrome/browser/bookmarks/bookmark_node_data_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698