| 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 #include "chrome/browser/chromeos/cros/network_library.h" | 5 #include "chrome/browser/chromeos/cros/network_library.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/string_number_conversions.h" | 9 #include "base/string_number_conversions.h" |
| 10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
| (...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 242 | 242 |
| 243 void OnJobDone(URLRequestJob* job, const URLRequestStatus& status) { | 243 void OnJobDone(URLRequestJob* job, const URLRequestStatus& status) { |
| 244 CheckNetworkTraffic(false); | 244 CheckNetworkTraffic(false); |
| 245 } | 245 } |
| 246 | 246 |
| 247 void OnJobRedirect( | 247 void OnJobRedirect( |
| 248 URLRequestJob* job, const GURL& location, int status_code) { | 248 URLRequestJob* job, const GURL& location, int status_code) { |
| 249 CheckNetworkTraffic(false); | 249 CheckNetworkTraffic(false); |
| 250 } | 250 } |
| 251 | 251 |
| 252 void OnBytesRead(URLRequestJob* job, int byte_count) { | 252 void OnBytesRead(URLRequestJob* job, const char* buf, int byte_count) { |
| 253 CheckNetworkTraffic(true); | 253 CheckNetworkTraffic(true); |
| 254 } | 254 } |
| 255 | 255 |
| 256 void AddObserver(Observer* observer) { | 256 void AddObserver(Observer* observer) { |
| 257 observers_.AddObserver(observer); | 257 observers_.AddObserver(observer); |
| 258 } | 258 } |
| 259 | 259 |
| 260 void RemoveObserver(Observer* observer) { | 260 void RemoveObserver(Observer* observer) { |
| 261 observers_.RemoveObserver(observer); | 261 observers_.RemoveObserver(observer); |
| 262 } | 262 } |
| (...skipping 746 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1009 | 1009 |
| 1010 class NetworkLibraryStubImpl : public NetworkLibrary { | 1010 class NetworkLibraryStubImpl : public NetworkLibrary { |
| 1011 public: | 1011 public: |
| 1012 NetworkLibraryStubImpl() : ip_address_("1.1.1.1") {} | 1012 NetworkLibraryStubImpl() : ip_address_("1.1.1.1") {} |
| 1013 ~NetworkLibraryStubImpl() {} | 1013 ~NetworkLibraryStubImpl() {} |
| 1014 void OnJobAdded(URLRequestJob* job) {} | 1014 void OnJobAdded(URLRequestJob* job) {} |
| 1015 void OnJobRemoved(URLRequestJob* job) {} | 1015 void OnJobRemoved(URLRequestJob* job) {} |
| 1016 void OnJobDone(URLRequestJob* job, const URLRequestStatus& status) {} | 1016 void OnJobDone(URLRequestJob* job, const URLRequestStatus& status) {} |
| 1017 void OnJobRedirect( | 1017 void OnJobRedirect( |
| 1018 URLRequestJob* job, const GURL& location, int status_code) {} | 1018 URLRequestJob* job, const GURL& location, int status_code) {} |
| 1019 void OnBytesRead(URLRequestJob* job, int byte_count) {} | 1019 void OnBytesRead(URLRequestJob* job, const char* buf, int byte_count) {} |
| 1020 void AddObserver(Observer* observer) {} | 1020 void AddObserver(Observer* observer) {} |
| 1021 void RemoveObserver(Observer* observer) {} | 1021 void RemoveObserver(Observer* observer) {} |
| 1022 virtual const EthernetNetwork& ethernet_network() const { | 1022 virtual const EthernetNetwork& ethernet_network() const { |
| 1023 return ethernet_; | 1023 return ethernet_; |
| 1024 } | 1024 } |
| 1025 virtual bool ethernet_connecting() const { return false; } | 1025 virtual bool ethernet_connecting() const { return false; } |
| 1026 virtual bool ethernet_connected() const { return true; } | 1026 virtual bool ethernet_connected() const { return true; } |
| 1027 virtual const std::string& wifi_name() const { return EmptyString(); } | 1027 virtual const std::string& wifi_name() const { return EmptyString(); } |
| 1028 virtual bool wifi_connecting() const { return false; } | 1028 virtual bool wifi_connecting() const { return false; } |
| 1029 virtual bool wifi_connected() const { return false; } | 1029 virtual bool wifi_connected() const { return false; } |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1105 return new NetworkLibraryStubImpl(); | 1105 return new NetworkLibraryStubImpl(); |
| 1106 else | 1106 else |
| 1107 return new NetworkLibraryImpl(); | 1107 return new NetworkLibraryImpl(); |
| 1108 } | 1108 } |
| 1109 | 1109 |
| 1110 } // namespace chromeos | 1110 } // namespace chromeos |
| 1111 | 1111 |
| 1112 // Allows InvokeLater without adding refcounting. This class is a Singleton and | 1112 // Allows InvokeLater without adding refcounting. This class is a Singleton and |
| 1113 // won't be deleted until it's last InvokeLater is run. | 1113 // won't be deleted until it's last InvokeLater is run. |
| 1114 DISABLE_RUNNABLE_METHOD_REFCOUNT(chromeos::NetworkLibraryImpl); | 1114 DISABLE_RUNNABLE_METHOD_REFCOUNT(chromeos::NetworkLibraryImpl); |
| OLD | NEW |