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 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
354 void BookmarkManagerPrivateDragEventRouter::ClearBookmarkNodeData() { | 354 void BookmarkManagerPrivateDragEventRouter::ClearBookmarkNodeData() { |
355 bookmark_drag_data_.Clear(); | 355 bookmark_drag_data_.Clear(); |
356 } | 356 } |
357 | 357 |
358 bool ClipboardBookmarkManagerFunction::CopyOrCut(bool cut, | 358 bool ClipboardBookmarkManagerFunction::CopyOrCut(bool cut, |
359 const std::vector<std::string>& id_list) { | 359 const std::vector<std::string>& id_list) { |
360 BookmarkModel* model = GetBookmarkModel(); | 360 BookmarkModel* model = GetBookmarkModel(); |
361 ChromeBookmarkClient* client = GetChromeBookmarkClient(); | 361 ChromeBookmarkClient* client = GetChromeBookmarkClient(); |
362 std::vector<const BookmarkNode*> nodes; | 362 std::vector<const BookmarkNode*> nodes; |
363 EXTENSION_FUNCTION_VALIDATE(GetNodesFromVector(model, id_list, &nodes)); | 363 EXTENSION_FUNCTION_VALIDATE(GetNodesFromVector(model, id_list, &nodes)); |
364 if (cut && client->HasDescendantsOfManagedNode(nodes)) { | 364 if (cut && bookmarks::HasDescendantsOf(nodes, client->managed_node())) { |
365 error_ = bookmark_keys::kModifyManagedError; | 365 error_ = bookmark_keys::kModifyManagedError; |
366 return false; | 366 return false; |
367 } | 367 } |
368 bookmarks::CopyToClipboard(model, nodes, cut); | 368 bookmarks::CopyToClipboard(model, nodes, cut); |
369 return true; | 369 return true; |
370 } | 370 } |
371 | 371 |
372 bool BookmarkManagerPrivateCopyFunction::RunOnReady() { | 372 bool BookmarkManagerPrivateCopyFunction::RunOnReady() { |
373 scoped_ptr<Copy::Params> params(Copy::Params::Create(*args_)); | 373 scoped_ptr<Copy::Params> params(Copy::Params::Create(*args_)); |
374 EXTENSION_FUNCTION_VALIDATE(params); | 374 EXTENSION_FUNCTION_VALIDATE(params); |
(...skipping 460 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
835 | 835 |
836 enhanced_bookmarks::EnhancedBookmarkModel* model = | 836 enhanced_bookmarks::EnhancedBookmarkModel* model = |
837 enhanced_bookmarks::EnhancedBookmarkModelFactory::GetForBrowserContext( | 837 enhanced_bookmarks::EnhancedBookmarkModelFactory::GetForBrowserContext( |
838 browser_context()); | 838 browser_context()); |
839 model->SetVersionSuffix(params->version); | 839 model->SetVersionSuffix(params->version); |
840 | 840 |
841 return true; | 841 return true; |
842 } | 842 } |
843 | 843 |
844 } // namespace extensions | 844 } // namespace extensions |
OLD | NEW |