| 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 #ifndef CHROME_BROWSER_EXTENSIONS_API_DIAL_DIAL_SERVICE_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_DIAL_DIAL_SERVICE_H_ |
| 6 #define CHROME_BROWSER_EXTENSIONS_API_DIAL_DIAL_SERVICE_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_API_DIAL_DIAL_SERVICE_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/gtest_prod_util.h" | 10 #include "base/gtest_prod_util.h" |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 // DialService implementation | 106 // DialService implementation |
| 107 virtual bool Discover() OVERRIDE; | 107 virtual bool Discover() OVERRIDE; |
| 108 virtual void AddObserver(Observer* observer) OVERRIDE; | 108 virtual void AddObserver(Observer* observer) OVERRIDE; |
| 109 virtual void RemoveObserver(Observer* observer) OVERRIDE; | 109 virtual void RemoveObserver(Observer* observer) OVERRIDE; |
| 110 virtual bool HasObserver(Observer* observer) OVERRIDE; | 110 virtual bool HasObserver(Observer* observer) OVERRIDE; |
| 111 | 111 |
| 112 private: | 112 private: |
| 113 // Starts the control flow for one discovery cycle. | 113 // Starts the control flow for one discovery cycle. |
| 114 void StartDiscovery(); | 114 void StartDiscovery(); |
| 115 | 115 |
| 116 #if defined(OS_CHROMEOS) | |
| 117 // Returns the IP address of the preferred interface to bind the socket. This | |
| 118 // ChromeOS version can prioritize wifi and ethernet interfaces. | |
| 119 net::IPAddressNumber GetBestBindAddressChromeOS(); | |
| 120 #endif | |
| 121 | |
| 122 // Establishes the UDP socket that is used for requests and responses, | 116 // Establishes the UDP socket that is used for requests and responses, |
| 123 // establishes a read callback on the socket, and sends the first discovery | 117 // establishes a read callback on the socket, and sends the first discovery |
| 124 // request. Returns true if successful. | 118 // request. Returns true if successful. |
| 125 bool BindSocketAndSendRequest(const net::IPAddressNumber& bind_ip_address); | 119 bool BindSocketAndSendRequest(const net::IPAddressNumber& bind_ip_address); |
| 126 | 120 |
| 127 // Sends a single discovery request over the socket. | 121 // Sends a single discovery request over the socket. |
| 128 void SendOneRequest(); | 122 void SendOneRequest(); |
| 129 | 123 |
| 130 // Callback invoked for socket writes. | 124 // Callback invoked for socket writes. |
| 131 void OnSocketWrite(int result); | 125 void OnSocketWrite(int result); |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 223 FRIEND_TEST_ALL_PREFIXES(DialServiceTest, TestOnDeviceDiscovered); | 217 FRIEND_TEST_ALL_PREFIXES(DialServiceTest, TestOnDeviceDiscovered); |
| 224 FRIEND_TEST_ALL_PREFIXES(DialServiceTest, TestOnDiscoveryFinished); | 218 FRIEND_TEST_ALL_PREFIXES(DialServiceTest, TestOnDiscoveryFinished); |
| 225 FRIEND_TEST_ALL_PREFIXES(DialServiceTest, TestOnDiscoveryRequest); | 219 FRIEND_TEST_ALL_PREFIXES(DialServiceTest, TestOnDiscoveryRequest); |
| 226 FRIEND_TEST_ALL_PREFIXES(DialServiceTest, TestResponseParsing); | 220 FRIEND_TEST_ALL_PREFIXES(DialServiceTest, TestResponseParsing); |
| 227 DISALLOW_COPY_AND_ASSIGN(DialServiceImpl); | 221 DISALLOW_COPY_AND_ASSIGN(DialServiceImpl); |
| 228 }; | 222 }; |
| 229 | 223 |
| 230 } // namespace extensions | 224 } // namespace extensions |
| 231 | 225 |
| 232 #endif // CHROME_BROWSER_EXTENSIONS_API_DIAL_DIAL_SERVICE_H_ | 226 #endif // CHROME_BROWSER_EXTENSIONS_API_DIAL_DIAL_SERVICE_H_ |
| OLD | NEW |