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

Side by Side Diff: chrome/browser/extensions/extension_reenabler.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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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_reenabler.h" 5 #include "chrome/browser/extensions/extension_reenabler.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/memory/ptr_util.h" 8 #include "base/memory/ptr_util.h"
9 #include "chrome/browser/extensions/extension_service.h" 9 #include "chrome/browser/extensions/extension_service.h"
10 #include "chrome/browser/extensions/webstore_data_fetcher.h" 10 #include "chrome/browser/extensions/webstore_data_fetcher.h"
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 extension->id())); 90 extension->id()));
91 webstore_data_fetcher_->Start(); 91 webstore_data_fetcher_->Start();
92 } else { 92 } else {
93 ExtensionInstallPrompt::PromptType type = 93 ExtensionInstallPrompt::PromptType type =
94 ExtensionInstallPrompt::GetReEnablePromptTypeForExtension( 94 ExtensionInstallPrompt::GetReEnablePromptTypeForExtension(
95 browser_context, extension.get()); 95 browser_context, extension.get());
96 install_prompt_->ShowDialog( 96 install_prompt_->ShowDialog(
97 base::Bind(&ExtensionReenabler::OnInstallPromptDone, 97 base::Bind(&ExtensionReenabler::OnInstallPromptDone,
98 weak_factory_.GetWeakPtr()), 98 weak_factory_.GetWeakPtr()),
99 extension.get(), nullptr, 99 extension.get(), nullptr,
100 base::WrapUnique(new ExtensionInstallPrompt::Prompt(type)), 100 base::MakeUnique<ExtensionInstallPrompt::Prompt>(type),
101 show_dialog_callback_); 101 show_dialog_callback_);
102 } 102 }
103 } 103 }
104 104
105 void ExtensionReenabler::OnInstallPromptDone( 105 void ExtensionReenabler::OnInstallPromptDone(
106 ExtensionInstallPrompt::Result install_result) { 106 ExtensionInstallPrompt::Result install_result) {
107 ReenableResult result = ABORTED; 107 ReenableResult result = ABORTED;
108 switch (install_result) { 108 switch (install_result) {
109 case ExtensionInstallPrompt::Result::ACCEPTED: { 109 case ExtensionInstallPrompt::Result::ACCEPTED: {
110 // Stop observing - we don't want to see our own enablement. 110 // Stop observing - we don't want to see our own enablement.
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 &error)) { 166 &error)) {
167 Finish(NOT_ALLOWED); 167 Finish(NOT_ALLOWED);
168 } else { 168 } else {
169 ExtensionInstallPrompt::PromptType type = 169 ExtensionInstallPrompt::PromptType type =
170 ExtensionInstallPrompt::GetReEnablePromptTypeForExtension( 170 ExtensionInstallPrompt::GetReEnablePromptTypeForExtension(
171 browser_context_, extension_.get()); 171 browser_context_, extension_.get());
172 install_prompt_->ShowDialog( 172 install_prompt_->ShowDialog(
173 base::Bind(&ExtensionReenabler::OnInstallPromptDone, 173 base::Bind(&ExtensionReenabler::OnInstallPromptDone,
174 weak_factory_.GetWeakPtr()), 174 weak_factory_.GetWeakPtr()),
175 extension_.get(), nullptr, 175 extension_.get(), nullptr,
176 base::WrapUnique(new ExtensionInstallPrompt::Prompt(type)), 176 base::MakeUnique<ExtensionInstallPrompt::Prompt>(type),
177 show_dialog_callback_); 177 show_dialog_callback_);
178 } 178 }
179 } 179 }
180 180
181 void ExtensionReenabler::OnWebstoreResponseParseFailure( 181 void ExtensionReenabler::OnWebstoreResponseParseFailure(
182 const std::string& error) { 182 const std::string& error) {
183 Finish(ABORTED); 183 Finish(ABORTED);
184 } 184 }
185 185
186 void ExtensionReenabler::Finish(ReenableResult result) { 186 void ExtensionReenabler::Finish(ReenableResult result) {
187 DCHECK(!finished_); 187 DCHECK(!finished_);
188 finished_ = true; 188 finished_ = true;
189 registry_observer_.RemoveAll(); 189 registry_observer_.RemoveAll();
190 callback_.Run(result); 190 callback_.Run(result);
191 } 191 }
192 192
193 } // namespace extensions 193 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698