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

Side by Side Diff: chrome/browser/extensions/extension_context_menu_model_unittest.cc

Issue 2257113002: Re-write many calls to WrapUnique() with MakeUnique() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 3 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/extension_context_menu_model.h" 5 #include "chrome/browser/extensions/extension_context_menu_model.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/memory/ptr_util.h" 10 #include "base/memory/ptr_util.h"
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 MenuBuilder(scoped_refptr<const Extension> extension, 60 MenuBuilder(scoped_refptr<const Extension> extension,
61 Browser* browser, 61 Browser* browser,
62 MenuManager* menu_manager) 62 MenuManager* menu_manager)
63 : extension_(extension), 63 : extension_(extension),
64 browser_(browser), 64 browser_(browser),
65 menu_manager_(menu_manager), 65 menu_manager_(menu_manager),
66 cur_id_(0) {} 66 cur_id_(0) {}
67 ~MenuBuilder() {} 67 ~MenuBuilder() {}
68 68
69 std::unique_ptr<ExtensionContextMenuModel> BuildMenu() { 69 std::unique_ptr<ExtensionContextMenuModel> BuildMenu() {
70 return base::WrapUnique(new ExtensionContextMenuModel( 70 return base::MakeUnique<ExtensionContextMenuModel>(
71 extension_.get(), browser_, ExtensionContextMenuModel::VISIBLE, 71 extension_.get(), browser_, ExtensionContextMenuModel::VISIBLE,
72 nullptr)); 72 nullptr);
73 } 73 }
74 74
75 void AddContextItem(MenuItem::Context context) { 75 void AddContextItem(MenuItem::Context context) {
76 MenuItem::Id id(false /* not incognito */, 76 MenuItem::Id id(false /* not incognito */,
77 MenuItem::ExtensionKey(extension_->id())); 77 MenuItem::ExtensionKey(extension_->id()));
78 id.uid = ++cur_id_; 78 id.uid = ++cur_id_;
79 menu_manager_->AddContextItem( 79 menu_manager_->AddContextItem(
80 extension_.get(), 80 extension_.get(),
81 new MenuItem(id, kTestExtensionItemLabel, 81 new MenuItem(id, kTestExtensionItemLabel,
82 false, // check`ed 82 false, // check`ed
(...skipping 607 matching lines...) Expand 10 before | Expand all | Expand 10 after
690 "no_action", nullptr, Manifest::INTERNAL); 690 "no_action", nullptr, Manifest::INTERNAL);
691 ExtensionContextMenuModel menu(no_action, GetBrowser(), 691 ExtensionContextMenuModel menu(no_action, GetBrowser(),
692 ExtensionContextMenuModel::VISIBLE, nullptr); 692 ExtensionContextMenuModel::VISIBLE, nullptr);
693 int inspect_popup_index = 693 int inspect_popup_index =
694 menu.GetIndexOfCommandId(ExtensionContextMenuModel::INSPECT_POPUP); 694 menu.GetIndexOfCommandId(ExtensionContextMenuModel::INSPECT_POPUP);
695 EXPECT_EQ(-1, inspect_popup_index); 695 EXPECT_EQ(-1, inspect_popup_index);
696 } 696 }
697 } 697 }
698 698
699 } // namespace extensions 699 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_action_unittest.cc ('k') | chrome/browser/extensions/extension_disabled_ui.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698