OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_bookmark_helpers.h" | 5 #include "chrome/browser/extensions/extension_bookmark_helpers.h" |
6 | 6 |
7 #include "base/string_number_conversions.h" | 7 #include "base/string_number_conversions.h" |
8 #include "base/values.h" | 8 #include "base/values.h" |
9 #include "chrome/browser/bookmarks/bookmark_model.h" | 9 #include "chrome/browser/bookmarks/bookmark_model.h" |
10 #include "chrome/browser/extensions/extension_bookmarks_module_constants.h" | 10 #include "chrome/browser/extensions/extension_bookmarks_module_constants.h" |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 int64 id, | 85 int64 id, |
86 bool recursive, | 86 bool recursive, |
87 std::string* error) { | 87 std::string* error) { |
88 const BookmarkNode* node = model->GetNodeByID(id); | 88 const BookmarkNode* node = model->GetNodeByID(id); |
89 if (!node) { | 89 if (!node) { |
90 *error = keys::kNoNodeError; | 90 *error = keys::kNoNodeError; |
91 return false; | 91 return false; |
92 } | 92 } |
93 if (node == model->root_node() || | 93 if (node == model->root_node() || |
94 node == model->other_node() || | 94 node == model->other_node() || |
| 95 node == model->synced_node() || |
95 node == model->GetBookmarkBarNode()) { | 96 node == model->GetBookmarkBarNode()) { |
96 *error = keys::kModifySpecialError; | 97 *error = keys::kModifySpecialError; |
97 return false; | 98 return false; |
98 } | 99 } |
99 if (node->is_folder() && node->child_count() > 0 && !recursive) { | 100 if (node->is_folder() && node->child_count() > 0 && !recursive) { |
100 *error = keys::kFolderNotEmptyError; | 101 *error = keys::kFolderNotEmptyError; |
101 return false; | 102 return false; |
102 } | 103 } |
103 | 104 |
104 const BookmarkNode* parent = node->parent(); | 105 const BookmarkNode* parent = node->parent(); |
105 int index = parent->GetIndexOf(node); | 106 int index = parent->GetIndexOf(node); |
106 model->Remove(parent, index); | 107 model->Remove(parent, index); |
107 return true; | 108 return true; |
108 } | 109 } |
109 | 110 |
110 } | 111 } |
OLD | NEW |