| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 #ifndef CONTENT_COMMON_BLUETOOTH_WEB_BLUETOOTH_DEVICE_ID_H_ | 5 #ifndef CONTENT_COMMON_BLUETOOTH_WEB_BLUETOOTH_DEVICE_ID_H_ |
| 6 #define CONTENT_COMMON_BLUETOOTH_WEB_BLUETOOTH_DEVICE_ID_H_ | 6 #define CONTENT_COMMON_BLUETOOTH_WEB_BLUETOOTH_DEVICE_ID_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "content/common/content_export.h" | 10 #include "content/common/content_export.h" |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 // Returns true if base64-decoding |device_id| results in a 128bit string. | 36 // Returns true if base64-decoding |device_id| results in a 128bit string. |
| 37 static bool IsValid(const std::string& device_id); | 37 static bool IsValid(const std::string& device_id); |
| 38 | 38 |
| 39 bool operator==(const WebBluetoothDeviceId& device_id) const; | 39 bool operator==(const WebBluetoothDeviceId& device_id) const; |
| 40 bool operator!=(const WebBluetoothDeviceId& device_id) const; | 40 bool operator!=(const WebBluetoothDeviceId& device_id) const; |
| 41 | 41 |
| 42 private: | 42 private: |
| 43 std::string device_id_; | 43 std::string device_id_; |
| 44 }; | 44 }; |
| 45 | 45 |
| 46 // This is required by gtest to print a readable output on test failures. | |
| 47 CONTENT_EXPORT std::ostream& operator<<(std::ostream& out, | |
| 48 const WebBluetoothDeviceId& device_id); | |
| 49 | |
| 50 struct WebBluetoothDeviceIdHash { | 46 struct WebBluetoothDeviceIdHash { |
| 51 size_t operator()(const WebBluetoothDeviceId& device_id) const { | 47 size_t operator()(const WebBluetoothDeviceId& device_id) const { |
| 52 return std::hash<std::string>()(device_id.str()); | 48 return std::hash<std::string>()(device_id.str()); |
| 53 } | 49 } |
| 54 }; | 50 }; |
| 55 | 51 |
| 56 } // namespace content | 52 } // namespace content |
| 57 | 53 |
| 58 #endif // CONTENT_COMMON_BLUETOOTH_WEB_BLUETOOTH_DEVICE_ID_H_ | 54 #endif // CONTENT_COMMON_BLUETOOTH_WEB_BLUETOOTH_DEVICE_ID_H_ |
| OLD | NEW |