| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_CHROMEOS_CROS_NETWORK_LIBRARY_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_CROS_NETWORK_LIBRARY_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_CROS_NETWORK_LIBRARY_H_ | 6 #define CHROME_BROWSER_CHROMEOS_CROS_NETWORK_LIBRARY_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "base/observer_list.h" | 12 #include "base/observer_list.h" |
| 13 #include "base/platform_thread.h" | 13 #include "base/platform_thread.h" |
| 14 #include "base/singleton.h" | 14 #include "base/singleton.h" |
| 15 #include "base/string16.h" | 15 #include "base/string16.h" |
| 16 #include "base/timer.h" | 16 #include "base/timer.h" |
| 17 #include "net/url_request/url_request_job_tracker.h" | |
| 18 #include "cros/chromeos_network.h" | 17 #include "cros/chromeos_network.h" |
| 19 | 18 |
| 20 namespace chromeos { | 19 namespace chromeos { |
| 21 | 20 |
| 22 class Network { | 21 class Network { |
| 23 public: | 22 public: |
| 24 const std::string& service_path() const { return service_path_; } | 23 const std::string& service_path() const { return service_path_; } |
| 25 const std::string& device_path() const { return device_path_; } | 24 const std::string& device_path() const { return device_path_; } |
| 26 const std::string& ip_address() const { return ip_address_; } | 25 const std::string& ip_address() const { return ip_address_; } |
| 27 ConnectionType type() const { return type_; } | 26 ConnectionType type() const { return type_; } |
| (...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 222 std::string netmask; | 221 std::string netmask; |
| 223 std::string gateway; | 222 std::string gateway; |
| 224 std::string name_servers; | 223 std::string name_servers; |
| 225 }; | 224 }; |
| 226 typedef std::vector<NetworkIPConfig> NetworkIPConfigVector; | 225 typedef std::vector<NetworkIPConfig> NetworkIPConfigVector; |
| 227 | 226 |
| 228 class NetworkLibrary { | 227 class NetworkLibrary { |
| 229 public: | 228 public: |
| 230 class Observer { | 229 class Observer { |
| 231 public: | 230 public: |
| 232 // A bitfield mask for traffic types. | |
| 233 enum TrafficTypes { | |
| 234 TRAFFIC_DOWNLOAD = 0x1, | |
| 235 TRAFFIC_UPLOAD = 0x2, | |
| 236 } TrafficTypeMasks; | |
| 237 | |
| 238 // Called when the network has changed. (wifi networks, and ethernet) | 231 // Called when the network has changed. (wifi networks, and ethernet) |
| 239 virtual void NetworkChanged(NetworkLibrary* obj) = 0; | 232 virtual void NetworkChanged(NetworkLibrary* obj) = 0; |
| 240 | |
| 241 // Called when network traffic has been detected. | |
| 242 // Takes a bitfield of TrafficTypeMasks. | |
| 243 virtual void NetworkTraffic(NetworkLibrary* obj, int traffic_type) = 0; | |
| 244 }; | 233 }; |
| 245 | 234 |
| 246 virtual ~NetworkLibrary() {} | 235 virtual ~NetworkLibrary() {} |
| 247 virtual void AddObserver(Observer* observer) = 0; | 236 virtual void AddObserver(Observer* observer) = 0; |
| 248 virtual void RemoveObserver(Observer* observer) = 0; | 237 virtual void RemoveObserver(Observer* observer) = 0; |
| 249 | 238 |
| 250 virtual const EthernetNetwork& ethernet_network() const = 0; | 239 virtual const EthernetNetwork& ethernet_network() const = 0; |
| 251 virtual bool ethernet_connecting() const = 0; | 240 virtual bool ethernet_connecting() const = 0; |
| 252 virtual bool ethernet_connected() const = 0; | 241 virtual bool ethernet_connected() const = 0; |
| 253 | 242 |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 374 // The page will have a meta refresh of |refresh| seconds if |refresh| > 0. | 363 // The page will have a meta refresh of |refresh| seconds if |refresh| > 0. |
| 375 virtual std::string GetHtmlInfo(int refresh) = 0; | 364 virtual std::string GetHtmlInfo(int refresh) = 0; |
| 376 | 365 |
| 377 // Get library implementation. | 366 // Get library implementation. |
| 378 static NetworkLibrary* GetImpl(bool stub); | 367 static NetworkLibrary* GetImpl(bool stub); |
| 379 }; | 368 }; |
| 380 | 369 |
| 381 } // namespace chromeos | 370 } // namespace chromeos |
| 382 | 371 |
| 383 #endif // CHROME_BROWSER_CHROMEOS_CROS_NETWORK_LIBRARY_H_ | 372 #endif // CHROME_BROWSER_CHROMEOS_CROS_NETWORK_LIBRARY_H_ |
| OLD | NEW |