OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/chromeos/settings/owner_flags_storage.h" | 5 #include "chrome/browser/chromeos/settings/owner_flags_storage.h" |
6 | 6 |
| 7 #include "base/command_line.h" |
7 #include "base/prefs/pref_service.h" | 8 #include "base/prefs/pref_service.h" |
8 #include "base/values.h" | 9 #include "base/values.h" |
| 10 #include "chrome/browser/about_flags.h" |
9 #include "chrome/browser/browser_process.h" | 11 #include "chrome/browser/browser_process.h" |
10 #include "chrome/browser/chromeos/settings/cros_settings.h" | 12 #include "chrome/browser/chromeos/settings/cros_settings.h" |
11 #include "chrome/browser/chromeos/settings/cros_settings_names.h" | 13 #include "chrome/browser/chromeos/settings/cros_settings_names.h" |
12 #include "chrome/common/pref_names.h" | 14 #include "chrome/common/pref_names.h" |
13 | 15 |
14 namespace chromeos { | 16 namespace chromeos { |
15 namespace about_flags { | 17 namespace about_flags { |
16 | 18 |
17 OwnerFlagsStorage::OwnerFlagsStorage(PrefService *prefs, | 19 OwnerFlagsStorage::OwnerFlagsStorage(PrefService *prefs, |
18 CrosSettings *cros_settings) | 20 CrosSettings *cros_settings) |
(...skipping 24 matching lines...) Expand all Loading... |
43 } | 45 } |
44 } | 46 } |
45 | 47 |
46 OwnerFlagsStorage::~OwnerFlagsStorage() {} | 48 OwnerFlagsStorage::~OwnerFlagsStorage() {} |
47 | 49 |
48 bool OwnerFlagsStorage::SetFlags(std::set<std::string> flags) { | 50 bool OwnerFlagsStorage::SetFlags(std::set<std::string> flags) { |
49 PrefServiceFlagsStorage::SetFlags(flags); | 51 PrefServiceFlagsStorage::SetFlags(flags); |
50 | 52 |
51 base::ListValue experiments_list; | 53 base::ListValue experiments_list; |
52 | 54 |
53 for (std::set<std::string>::const_iterator it = flags.begin(); | 55 CommandLine command_line(CommandLine::NO_PROGRAM); |
54 it != flags.end(); ++it) { | 56 ::about_flags::ConvertFlagsToSwitches(this, &command_line, |
| 57 ::about_flags::kNoSentinels); |
| 58 CommandLine::StringVector switches = command_line.argv(); |
| 59 for (CommandLine::StringVector::const_iterator it = switches.begin() + 1; |
| 60 it != switches.end(); ++it) { |
55 experiments_list.Append(new base::StringValue(*it)); | 61 experiments_list.Append(new base::StringValue(*it)); |
56 } | 62 } |
57 cros_settings_->Set(kStartUpFlags, experiments_list); | 63 cros_settings_->Set(kStartUpFlags, experiments_list); |
58 | 64 |
59 return true; | 65 return true; |
60 } | 66 } |
61 | 67 |
62 } // namespace about_flags | 68 } // namespace about_flags |
63 } // namespace chromeos | 69 } // namespace chromeos |
OLD | NEW |