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

Unified Diff: trunk/src/chrome/browser/extensions/install_signer.cc

Issue 147983011: Revert 247790 "Change default mode of extension install verifica..." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 6 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 side-by-side diff with in-line comments
Download patch
Index: trunk/src/chrome/browser/extensions/install_signer.cc
===================================================================
--- trunk/src/chrome/browser/extensions/install_signer.cc (revision 247796)
+++ trunk/src/chrome/browser/extensions/install_signer.cc (working copy)
@@ -9,16 +9,13 @@
#include "base/command_line.h"
#include "base/json/json_reader.h"
#include "base/json/json_writer.h"
-#include "base/lazy_instance.h"
#include "base/message_loop/message_loop.h"
#include "base/metrics/histogram.h"
-#include "base/process/process_info.h"
#include "base/stl_util.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_split.h"
#include "base/strings/string_util.h"
#include "base/strings/stringprintf.h"
-#include "base/time/time.h"
#include "base/values.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/extensions/extension_constants.h"
@@ -246,41 +243,6 @@
return ExtensionIdSet(ids.begin(), ids.end());
}
-namespace {
-
-static int g_request_count = 0;
-
-base::LazyInstance<base::TimeTicks> g_last_request_time =
- LAZY_INSTANCE_INITIALIZER;
-
-base::LazyInstance<base::ThreadChecker> g_single_thread_checker =
- LAZY_INSTANCE_INITIALIZER;
-
-void LogRequestStartHistograms() {
- // Make sure we only ever call this from one thread, so that we don't have to
- // worry about race conditions setting g_last_request_time.
- DCHECK(g_single_thread_checker.Get().CalledOnValidThread());
-
- const base::Time process_creation_time =
- base::CurrentProcessInfo::CreationTime();
- UMA_HISTOGRAM_COUNTS("ExtensionInstallSigner.UptimeAtTimeOfRequest",
- (base::Time::Now() - process_creation_time).InSeconds());
-
- base::TimeDelta delta;
- base::TimeTicks now = base::TimeTicks::Now();
- if (!g_last_request_time.Get().is_null())
- delta = now - g_last_request_time.Get();
- g_last_request_time.Get() = now;
- UMA_HISTOGRAM_COUNTS("ExtensionInstallSigner.SecondsSinceLastRequest",
- delta.InSeconds());
-
- g_request_count += 1;
- UMA_HISTOGRAM_COUNTS_100("ExtensionInstallSigner.RequestCount",
- g_request_count);
-}
-
-} // namespace
-
void InstallSigner::GetSignature(const SignatureCallback& callback) {
CHECK(!url_fetcher_.get());
CHECK(callback_.is_null());
@@ -339,7 +301,6 @@
return;
}
url_fetcher_->SetUploadData("application/json", json);
- LogRequestStartHistograms();
url_fetcher_->Start();
}
@@ -350,17 +311,10 @@
}
void InstallSigner::ParseFetchResponse() {
- bool fetch_success = url_fetcher_->GetStatus().is_success();
- UMA_HISTOGRAM_BOOLEAN("ExtensionInstallSigner.FetchSuccess", fetch_success);
-
std::string response;
- if (fetch_success) {
- if (!url_fetcher_->GetResponseAsString(&response))
- response.clear();
- }
- UMA_HISTOGRAM_BOOLEAN("ExtensionInstallSigner.GetResponseSuccess",
- !response.empty());
- if (!fetch_success || response.empty()) {
+ if (!url_fetcher_->GetStatus().is_success() ||
+ !url_fetcher_->GetResponseAsString(&response) ||
+ response.empty()) {
ReportErrorViaCallback();
return;
}
@@ -377,10 +331,7 @@
base::DictionaryValue* dictionary = NULL;
scoped_ptr<base::Value> parsed(base::JSONReader::Read(response));
- bool json_success = parsed.get() && parsed->GetAsDictionary(&dictionary);
- UMA_HISTOGRAM_BOOLEAN("ExtensionInstallSigner.ParseJsonSuccess",
- json_success);
- if (!json_success) {
+ if (!parsed.get() || !parsed->GetAsDictionary(&dictionary)) {
ReportErrorViaCallback();
return;
}
@@ -394,13 +345,9 @@
dictionary->GetString(kSignatureKey, &signature_base64);
dictionary->GetString(kExpiryKey, &expire_date);
- bool fields_success =
- protocol_version == 1 && !signature_base64.empty() &&
- ValidateExpireDateFormat(expire_date) &&
- base::Base64Decode(signature_base64, &signature);
- UMA_HISTOGRAM_BOOLEAN("ExtensionInstallSigner.ParseFieldsSuccess",
- fields_success);
- if (!fields_success) {
+ if (protocol_version != 1 || signature_base64.empty() ||
+ !ValidateExpireDateFormat(expire_date) ||
+ !base::Base64Decode(signature_base64, &signature)) {
ReportErrorViaCallback();
return;
}
« no previous file with comments | « trunk/src/chrome/browser/extensions/extension_service.cc ('k') | trunk/src/chrome/browser/extensions/install_verifier.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698