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

Side by Side Diff: chrome/installer/util/google_update_settings.cc

Issue 11826028: Add a method to read the Omaha experiment_labels value. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 7 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 (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 650 matching lines...) Expand 10 before | Expand all | Expand 10 after
661 success = client_state.DeleteValue(google_update::kExperimentLabels) 661 success = client_state.DeleteValue(google_update::kExperimentLabels)
662 == ERROR_SUCCESS; 662 == ERROR_SUCCESS;
663 } else { 663 } else {
664 success = client_state.WriteValue(google_update::kExperimentLabels, 664 success = client_state.WriteValue(google_update::kExperimentLabels,
665 experiment_labels.c_str()) == ERROR_SUCCESS; 665 experiment_labels.c_str()) == ERROR_SUCCESS;
666 } 666 }
667 } 667 }
668 668
669 return success; 669 return success;
670 } 670 }
671
672 bool GoogleUpdateSettings::ReadExperimentLabels(
673 bool system_install,
674 string16* experiment_labels) {
675 HKEY reg_root = system_install ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER;
676
677 // If this distribution does not set the experiment labels, don't bother
678 // reading.
679 bool success = false;
680 BrowserDistribution* dist = BrowserDistribution::GetDistribution();
681 if (dist->ShouldSetExperimentLabels()) {
682 string16 client_state_path(
683 system_install ? dist->GetStateMediumKey() : dist->GetStateKey());
684 RegKey client_state(reg_root, client_state_path.c_str(), KEY_READ);
grt (UTC plus 2) 2013/01/09 18:49:51 KEY_READ -> KEY_QUERY_VALUE
SteveT 2013/01/09 19:36:10 Done. Care to explain the difference, though?
grt (UTC plus 2) 2013/01/10 02:58:51 I think it's good practice to request least privil
SteveT 2013/01/10 15:05:51 What's the difference between the two? Feel free
grt (UTC plus 2) 2013/01/10 15:10:19 http://msdn.microsoft.com/library/windows/desktop/
685 success = client_state.ReadValue(google_update::kExperimentLabels,
686 experiment_labels) == ERROR_SUCCESS;
687 }
688
689 return success;
690 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698