| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "components/pairing/fake_host_pairing_controller.h" | 5 #include "components/pairing/fake_host_pairing_controller.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 start_after_update_(false) { | 29 start_after_update_(false) { |
| 30 ApplyConfig(config); | 30 ApplyConfig(config); |
| 31 AddObserver(this); | 31 AddObserver(this); |
| 32 } | 32 } |
| 33 | 33 |
| 34 FakeHostPairingController::~FakeHostPairingController() { | 34 FakeHostPairingController::~FakeHostPairingController() { |
| 35 RemoveObserver(this); | 35 RemoveObserver(this); |
| 36 } | 36 } |
| 37 | 37 |
| 38 void FakeHostPairingController::ApplyConfig(const std::string& config) { | 38 void FakeHostPairingController::ApplyConfig(const std::string& config) { |
| 39 typedef std::vector<std::string> Tokens; | |
| 40 | |
| 41 base::StringPairs kv_pairs; | 39 base::StringPairs kv_pairs; |
| 42 CHECK(base::SplitStringIntoKeyValuePairs(config, ':', ',', &kv_pairs)) | 40 CHECK(base::SplitStringIntoKeyValuePairs(config, ':', ',', &kv_pairs)) |
| 43 << "Wrong config format."; | 41 << "Wrong config format."; |
| 44 std::map<std::string, std::string> dict(kv_pairs.begin(), kv_pairs.end()); | 42 std::map<std::string, std::string> dict(kv_pairs.begin(), kv_pairs.end()); |
| 45 | 43 |
| 46 if (dict.count("async_duration")) { | 44 if (dict.count("async_duration")) { |
| 47 int ms = 0; | 45 int ms = 0; |
| 48 CHECK(base::StringToInt(dict["async_duration"], &ms)) | 46 CHECK(base::StringToInt(dict["async_duration"], &ms)) |
| 49 << "Wrong 'async_duration' format."; | 47 << "Wrong 'async_duration' format."; |
| 50 async_duration_ = base::TimeDelta::FromMilliseconds(ms); | 48 async_duration_ = base::TimeDelta::FromMilliseconds(ms); |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 const std::string& lang, | 174 const std::string& lang, |
| 177 const std::string& timezone, | 175 const std::string& timezone, |
| 178 bool send_reports, | 176 bool send_reports, |
| 179 const std::string& keyboard_layout) { | 177 const std::string& keyboard_layout) { |
| 180 } | 178 } |
| 181 | 179 |
| 182 void FakeHostPairingController::EnrollHost(const std::string& auth_token) { | 180 void FakeHostPairingController::EnrollHost(const std::string& auth_token) { |
| 183 } | 181 } |
| 184 | 182 |
| 185 } // namespace pairing_chromeos | 183 } // namespace pairing_chromeos |
| OLD | NEW |