Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/metrics/variations/chrome_variations_service_client.h" | 5 #include "chrome/browser/metrics/variations/chrome_variations_service_client.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/threading/sequenced_worker_pool.h" | 8 #include "base/threading/sequenced_worker_pool.h" |
| 9 #include "build/build_config.h" | 9 #include "build/build_config.h" |
| 10 #include "chrome/browser/browser_process.h" | 10 #include "chrome/browser/browser_process.h" |
| 11 #include "chrome/common/channel_info.h" | 11 #include "chrome/common/channel_info.h" |
| 12 #include "components/version_info/version_info.h" | 12 #include "components/version_info/version_info.h" |
| 13 #include "content/public/browser/browser_thread.h" | 13 #include "content/public/browser/browser_thread.h" |
| 14 | 14 |
| 15 #if defined(OS_WIN) | 15 #if defined(OS_WIN) |
| 16 #include "base/metrics/histogram_macros.h" | 16 #include "base/metrics/histogram_macros.h" |
| 17 #include "base/strings/string16.h" | 17 #include "base/strings/string16.h" |
| 18 #include "base/threading/thread_restrictions.h" | 18 #include "base/threading/thread_restrictions.h" |
| 19 #include "chrome/installer/util/google_update_settings.h" | 19 #include "chrome/installer/util/google_update_settings.h" |
|
grt (UTC plus 2)
2017/05/31 12:24:09
#include "chrome/install_static/install_modes.h"
nikunjb
2017/06/02 05:11:22
Done. (Moving to separate CL)
| |
| 20 #include "chrome/installer/util/install_util.h" | 20 #include "chrome/installer/util/install_util.h" |
| 21 #include "components/variations/experiment_labels.h" | 21 #include "components/variations/experiment_labels.h" |
| 22 #endif | 22 #endif |
| 23 | 23 |
| 24 #if !defined(OS_ANDROID) && !defined(OS_CHROMEOS) | 24 #if !defined(OS_ANDROID) && !defined(OS_CHROMEOS) |
| 25 #include "chrome/browser/upgrade_detector_impl.h" | 25 #include "chrome/browser/upgrade_detector_impl.h" |
| 26 #endif | 26 #endif |
| 27 | 27 |
| 28 #if defined(OS_CHROMEOS) | 28 #if defined(OS_CHROMEOS) |
| 29 #include "chrome/browser/chromeos/settings/cros_settings.h" | 29 #include "chrome/browser/chromeos/settings/cros_settings.h" |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 46 return base::Version(version_info::GetVersionNumber()); | 46 return base::Version(version_info::GetVersionNumber()); |
| 47 } | 47 } |
| 48 | 48 |
| 49 #if defined(OS_WIN) | 49 #if defined(OS_WIN) |
| 50 // Clear all Variations experiment labels from Google Update Registry Labels. | 50 // Clear all Variations experiment labels from Google Update Registry Labels. |
| 51 // TODO(jwd): Remove this once we're confident most clients no longer have these | 51 // TODO(jwd): Remove this once we're confident most clients no longer have these |
| 52 // labels (M57-M58 timeframe). | 52 // labels (M57-M58 timeframe). |
| 53 void ClearGoogleUpdateRegistryLabels() { | 53 void ClearGoogleUpdateRegistryLabels() { |
| 54 base::ThreadRestrictions::AssertIOAllowed(); | 54 base::ThreadRestrictions::AssertIOAllowed(); |
| 55 | 55 |
| 56 // There is nothing to do if this brand does not support integration with | |
| 57 // Google Update. | |
| 58 if (!install_static::kUseGoogleUpdateIntegration) | |
| 59 return; | |
| 60 | |
| 56 // Note that all registry operations are done here on the UI thread as there | 61 // Note that all registry operations are done here on the UI thread as there |
| 57 // are no threading restrictions on them. | 62 // are no threading restrictions on them. |
| 58 const bool is_system_install = !InstallUtil::IsPerUserInstall(); | 63 const bool is_system_install = !InstallUtil::IsPerUserInstall(); |
| 59 | 64 |
| 60 // Read the current bits from the registry. | 65 // Read the current bits from the registry. |
| 61 base::string16 registry_labels; | 66 base::string16 registry_labels; |
| 62 bool success = GoogleUpdateSettings::ReadExperimentLabels(is_system_install, | 67 bool success = GoogleUpdateSettings::ReadExperimentLabels(is_system_install, |
| 63 ®istry_labels); | 68 ®istry_labels); |
| 64 | 69 |
| 65 if (!success) { | 70 if (!success) { |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 134 #if defined(OS_WIN) | 139 #if defined(OS_WIN) |
| 135 // TODO(jwd): Remove this once we're confident most clients no longer have | 140 // TODO(jwd): Remove this once we're confident most clients no longer have |
| 136 // these labels (M57-M58 timeframe). | 141 // these labels (M57-M58 timeframe). |
| 137 // Do the work on a blocking pool thread, as chrome://profiler has shown that | 142 // Do the work on a blocking pool thread, as chrome://profiler has shown that |
| 138 // it can cause jank if done on the UI thrread. | 143 // it can cause jank if done on the UI thrread. |
| 139 content::BrowserThread::GetBlockingPool()->PostDelayedTask( | 144 content::BrowserThread::GetBlockingPool()->PostDelayedTask( |
| 140 FROM_HERE, base::Bind(&ClearGoogleUpdateRegistryLabels), | 145 FROM_HERE, base::Bind(&ClearGoogleUpdateRegistryLabels), |
| 141 base::TimeDelta::FromSeconds(5)); | 146 base::TimeDelta::FromSeconds(5)); |
| 142 #endif | 147 #endif |
| 143 } | 148 } |
| OLD | NEW |