| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 |
| OLD | NEW |