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 // Library functions related to the OEM Deal Confirmation Code. | 5 // Library functions related to the OEM Deal Confirmation Code. |
6 | 6 |
7 #include "rlz/win/lib/machine_deal.h" | 7 #include "rlz/win/lib/machine_deal.h" |
8 | 8 |
9 #include <windows.h> | 9 #include <windows.h> |
10 #include <vector> | 10 #include <vector> |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 std::string* value) { | 100 std::string* value) { |
101 if (!value) | 101 if (!value) |
102 return false; | 102 return false; |
103 | 103 |
104 value->clear(); | 104 value->clear(); |
105 | 105 |
106 if (!base::StartsWith(response_line, response_key, | 106 if (!base::StartsWith(response_line, response_key, |
107 base::CompareCase::SENSITIVE)) | 107 base::CompareCase::SENSITIVE)) |
108 return false; | 108 return false; |
109 | 109 |
110 std::vector<std::string> tokens; | 110 std::vector<std::string> tokens = base::SplitString( |
111 base::SplitString(response_line, ':', &tokens); | 111 response_line, ":", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); |
112 if (tokens.size() != 2) | 112 if (tokens.size() != 2) |
113 return false; | 113 return false; |
114 | 114 |
115 // The first token is the key, the second is the value. The value is already | 115 // The first token is the key, the second is the value. The value is already |
116 // trimmed for whitespace. | 116 // trimmed for whitespace. |
117 *value = tokens[1]; | 117 *value = tokens[1]; |
118 return true; | 118 return true; |
119 } | 119 } |
120 | 120 |
121 } // namespace | 121 } // namespace |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
292 DWORD dcc_size = arraysize(dcc); | 292 DWORD dcc_size = arraysize(dcc); |
293 if (dcc_key.ReadValue(kDccValueName, dcc, &dcc_size, NULL) == ERROR_SUCCESS) { | 293 if (dcc_key.ReadValue(kDccValueName, dcc, &dcc_size, NULL) == ERROR_SUCCESS) { |
294 ASSERT_STRING("MachineDealCode::Clear: Could not delete the DCC value."); | 294 ASSERT_STRING("MachineDealCode::Clear: Could not delete the DCC value."); |
295 return false; | 295 return false; |
296 } | 296 } |
297 | 297 |
298 return true; | 298 return true; |
299 } | 299 } |
300 | 300 |
301 } // namespace rlz_lib | 301 } // namespace rlz_lib |
OLD | NEW |