| Index: chrome/browser/chromeos/cros/network_library.h
|
| diff --git a/chrome/browser/chromeos/cros/network_library.h b/chrome/browser/chromeos/cros/network_library.h
|
| index 0a7e5a2128a5d784841ce9c527a8094549df53f4..81b287e32c25a9260178d9cf87fcf571e181ece9 100644
|
| --- a/chrome/browser/chromeos/cros/network_library.h
|
| +++ b/chrome/browser/chromeos/cros/network_library.h
|
| @@ -373,231 +373,9 @@ class NetworkLibrary {
|
| // Fetches debug network info for display in about:network.
|
| // The page will have a meta refresh of |refresh| seconds if |refresh| > 0.
|
| virtual std::string GetHtmlInfo(int refresh) = 0;
|
| -};
|
| -
|
| -// This class handles the interaction with the ChromeOS network library APIs.
|
| -// Classes can add themselves as observers. Users can get an instance of this
|
| -// library class like this: NetworkLibrary::Get()
|
| -class NetworkLibraryImpl : public NetworkLibrary,
|
| - public URLRequestJobTracker::JobObserver {
|
| - public:
|
| - NetworkLibraryImpl();
|
| - virtual ~NetworkLibraryImpl();
|
| -
|
| - // URLRequestJobTracker::JobObserver methods (called on the IO thread):
|
| - virtual void OnJobAdded(URLRequestJob* job);
|
| - virtual void OnJobRemoved(URLRequestJob* job);
|
| - virtual void OnJobDone(URLRequestJob* job, const URLRequestStatus& status);
|
| - virtual void OnJobRedirect(URLRequestJob* job, const GURL& location,
|
| - int status_code);
|
| - virtual void OnBytesRead(URLRequestJob* job, int byte_count);
|
| -
|
| - // NetworkLibrary overrides.
|
| - virtual void AddObserver(Observer* observer);
|
| - virtual void RemoveObserver(Observer* observer);
|
| -
|
| - virtual const EthernetNetwork& ethernet_network() const { return ethernet_; }
|
| - virtual bool ethernet_connecting() const { return ethernet_.connecting(); }
|
| - virtual bool ethernet_connected() const { return ethernet_.connected(); }
|
| -
|
| - virtual const std::string& wifi_name() const { return wifi_.name(); }
|
| - virtual bool wifi_connecting() const { return wifi_.connecting(); }
|
| - virtual bool wifi_connected() const { return wifi_.connected(); }
|
| - virtual int wifi_strength() const { return wifi_.strength(); }
|
| -
|
| - virtual const std::string& cellular_name() const { return cellular_.name(); }
|
| - virtual bool cellular_connecting() const { return cellular_.connecting(); }
|
| - virtual bool cellular_connected() const { return cellular_.connected(); }
|
| - virtual int cellular_strength() const { return cellular_.strength(); }
|
| -
|
| - virtual bool Connected() const;
|
| - virtual bool Connecting() const;
|
| - virtual const std::string& IPAddress() const;
|
| -
|
| - virtual const WifiNetworkVector& wifi_networks() const {
|
| - return wifi_networks_;
|
| - }
|
| -
|
| - virtual const WifiNetworkVector& remembered_wifi_networks() const {
|
| - return remembered_wifi_networks_;
|
| - }
|
| -
|
| - virtual const CellularNetworkVector& cellular_networks() const {
|
| - return cellular_networks_;
|
| - }
|
| -
|
| - virtual const CellularNetworkVector& remembered_cellular_networks() const {
|
| - return remembered_cellular_networks_;
|
| - }
|
| -
|
| - virtual bool FindWifiNetworkByPath(const std::string& path,
|
| - WifiNetwork* network) const;
|
| - virtual bool FindCellularNetworkByPath(const std::string& path,
|
| - CellularNetwork* network) const;
|
| -
|
| - virtual void RequestWifiScan();
|
| - virtual bool GetWifiAccessPoints(WifiAccessPointVector* result);
|
| - virtual bool ConnectToPreferredNetworkIfAvailable();
|
| - virtual bool PreferredNetworkConnected();
|
| - virtual bool PreferredNetworkFailed();
|
| - virtual void ConnectToWifiNetwork(WifiNetwork network,
|
| - const std::string& password,
|
| - const std::string& identity,
|
| - const std::string& certpath);
|
| - virtual void ConnectToWifiNetwork(const std::string& ssid,
|
| - const std::string& password,
|
| - const std::string& identity,
|
| - const std::string& certpath,
|
| - bool auto_connect);
|
| - virtual void ConnectToCellularNetwork(CellularNetwork network);
|
| - virtual void DisconnectFromWirelessNetwork(const WirelessNetwork& network);
|
| - virtual void SaveCellularNetwork(const CellularNetwork& network);
|
| - virtual void SaveWifiNetwork(const WifiNetwork& network);
|
| - virtual void ForgetWirelessNetwork(const std::string& service_path);
|
| -
|
| - virtual bool ethernet_available() const {
|
| - return available_devices_ & (1 << TYPE_ETHERNET);
|
| - }
|
| - virtual bool wifi_available() const {
|
| - return available_devices_ & (1 << TYPE_WIFI);
|
| - }
|
| - virtual bool cellular_available() const {
|
| - return available_devices_ & (1 << TYPE_CELLULAR);
|
| - }
|
| -
|
| - virtual bool ethernet_enabled() const {
|
| - return enabled_devices_ & (1 << TYPE_ETHERNET);
|
| - }
|
| - virtual bool wifi_enabled() const {
|
| - return enabled_devices_ & (1 << TYPE_WIFI);
|
| - }
|
| - virtual bool cellular_enabled() const {
|
| - return enabled_devices_ & (1 << TYPE_CELLULAR);
|
| - }
|
| -
|
| - virtual bool offline_mode() const { return offline_mode_; }
|
| -
|
| - virtual void EnableEthernetNetworkDevice(bool enable);
|
| - virtual void EnableWifiNetworkDevice(bool enable);
|
| - virtual void EnableCellularNetworkDevice(bool enable);
|
| - virtual void EnableOfflineMode(bool enable);
|
| - virtual NetworkIPConfigVector GetIPConfigs(const std::string& device_path);
|
| - virtual std::string GetHtmlInfo(int refresh);
|
| -
|
| - virtual void UpdateSystemInfo();
|
| -
|
| - private:
|
| -
|
| - // This method is called when there's a change in network status.
|
| - // This method is called on a background thread.
|
| - static void NetworkStatusChangedHandler(void* object);
|
| -
|
| - // This parses SystemInfo into:
|
| - // - an EthernetNetwork
|
| - // - a WifiNetworkVector of wifi networks
|
| - // - a CellularNetworkVector of cellular networks.
|
| - // - a WifiNetworkVector of remembered wifi networks
|
| - // - a CellularNetworkVector of remembered cellular networks.
|
| - static void ParseSystem(SystemInfo* system,
|
| - EthernetNetwork* ethernet,
|
| - WifiNetworkVector* wifi_networks,
|
| - CellularNetworkVector* ceullular_networks,
|
| - WifiNetworkVector* remembered_wifi_networks,
|
| - CellularNetworkVector* remembered_ceullular_networks);
|
| -
|
| - // This methods loads the initial list of networks on startup and starts the
|
| - // monitoring of network changes.
|
| - void Init();
|
| - // Initialize with test data.
|
| - void InitTestData();
|
| -
|
| - // Returns the preferred wifi network.
|
| - WifiNetwork* GetPreferredNetwork();
|
| -
|
| - // Gets the WifiNetwork with the given name. Returns NULL if not found.
|
| - // Only used by GetPreferredNetwork() to lookup "Google" and "GoogleA" (hack)
|
| - WifiNetwork* GetWifiNetworkByName(const std::string& name);
|
| -
|
| - // Gets the WirelessNetwork (WifiNetwork or CellularNetwork) by path
|
| - template<typename T>
|
| - T* GetWirelessNetworkByPath(std::vector<T>& networks,
|
| - const std::string& path);
|
| - template<typename T>
|
| - const T* GetWirelessNetworkByPath(const std::vector<T>& networks,
|
| - const std::string& path) const;
|
| -
|
| - // Enables/disables the specified network device.
|
| - void EnableNetworkDeviceType(ConnectionType device, bool enable);
|
| -
|
| - // Update the cached network status.
|
| - // This will notify all the Observers.
|
| - void UpdateNetworkStatus();
|
| -
|
| - // Checks network traffic to see if there is any uploading.
|
| - // If there is download traffic, then true is passed in for download.
|
| - // If there is network traffic then start timer that invokes
|
| - // NetworkTrafficTimerFired.
|
| - void CheckNetworkTraffic(bool download);
|
| -
|
| - // Called when the timer fires and we need to send out NetworkTraffic
|
| - // notifications.
|
| - void NetworkTrafficTimerFired();
|
| -
|
| - // This is a helper method to notify the observers on the UI thread.
|
| - void NotifyNetworkTraffic(int traffic_type);
|
| -
|
| - // This will notify all obeservers on the UI thread.
|
| - void NotifyObservers();
|
| -
|
| - ObserverList<Observer> observers_;
|
| -
|
| - // The amount of time to wait between each NetworkTraffic notifications.
|
| - static const int kNetworkTrafficeTimerSecs;
|
| -
|
| - // Timer for sending NetworkTraffic notification every
|
| - // kNetworkTrafficeTimerSecs seconds.
|
| - base::OneShotTimer<NetworkLibraryImpl> timer_;
|
| -
|
| - // The current traffic type that will be sent out for the next NetworkTraffic
|
| - // notification. This is a bitfield of TrafficTypeMasks.
|
| - int traffic_type_;
|
| -
|
| - // The network status connection for monitoring network status changes.
|
| - MonitorNetworkConnection network_status_connection_;
|
| -
|
| - // The ethernet network.
|
| - EthernetNetwork ethernet_;
|
| -
|
| - // The list of available wifi networks.
|
| - WifiNetworkVector wifi_networks_;
|
| -
|
| - // The current connected (or connecting) wifi network.
|
| - WifiNetwork wifi_;
|
| -
|
| - // The remembered wifi networks.
|
| - WifiNetworkVector remembered_wifi_networks_;
|
| -
|
| - // The list of available cellular networks.
|
| - CellularNetworkVector cellular_networks_;
|
| -
|
| - // The current connected (or connecting) cellular network.
|
| - CellularNetwork cellular_;
|
| -
|
| - // The remembered cellular networks.
|
| - CellularNetworkVector remembered_cellular_networks_;
|
| -
|
| - // The current available network devices. Bitwise flag of ConnectionTypes.
|
| - int available_devices_;
|
| -
|
| - // The current enabled network devices. Bitwise flag of ConnectionTypes.
|
| - int enabled_devices_;
|
| -
|
| - // The current connected network devices. Bitwise flag of ConnectionTypes.
|
| - int connected_devices_;
|
| -
|
| - bool offline_mode_;
|
|
|
| - DISALLOW_COPY_AND_ASSIGN(NetworkLibraryImpl);
|
| + // Get library implementation.
|
| + static NetworkLibrary* GetImpl(bool stub);
|
| };
|
|
|
| } // namespace chromeos
|
|
|