| Index: chrome/browser/extensions/extension_bookmarks_module.cc
|
| diff --git a/chrome/browser/extensions/extension_bookmarks_module.cc b/chrome/browser/extensions/extension_bookmarks_module.cc
|
| index 2d7cbb3a431c03a5d277b2152f35f9cee21ad6c0..f0acba9717f4b324e1b15c8defcfcef0d08b7b2e 100644
|
| --- a/chrome/browser/extensions/extension_bookmarks_module.cc
|
| +++ b/chrome/browser/extensions/extension_bookmarks_module.cc
|
| @@ -358,19 +358,21 @@ bool SearchBookmarksFunction::RunImpl() {
|
| }
|
|
|
| bool RemoveBookmarkFunction::RunImpl() {
|
| - EXTENSION_FUNCTION_VALIDATE(args_->IsType(Value::TYPE_LIST));
|
| - const ListValue* args = static_cast<const ListValue*>(args_);
|
| bool recursive = false;
|
| - EXTENSION_FUNCTION_VALIDATE(args->GetBoolean(1, &recursive));
|
| + if (name() ==
|
| + extension_bookmarks_module_constants::kRemoveBookmarkTreeFunction)
|
| + recursive = true;
|
|
|
| BookmarkModel* model = profile()->GetBookmarkModel();
|
| int64 id;
|
| std::string id_string;
|
| - if (args->GetString(0, &id_string) && StringToInt64(id_string, &id)) {
|
| + if (args_->IsType(Value::TYPE_STRING) &&
|
| + args_->GetAsString(&id_string) &&
|
| + StringToInt64(id_string, &id)) {
|
| return ExtensionBookmarks::RemoveNode(model, id, recursive, &error_);
|
| } else {
|
| - ListValue* ids;
|
| - EXTENSION_FUNCTION_VALIDATE(args->GetList(0, &ids));
|
| + EXTENSION_FUNCTION_VALIDATE(args_->IsType(Value::TYPE_LIST));
|
| + ListValue* ids = static_cast<ListValue*>(args_);
|
| size_t count = ids->GetSize();
|
| EXTENSION_FUNCTION_VALIDATE(count > 0);
|
| for (size_t i = 0; i < count; ++i) {
|
| @@ -477,9 +479,13 @@ bool MoveBookmarkFunction::RunImpl() {
|
| // Optional, defaults to current parent.
|
| parent = node->GetParent();
|
| } else {
|
| - int parentId;
|
| - EXTENSION_FUNCTION_VALIDATE(destination->GetInteger(keys::kParentIdKey,
|
| - &parentId));
|
| + std::string parentId_string;
|
| + EXTENSION_FUNCTION_VALIDATE(destination->GetString(keys::kParentIdKey,
|
| + &parentId_string));
|
| + int64 parentId;
|
| + if (!GetBookmarkIdAsInt64(parentId_string, &parentId))
|
| + return false;
|
| +
|
| parent = model->GetNodeByID(parentId);
|
| }
|
| if (!parent) {
|
|
|