OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/installer/util/google_update_settings.h" | 5 #include "chrome/installer/util/google_update_settings.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
(...skipping 624 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
635 data); | 635 data); |
636 } | 636 } |
637 | 637 |
638 bool GoogleUpdateSettings::GetUpdateDetail(bool system_install, | 638 bool GoogleUpdateSettings::GetUpdateDetail(bool system_install, |
639 ProductData* data) { | 639 ProductData* data) { |
640 BrowserDistribution* dist = BrowserDistribution::GetDistribution(); | 640 BrowserDistribution* dist = BrowserDistribution::GetDistribution(); |
641 return GetUpdateDetailForApp(system_install, | 641 return GetUpdateDetailForApp(system_install, |
642 dist->GetAppGuid().c_str(), | 642 dist->GetAppGuid().c_str(), |
643 data); | 643 data); |
644 } | 644 } |
| 645 |
| 646 bool GoogleUpdateSettings::SetExperimentLabels( |
| 647 bool system_install, |
| 648 const string16& experiment_labels) { |
| 649 HKEY reg_root = system_install ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER; |
| 650 |
| 651 // Use the browser distribution and install level to write to the correct |
| 652 // client state/app guid key. |
| 653 bool success = false; |
| 654 BrowserDistribution* dist = BrowserDistribution::GetDistribution(); |
| 655 if (dist->ShouldSetExperimentLabels()) { |
| 656 string16 client_state_path( |
| 657 system_install ? dist->GetStateMediumKey() : dist->GetStateKey()); |
| 658 RegKey client_state( |
| 659 reg_root, client_state_path.c_str(), KEY_SET_VALUE); |
| 660 if (experiment_labels.empty()) { |
| 661 success = client_state.DeleteValue(google_update::kExperimentLabels) |
| 662 == ERROR_SUCCESS; |
| 663 } else { |
| 664 success = client_state.WriteValue(google_update::kExperimentLabels, |
| 665 experiment_labels.c_str()) == ERROR_SUCCESS; |
| 666 } |
| 667 } |
| 668 |
| 669 return success; |
| 670 } |
OLD | NEW |