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

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

Issue 1549233002: Convert Pass()→std::move() in //chrome/browser/extensions (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 11 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 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 10
10 #include "base/base_switches.h" 11 #include "base/base_switches.h"
11 #include "base/bind.h" 12 #include "base/bind.h"
12 #include "base/command_line.h" 13 #include "base/command_line.h"
13 #include "base/metrics/field_trial.h" 14 #include "base/metrics/field_trial.h"
14 #include "base/metrics/histogram.h" 15 #include "base/metrics/histogram.h"
15 #include "base/prefs/pref_service.h" 16 #include "base/prefs/pref_service.h"
16 #include "base/stl_util.h" 17 #include "base/stl_util.h"
17 #include "base/trace_event/trace_event.h" 18 #include "base/trace_event/trace_event.h"
18 #include "build/build_config.h" 19 #include "build/build_config.h"
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
228 const base::DictionaryValue* pref = prefs_->GetInstallSignature(); 229 const base::DictionaryValue* pref = prefs_->GetInstallSignature();
229 if (pref) { 230 if (pref) {
230 scoped_ptr<InstallSignature> signature_from_prefs = 231 scoped_ptr<InstallSignature> signature_from_prefs =
231 InstallSignature::FromValue(*pref); 232 InstallSignature::FromValue(*pref);
232 if (!signature_from_prefs.get()) { 233 if (!signature_from_prefs.get()) {
233 LogInitResultHistogram(INIT_UNPARSEABLE_PREF); 234 LogInitResultHistogram(INIT_UNPARSEABLE_PREF);
234 } else if (!InstallSigner::VerifySignature(*signature_from_prefs.get())) { 235 } else if (!InstallSigner::VerifySignature(*signature_from_prefs.get())) {
235 LogInitResultHistogram(INIT_INVALID_SIGNATURE); 236 LogInitResultHistogram(INIT_INVALID_SIGNATURE);
236 DVLOG(1) << "Init - ignoring invalid signature"; 237 DVLOG(1) << "Init - ignoring invalid signature";
237 } else { 238 } else {
238 signature_ = signature_from_prefs.Pass(); 239 signature_ = std::move(signature_from_prefs);
239 LogInitResultHistogram(INIT_VALID_SIGNATURE); 240 LogInitResultHistogram(INIT_VALID_SIGNATURE);
240 UMA_HISTOGRAM_COUNTS_100("ExtensionInstallVerifier.InitSignatureCount", 241 UMA_HISTOGRAM_COUNTS_100("ExtensionInstallVerifier.InitSignatureCount",
241 signature_->ids.size()); 242 signature_->ids.size());
242 GarbageCollect(); 243 GarbageCollect();
243 } 244 }
244 } else { 245 } else {
245 LogInitResultHistogram(INIT_NO_PREF); 246 LogInitResultHistogram(INIT_NO_PREF);
246 } 247 }
247 248
248 ExtensionSystem::Get(context_)->ready().Post( 249 ExtensionSystem::Get(context_)->ready().Post(
(...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after
629 GetSignatureResultHistogram(CALLBACK_VALID_SIGNATURE); 630 GetSignatureResultHistogram(CALLBACK_VALID_SIGNATURE);
630 success = true; 631 success = true;
631 } 632 }
632 633
633 if (!success) { 634 if (!success) {
634 OnVerificationComplete(false, operation->type); 635 OnVerificationComplete(false, operation->type);
635 636
636 // TODO(asargent) - if this was something like a network error, we need to 637 // TODO(asargent) - if this was something like a network error, we need to
637 // do retries with exponential back off. 638 // do retries with exponential back off.
638 } else { 639 } else {
639 signature_ = signature.Pass(); 640 signature_ = std::move(signature);
640 SaveToPrefs(); 641 SaveToPrefs();
641 642
642 if (!provisional_.empty()) { 643 if (!provisional_.empty()) {
643 // Update |provisional_| to remove ids that were successfully signed. 644 // Update |provisional_| to remove ids that were successfully signed.
644 provisional_ = base::STLSetDifference<ExtensionIdSet>( 645 provisional_ = base::STLSetDifference<ExtensionIdSet>(
645 provisional_, signature_->ids); 646 provisional_, signature_->ids);
646 } 647 }
647 648
648 OnVerificationComplete(success, operation->type); 649 OnVerificationComplete(success, operation->type);
649 } 650 }
650 651
651 if (!operation_queue_.empty()) 652 if (!operation_queue_.empty())
652 BeginFetch(); 653 BeginFetch();
653 } 654 }
654 655
655 } // namespace extensions 656 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/install_signer.cc ('k') | chrome/browser/extensions/isolated_app_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698