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

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

Issue 2466523002: Remove some linked_ptr c/b/extension (Closed)
Patch Set: review Created 4 years, 1 month 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/install_verifier.h" 5 #include "chrome/browser/extensions/install_verifier.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <string> 8 #include <string>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after
293 293
294 if (signature_.get()) { 294 if (signature_.get()) {
295 ExtensionIdSet not_allowed_yet = 295 ExtensionIdSet not_allowed_yet =
296 base::STLSetDifference<ExtensionIdSet>(ids, signature_->ids); 296 base::STLSetDifference<ExtensionIdSet>(ids, signature_->ids);
297 if (not_allowed_yet.empty()) { 297 if (not_allowed_yet.empty()) {
298 OnVerificationComplete(true, type); // considered successful. 298 OnVerificationComplete(true, type); // considered successful.
299 return; 299 return;
300 } 300 }
301 } 301 }
302 302
303 InstallVerifier::PendingOperation* operation = 303 std::unique_ptr<InstallVerifier::PendingOperation> operation(
304 new InstallVerifier::PendingOperation(type); 304 new InstallVerifier::PendingOperation(type));
305 operation->ids.insert(ids.begin(), ids.end()); 305 operation->ids.insert(ids.begin(), ids.end());
306 306
307 operation_queue_.push(linked_ptr<PendingOperation>(operation)); 307 operation_queue_.push(std::move(operation));
308 308
309 // If there are no ongoing pending requests, we need to kick one off. 309 // If there are no ongoing pending requests, we need to kick one off.
310 if (operation_queue_.size() == 1) 310 if (operation_queue_.size() == 1)
311 BeginFetch(); 311 BeginFetch();
312 } 312 }
313 313
314 void InstallVerifier::AddProvisional(const ExtensionIdSet& ids) { 314 void InstallVerifier::AddProvisional(const ExtensionIdSet& ids) {
315 provisional_.insert(ids.begin(), ids.end()); 315 provisional_.insert(ids.begin(), ids.end());
316 AddMany(ids, ADD_PROVISIONAL); 316 AddMany(ids, ADD_PROVISIONAL);
317 } 317 }
(...skipping 12 matching lines...) Expand all
330 for (ExtensionIdSet::const_iterator i = ids.begin(); i != ids.end(); ++i) { 330 for (ExtensionIdSet::const_iterator i = ids.begin(); i != ids.end(); ++i) {
331 if (base::ContainsKey(signature_->ids, *i) || 331 if (base::ContainsKey(signature_->ids, *i) ||
332 base::ContainsKey(signature_->invalid_ids, *i)) { 332 base::ContainsKey(signature_->invalid_ids, *i)) {
333 found_any = true; 333 found_any = true;
334 break; 334 break;
335 } 335 }
336 } 336 }
337 if (!found_any) 337 if (!found_any)
338 return; 338 return;
339 339
340 InstallVerifier::PendingOperation* operation = 340 std::unique_ptr<InstallVerifier::PendingOperation> operation(
341 new InstallVerifier::PendingOperation(InstallVerifier::REMOVE); 341 new InstallVerifier::PendingOperation(InstallVerifier::REMOVE));
342 operation->ids = ids; 342 operation->ids = ids;
343 343
344 operation_queue_.push(linked_ptr<PendingOperation>(operation)); 344 operation_queue_.push(std::move(operation));
345 if (operation_queue_.size() == 1) 345 if (operation_queue_.size() == 1)
346 BeginFetch(); 346 BeginFetch();
347 } 347 }
348 348
349 bool InstallVerifier::AllowedByEnterprisePolicy(const std::string& id) const { 349 bool InstallVerifier::AllowedByEnterprisePolicy(const std::string& id) const {
350 return ExtensionManagementFactory::GetForBrowserContext(context_) 350 return ExtensionManagementFactory::GetForBrowserContext(context_)
351 ->IsInstallationExplicitlyAllowed(id); 351 ->IsInstallationExplicitlyAllowed(id);
352 } 352 }
353 353
354 std::string InstallVerifier::GetDebugPolicyProviderName() const { 354 std::string InstallVerifier::GetDebugPolicyProviderName() const {
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after
621 621
622 void GetSignatureResultHistogram(CallbackResult result) { 622 void GetSignatureResultHistogram(CallbackResult result) {
623 UMA_HISTOGRAM_ENUMERATION("ExtensionInstallVerifier.GetSignatureResult", 623 UMA_HISTOGRAM_ENUMERATION("ExtensionInstallVerifier.GetSignatureResult",
624 result, CALLBACK_RESULT_MAX); 624 result, CALLBACK_RESULT_MAX);
625 } 625 }
626 626
627 } // namespace 627 } // namespace
628 628
629 void InstallVerifier::SignatureCallback( 629 void InstallVerifier::SignatureCallback(
630 std::unique_ptr<InstallSignature> signature) { 630 std::unique_ptr<InstallSignature> signature) {
631 linked_ptr<PendingOperation> operation = operation_queue_.front(); 631 std::unique_ptr<PendingOperation> operation =
632 std::move(operation_queue_.front());
632 operation_queue_.pop(); 633 operation_queue_.pop();
633 634
634 bool success = false; 635 bool success = false;
635 if (!signature.get()) { 636 if (!signature.get()) {
636 GetSignatureResultHistogram(CALLBACK_NO_SIGNATURE); 637 GetSignatureResultHistogram(CALLBACK_NO_SIGNATURE);
637 } else if (!InstallSigner::VerifySignature(*signature)) { 638 } else if (!InstallSigner::VerifySignature(*signature)) {
638 GetSignatureResultHistogram(CALLBACK_INVALID_SIGNATURE); 639 GetSignatureResultHistogram(CALLBACK_INVALID_SIGNATURE);
639 } else { 640 } else {
640 GetSignatureResultHistogram(CALLBACK_VALID_SIGNATURE); 641 GetSignatureResultHistogram(CALLBACK_VALID_SIGNATURE);
641 success = true; 642 success = true;
(...skipping 29 matching lines...) Expand all
671 ScopedInstallVerifierBypassForTest::~ScopedInstallVerifierBypassForTest() { 672 ScopedInstallVerifierBypassForTest::~ScopedInstallVerifierBypassForTest() {
672 g_bypass_for_test = old_value_; 673 g_bypass_for_test = old_value_;
673 } 674 }
674 675
675 // static 676 // static
676 bool ScopedInstallVerifierBypassForTest::ShouldBypass() { 677 bool ScopedInstallVerifierBypassForTest::ShouldBypass() {
677 return g_bypass_for_test; 678 return g_bypass_for_test;
678 } 679 }
679 680
680 } // namespace extensions 681 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/install_verifier.h ('k') | chrome/browser/extensions/location_bar_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698