| 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/bookmarks/bookmarks_api.h" | 5 #include "chrome/browser/extensions/api/bookmarks/bookmarks_api.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
| 9 #include "base/i18n/file_util_icu.h" | 9 #include "base/i18n/file_util_icu.h" |
| 10 #include "base/i18n/time_formatting.h" | 10 #include "base/i18n/time_formatting.h" |
| (...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 205 bool BookmarksFunction::CanBeModified(const BookmarkNode* node) { | 205 bool BookmarksFunction::CanBeModified(const BookmarkNode* node) { |
| 206 if (!node) { | 206 if (!node) { |
| 207 error_ = keys::kNoParentError; | 207 error_ = keys::kNoParentError; |
| 208 return false; | 208 return false; |
| 209 } | 209 } |
| 210 if (node->is_root()) { | 210 if (node->is_root()) { |
| 211 error_ = keys::kModifySpecialError; | 211 error_ = keys::kModifySpecialError; |
| 212 return false; | 212 return false; |
| 213 } | 213 } |
| 214 ChromeBookmarkClient* client = GetChromeBookmarkClient(); | 214 ChromeBookmarkClient* client = GetChromeBookmarkClient(); |
| 215 if (client->IsDescendantOfManagedNode(node)) { | 215 if (::bookmarks::IsDescendantOf(node, client->managed_node()) || |
| 216 ::bookmarks::IsDescendantOf(node, client->supervised_node())) { |
| 216 error_ = keys::kModifyManagedError; | 217 error_ = keys::kModifyManagedError; |
| 217 return false; | 218 return false; |
| 218 } | 219 } |
| 219 return true; | 220 return true; |
| 220 } | 221 } |
| 221 | 222 |
| 222 void BookmarksFunction::BookmarkModelChanged() { | 223 void BookmarksFunction::BookmarkModelChanged() { |
| 223 } | 224 } |
| 224 | 225 |
| 225 void BookmarksFunction::BookmarkModelLoaded(BookmarkModel* model, | 226 void BookmarksFunction::BookmarkModelLoaded(BookmarkModel* model, |
| (...skipping 618 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 844 } | 845 } |
| 845 | 846 |
| 846 void BookmarksExportFunction::FileSelected(const base::FilePath& path, | 847 void BookmarksExportFunction::FileSelected(const base::FilePath& path, |
| 847 int index, | 848 int index, |
| 848 void* params) { | 849 void* params) { |
| 849 bookmark_html_writer::WriteBookmarks(GetProfile(), path, NULL); | 850 bookmark_html_writer::WriteBookmarks(GetProfile(), path, NULL); |
| 850 Release(); // Balanced in BookmarksIOFunction::SelectFile() | 851 Release(); // Balanced in BookmarksIOFunction::SelectFile() |
| 851 } | 852 } |
| 852 | 853 |
| 853 } // namespace extensions | 854 } // namespace extensions |
| OLD | NEW |