| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/extension_bookmarks_module.h" | 5 #include "chrome/browser/extensions/extension_bookmarks_module.h" |
| 6 | 6 |
| 7 #include "base/json_writer.h" | 7 #include "base/json_writer.h" |
| 8 #include "base/string_util.h" | 8 #include "base/string_util.h" |
| 9 #include "chrome/browser/bookmarks/bookmark_codec.h" | 9 #include "chrome/browser/bookmarks/bookmark_codec.h" |
| 10 #include "chrome/browser/bookmarks/bookmark_model.h" | 10 #include "chrome/browser/bookmarks/bookmark_model.h" |
| (...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 353 const BookmarkNode* node = *i; | 353 const BookmarkNode* node = *i; |
| 354 ExtensionBookmarks::AddNode(node, json, false); | 354 ExtensionBookmarks::AddNode(node, json, false); |
| 355 } | 355 } |
| 356 | 356 |
| 357 result_.reset(json); | 357 result_.reset(json); |
| 358 return true; | 358 return true; |
| 359 } | 359 } |
| 360 | 360 |
| 361 bool RemoveBookmarkFunction::RunImpl() { | 361 bool RemoveBookmarkFunction::RunImpl() { |
| 362 bool recursive = false; | 362 bool recursive = false; |
| 363 if (name() == | 363 if (name() == RemoveTreeBookmarkFunction::function_name()) |
| 364 extension_bookmarks_module_constants::kRemoveBookmarkTreeFunction) | |
| 365 recursive = true; | 364 recursive = true; |
| 366 | 365 |
| 367 BookmarkModel* model = profile()->GetBookmarkModel(); | 366 BookmarkModel* model = profile()->GetBookmarkModel(); |
| 368 int64 id; | 367 int64 id; |
| 369 std::string id_string; | 368 std::string id_string; |
| 370 if (args_->IsType(Value::TYPE_STRING) && | 369 if (args_->IsType(Value::TYPE_STRING) && |
| 371 args_->GetAsString(&id_string) && | 370 args_->GetAsString(&id_string) && |
| 372 StringToInt64(id_string, &id)) { | 371 StringToInt64(id_string, &id)) { |
| 373 return ExtensionBookmarks::RemoveNode(model, id, recursive, &error_); | 372 return ExtensionBookmarks::RemoveNode(model, id, recursive, &error_); |
| 374 } else { | 373 } else { |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 544 error_ = keys::kModifySpecialError; | 543 error_ = keys::kModifySpecialError; |
| 545 return false; | 544 return false; |
| 546 } | 545 } |
| 547 model->SetTitle(node, title); | 546 model->SetTitle(node, title); |
| 548 | 547 |
| 549 DictionaryValue* ret = ExtensionBookmarks::GetNodeDictionary(node, false); | 548 DictionaryValue* ret = ExtensionBookmarks::GetNodeDictionary(node, false); |
| 550 result_.reset(ret); | 549 result_.reset(ret); |
| 551 | 550 |
| 552 return true; | 551 return true; |
| 553 } | 552 } |
| OLD | NEW |