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 "chrome/browser/local_discovery/privetv3_session.h" | 5 #include "chrome/browser/local_discovery/privetv3_session.h" |
6 | 6 |
7 #include "base/base64.h" | 7 #include "base/base64.h" |
8 #include "base/json/json_writer.h" | 8 #include "base/json/json_writer.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 static const Element kMap[]; | 80 static const Element kMap[]; |
81 }; | 81 }; |
82 | 82 |
83 using PairingType = PrivetV3Session::PairingType; | 83 using PairingType = PrivetV3Session::PairingType; |
84 | 84 |
85 template <> | 85 template <> |
86 const EnumToStringMap<PrivetV3Session::PairingType>::Element | 86 const EnumToStringMap<PrivetV3Session::PairingType>::Element |
87 EnumToStringMap<PrivetV3Session::PairingType>::kMap[] = { | 87 EnumToStringMap<PrivetV3Session::PairingType>::kMap[] = { |
88 {PairingType::PAIRING_TYPE_PINCODE, "pinCode"}, | 88 {PairingType::PAIRING_TYPE_PINCODE, "pinCode"}, |
89 {PairingType::PAIRING_TYPE_EMBEDDEDCODE, "embeddedCode"}, | 89 {PairingType::PAIRING_TYPE_EMBEDDEDCODE, "embeddedCode"}, |
| 90 {PairingType::PAIRING_TYPE_ULTRASOUND32, "ultrasound32"}, |
| 91 {PairingType::PAIRING_TYPE_AUDIBLE32, "audible32"}, |
90 }; | 92 }; |
91 | 93 |
92 template <typename T> | 94 template <typename T> |
93 std::string EnumToString(T id) { | 95 std::string EnumToString(T id) { |
94 return EnumToStringMap<T>::FindNameById(id); | 96 return EnumToStringMap<T>::FindNameById(id); |
95 } | 97 } |
96 | 98 |
97 template <typename T> | 99 template <typename T> |
98 bool StringToEnum(const std::string& name, T* id) { | 100 bool StringToEnum(const std::string& name, T* id) { |
99 return EnumToStringMap<T>::FindIdByName(name, id); | 101 return EnumToStringMap<T>::FindIdByName(name, id); |
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
389 fetchers_.push_back(new FetcherDelegate(weak_ptr_factory_.GetWeakPtr(), | 391 fetchers_.push_back(new FetcherDelegate(weak_ptr_factory_.GetWeakPtr(), |
390 privet_auth_token_, callback)); | 392 privet_auth_token_, callback)); |
391 return fetchers_.back()->CreateURLFetcher(CreatePrivetURL(api), request_type); | 393 return fetchers_.back()->CreateURLFetcher(CreatePrivetURL(api), request_type); |
392 } | 394 } |
393 | 395 |
394 void PrivetV3Session::DeleteFetcher(const FetcherDelegate* fetcher) { | 396 void PrivetV3Session::DeleteFetcher(const FetcherDelegate* fetcher) { |
395 fetchers_.erase(std::find(fetchers_.begin(), fetchers_.end(), fetcher)); | 397 fetchers_.erase(std::find(fetchers_.begin(), fetchers_.end(), fetcher)); |
396 } | 398 } |
397 | 399 |
398 } // namespace local_discovery | 400 } // namespace local_discovery |
OLD | NEW |