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

Unified Diff: chrome/browser/metrics/variations/chrome_variations_service_client.cc

Issue 1310253004: Have VariationsService get version for simulation callback from client (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@variations_service_browser_thread
Patch Set: Rebase Created 5 years, 4 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: chrome/browser/metrics/variations/chrome_variations_service_client.cc
diff --git a/chrome/browser/metrics/variations/chrome_variations_service_client.cc b/chrome/browser/metrics/variations/chrome_variations_service_client.cc
index 24577c839ba41411fb4e82563aa84a7586e1257e..93f383f5fbf81a1dffacdc4f8d6d38420f0ea49e 100644
--- a/chrome/browser/metrics/variations/chrome_variations_service_client.cc
+++ b/chrome/browser/metrics/variations/chrome_variations_service_client.cc
@@ -4,9 +4,34 @@
#include "chrome/browser/metrics/variations/chrome_variations_service_client.h"
+#include "base/bind.h"
#include "chrome/browser/browser_process.h"
+#include "components/version_info/version_info.h"
#include "content/public/browser/browser_thread.h"
+#if !defined(OS_ANDROID) && !defined(OS_IOS) && !defined(OS_CHROMEOS)
+#include "chrome/browser/upgrade_detector_impl.h"
+#endif
+
+namespace {
+
+// Gets the version number to use for variations seed simulation. Must be called
+// on a thread where IO is allowed.
+base::Version GetVersionForSimulation() {
+#if !defined(OS_ANDROID) && !defined(OS_IOS) && !defined(OS_CHROMEOS)
+ const base::Version installed_version =
+ UpgradeDetectorImpl::GetCurrentlyInstalledVersion();
+ if (installed_version.IsValid())
+ return installed_version;
+#endif // !defined(OS_ANDROID) && !defined(OS_IOS) && !defined(OS_CHROMEOS)
+
+ // TODO(asvitkine): Get the version that will be used on restart instead of
+ // the current version on Android, iOS and ChromeOS.
+ return base::Version(version_info::GetVersionNumber());
+}
+
+} // namespace
+
ChromeVariationsServiceClient::ChromeVariationsServiceClient() {}
ChromeVariationsServiceClient::~ChromeVariationsServiceClient() {}
@@ -19,6 +44,11 @@ base::SequencedWorkerPool* ChromeVariationsServiceClient::GetBlockingPool() {
return content::BrowserThread::GetBlockingPool();
}
+base::Callback<base::Version(void)>
+ChromeVariationsServiceClient::GetVersionForSimulationCallback() {
+ return base::Bind(&GetVersionForSimulation);
+}
+
net::URLRequestContextGetter*
ChromeVariationsServiceClient::GetURLRequestContext() {
return g_browser_process->system_request_context();

Powered by Google App Engine
This is Rietveld 408576698