Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(913)

Side by Side Diff: chrome/browser/extensions/api/bookmark_manager_private/bookmark_manager_private_api.cc

Issue 2666093002: Remove base::FundamentalValue (Closed)
Patch Set: Rebase Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <memory> 10 #include <memory>
(...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after
428 bookmarks::PasteFromClipboard(model, parent_node, highest_index); 428 bookmarks::PasteFromClipboard(model, parent_node, highest_index);
429 return true; 429 return true;
430 } 430 }
431 431
432 bool BookmarkManagerPrivateCanPasteFunction::RunOnReady() { 432 bool BookmarkManagerPrivateCanPasteFunction::RunOnReady() {
433 std::unique_ptr<CanPaste::Params> params(CanPaste::Params::Create(*args_)); 433 std::unique_ptr<CanPaste::Params> params(CanPaste::Params::Create(*args_));
434 EXTENSION_FUNCTION_VALIDATE(params); 434 EXTENSION_FUNCTION_VALIDATE(params);
435 435
436 PrefService* prefs = user_prefs::UserPrefs::Get(GetProfile()); 436 PrefService* prefs = user_prefs::UserPrefs::Get(GetProfile());
437 if (!prefs->GetBoolean(bookmarks::prefs::kEditBookmarksEnabled)) { 437 if (!prefs->GetBoolean(bookmarks::prefs::kEditBookmarksEnabled)) {
438 SetResult(base::MakeUnique<base::FundamentalValue>(false)); 438 SetResult(base::MakeUnique<base::Value>(false));
439 return true; 439 return true;
440 } 440 }
441 441
442 BookmarkModel* model = 442 BookmarkModel* model =
443 BookmarkModelFactory::GetForBrowserContext(GetProfile()); 443 BookmarkModelFactory::GetForBrowserContext(GetProfile());
444 const BookmarkNode* parent_node = GetNodeFromString(model, params->parent_id); 444 const BookmarkNode* parent_node = GetNodeFromString(model, params->parent_id);
445 if (!parent_node) { 445 if (!parent_node) {
446 error_ = bookmark_keys::kNoParentError; 446 error_ = bookmark_keys::kNoParentError;
447 return false; 447 return false;
448 } 448 }
449 bool can_paste = bookmarks::CanPasteFromClipboard(model, parent_node); 449 bool can_paste = bookmarks::CanPasteFromClipboard(model, parent_node);
450 SetResult(base::MakeUnique<base::FundamentalValue>(can_paste)); 450 SetResult(base::MakeUnique<base::Value>(can_paste));
451 return true; 451 return true;
452 } 452 }
453 453
454 bool BookmarkManagerPrivateSortChildrenFunction::RunOnReady() { 454 bool BookmarkManagerPrivateSortChildrenFunction::RunOnReady() {
455 if (!EditBookmarksEnabled()) 455 if (!EditBookmarksEnabled())
456 return false; 456 return false;
457 457
458 std::unique_ptr<SortChildren::Params> params( 458 std::unique_ptr<SortChildren::Params> params(
459 SortChildren::Params::Create(*args_)); 459 SortChildren::Params::Create(*args_));
460 EXTENSION_FUNCTION_VALIDATE(params); 460 EXTENSION_FUNCTION_VALIDATE(params);
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
644 if (params->folders_only) 644 if (params->folders_only)
645 bookmark_api_helpers::AddNodeFoldersOnly(managed, node, &nodes, true); 645 bookmark_api_helpers::AddNodeFoldersOnly(managed, node, &nodes, true);
646 else 646 else
647 bookmark_api_helpers::AddNode(managed, node, &nodes, true); 647 bookmark_api_helpers::AddNode(managed, node, &nodes, true);
648 results_ = GetSubtree::Results::Create(nodes); 648 results_ = GetSubtree::Results::Create(nodes);
649 return true; 649 return true;
650 } 650 }
651 651
652 bool BookmarkManagerPrivateCanEditFunction::RunOnReady() { 652 bool BookmarkManagerPrivateCanEditFunction::RunOnReady() {
653 PrefService* prefs = user_prefs::UserPrefs::Get(GetProfile()); 653 PrefService* prefs = user_prefs::UserPrefs::Get(GetProfile());
654 SetResult(base::MakeUnique<base::FundamentalValue>( 654 SetResult(base::MakeUnique<base::Value>(
655 prefs->GetBoolean(bookmarks::prefs::kEditBookmarksEnabled))); 655 prefs->GetBoolean(bookmarks::prefs::kEditBookmarksEnabled)));
656 return true; 656 return true;
657 } 657 }
658 658
659 bool BookmarkManagerPrivateRecordLaunchFunction::RunOnReady() { 659 bool BookmarkManagerPrivateRecordLaunchFunction::RunOnReady() {
660 RecordBookmarkLaunch(NULL, BOOKMARK_LAUNCH_LOCATION_MANAGER); 660 RecordBookmarkLaunch(NULL, BOOKMARK_LAUNCH_LOCATION_MANAGER);
661 return true; 661 return true;
662 } 662 }
663 663
664 bool BookmarkManagerPrivateCreateWithMetaInfoFunction::RunOnReady() { 664 bool BookmarkManagerPrivateCreateWithMetaInfoFunction::RunOnReady() {
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
791 new_meta_info.insert(node->GetMetaInfoMap()->begin(), 791 new_meta_info.insert(node->GetMetaInfoMap()->begin(),
792 node->GetMetaInfoMap()->end()); 792 node->GetMetaInfoMap()->end());
793 } 793 }
794 model->SetNodeMetaInfoMap(node, new_meta_info); 794 model->SetNodeMetaInfoMap(node, new_meta_info);
795 795
796 return true; 796 return true;
797 } 797 }
798 798
799 bool BookmarkManagerPrivateCanOpenNewWindowsFunction::RunOnReady() { 799 bool BookmarkManagerPrivateCanOpenNewWindowsFunction::RunOnReady() {
800 bool can_open_new_windows = true; 800 bool can_open_new_windows = true;
801 SetResult(base::MakeUnique<base::FundamentalValue>(can_open_new_windows)); 801 SetResult(base::MakeUnique<base::Value>(can_open_new_windows));
802 return true; 802 return true;
803 } 803 }
804 804
805 bool BookmarkManagerPrivateRemoveTreesFunction::RunOnReady() { 805 bool BookmarkManagerPrivateRemoveTreesFunction::RunOnReady() {
806 if (!EditBookmarksEnabled()) 806 if (!EditBookmarksEnabled())
807 return false; 807 return false;
808 808
809 std::unique_ptr<RemoveTrees::Params> params( 809 std::unique_ptr<RemoveTrees::Params> params(
810 RemoveTrees::Params::Create(*args_)); 810 RemoveTrees::Params::Create(*args_));
811 EXTENSION_FUNCTION_VALIDATE(params); 811 EXTENSION_FUNCTION_VALIDATE(params);
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
860 860
861 RedoInfo::Results::Result result; 861 RedoInfo::Results::Result result;
862 result.enabled = undo_manager->redo_count() > 0; 862 result.enabled = undo_manager->redo_count() > 0;
863 result.label = base::UTF16ToUTF8(undo_manager->GetRedoLabel()); 863 result.label = base::UTF16ToUTF8(undo_manager->GetRedoLabel());
864 864
865 results_ = RedoInfo::Results::Create(result); 865 results_ = RedoInfo::Results::Create(result);
866 return true; 866 return true;
867 } 867 }
868 868
869 } // namespace extensions 869 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698