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

Side by Side Diff: chrome/browser/extensions/api/bookmark_manager_private/bookmark_manager_private_api.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
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/extensions/api/bookmark_manager_private/bookmark_manage r_private_api.h" 5 #include "chrome/browser/extensions/api/bookmark_manager_private/bookmark_manage r_private_api.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/lazy_instance.h" 9 #include "base/lazy_instance.h"
10 #include "base/memory/linked_ptr.h" 10 #include "base/memory/linked_ptr.h"
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 namespace SortChildren = api::bookmark_manager_private::SortChildren; 56 namespace SortChildren = api::bookmark_manager_private::SortChildren;
57 namespace StartDrag = api::bookmark_manager_private::StartDrag; 57 namespace StartDrag = api::bookmark_manager_private::StartDrag;
58 namespace UndoInfo = api::bookmark_manager_private::GetUndoInfo; 58 namespace UndoInfo = api::bookmark_manager_private::GetUndoInfo;
59 59
60 using content::WebContents; 60 using content::WebContents;
61 61
62 namespace { 62 namespace {
63 63
64 // Returns a single bookmark node from the argument ID. 64 // Returns a single bookmark node from the argument ID.
65 // This returns NULL in case of failure. 65 // This returns NULL in case of failure.
66 const BookmarkNode* GetNodeFromString( 66 const BookmarkNode* GetNodeFromString(BookmarkModel* model,
67 BookmarkModel* model, const std::string& id_string) { 67 const std::string& id_string) {
68 int64 id; 68 int64 id;
69 if (!base::StringToInt64(id_string, &id)) 69 if (!base::StringToInt64(id_string, &id))
70 return NULL; 70 return NULL;
71 return model->GetNodeByID(id); 71 return GetBookmarkNodeByID(model, id);
72 } 72 }
73 73
74 // Gets a vector of bookmark nodes from the argument list of IDs. 74 // Gets a vector of bookmark nodes from the argument list of IDs.
75 // This returns false in the case of failure. 75 // This returns false in the case of failure.
76 bool GetNodesFromVector(BookmarkModel* model, 76 bool GetNodesFromVector(BookmarkModel* model,
77 const std::vector<std::string>& id_strings, 77 const std::vector<std::string>& id_strings,
78 std::vector<const BookmarkNode*>* nodes) { 78 std::vector<const BookmarkNode*>* nodes) {
79 79
80 if (id_strings.empty()) 80 if (id_strings.empty())
81 return false; 81 return false;
(...skipping 608 matching lines...) Expand 10 before | Expand all | Expand 10 after
690 result.enabled = undo_manager->redo_count() > 0; 690 result.enabled = undo_manager->redo_count() > 0;
691 result.label = base::UTF16ToUTF8(undo_manager->GetRedoLabel()); 691 result.label = base::UTF16ToUTF8(undo_manager->GetRedoLabel());
692 692
693 results_ = RedoInfo::Results::Create(result); 693 results_ = RedoInfo::Results::Create(result);
694 #endif // !defined(OS_ANDROID) 694 #endif // !defined(OS_ANDROID)
695 695
696 return true; 696 return true;
697 } 697 }
698 698
699 } // namespace extensions 699 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/bookmarks/bookmark_utils.cc ('k') | chrome/browser/extensions/api/bookmarks/bookmark_api_helpers.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698