| 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 ASH_SYSTEM_CHROMEOS_NETWORK_NETWORK_STATE_NOTIFIER_H_ | 5 #ifndef ASH_SYSTEM_CHROMEOS_NETWORK_NETWORK_STATE_NOTIFIER_H_ |
| 6 #define ASH_SYSTEM_CHROMEOS_NETWORK_NETWORK_STATE_NOTIFIER_H_ | 6 #define ASH_SYSTEM_CHROMEOS_NETWORK_NETWORK_STATE_NOTIFIER_H_ |
| 7 | 7 |
| 8 #include <set> | 8 #include <set> |
| 9 | 9 |
| 10 #include "ash/ash_export.h" | 10 #include "ash/ash_export.h" |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 virtual ~NetworkStateNotifier(); | 39 virtual ~NetworkStateNotifier(); |
| 40 | 40 |
| 41 // NetworkStateHandlerObserver | 41 // NetworkStateHandlerObserver |
| 42 virtual void DefaultNetworkChanged( | 42 virtual void DefaultNetworkChanged( |
| 43 const chromeos::NetworkState* network) OVERRIDE; | 43 const chromeos::NetworkState* network) OVERRIDE; |
| 44 virtual void NetworkPropertiesUpdated( | 44 virtual void NetworkPropertiesUpdated( |
| 45 const chromeos::NetworkState* network) OVERRIDE; | 45 const chromeos::NetworkState* network) OVERRIDE; |
| 46 | 46 |
| 47 // Show a connection error notification. If |error_name| matches an error | 47 // Show a connection error notification. If |error_name| matches an error |
| 48 // defined in NetworkConnectionHandler for connect, configure, or activation | 48 // defined in NetworkConnectionHandler for connect, configure, or activation |
| 49 // failed, then the associated message is shown, otherwise the Shill | 49 // failed, then the associated message is shown, otherwise |shill_error| |
| 50 // error for Service.Error is used (from network_connect::ErrorString), or | 50 // is expected to contain Service.Error (which might get cleared before |
| 51 // "Unknown network error". | 51 // GetProperties returns). |
| 52 void ShowNetworkConnectError(const std::string& error_name, | 52 void ShowNetworkConnectError(const std::string& error_name, |
| 53 const std::string& shill_error, |
| 53 const std::string& service_path); | 54 const std::string& service_path); |
| 54 | 55 |
| 55 private: | 56 private: |
| 56 void ConnectErrorPropertiesSucceeded( | 57 void ConnectErrorPropertiesSucceeded( |
| 57 const std::string& error_name, | 58 const std::string& error_name, |
| 59 const std::string& shill_error, |
| 58 const std::string& service_path, | 60 const std::string& service_path, |
| 59 const base::DictionaryValue& shill_properties); | 61 const base::DictionaryValue& shill_properties); |
| 60 void ConnectErrorPropertiesFailed( | 62 void ConnectErrorPropertiesFailed( |
| 61 const std::string& error_name, | 63 const std::string& error_name, |
| 64 const std::string& shill_error, |
| 62 const std::string& service_path, | 65 const std::string& service_path, |
| 63 const std::string& shill_error_name, | 66 const std::string& shill_connect_error, |
| 64 scoped_ptr<base::DictionaryValue> shill_error_data); | 67 scoped_ptr<base::DictionaryValue> shill_error_data); |
| 65 void ShowConnectErrorNotification( | 68 void ShowConnectErrorNotification( |
| 66 const std::string& error_name, | 69 const std::string& error_name, |
| 70 const std::string& shill_error, |
| 67 const std::string& service_path, | 71 const std::string& service_path, |
| 68 const base::DictionaryValue& shill_properties); | 72 const base::DictionaryValue& shill_properties); |
| 69 | 73 |
| 70 // Returns true if the default network changed. | 74 // Returns true if the default network changed. |
| 71 bool UpdateDefaultNetwork(const chromeos::NetworkState* network); | 75 bool UpdateDefaultNetwork(const chromeos::NetworkState* network); |
| 72 | 76 |
| 73 // Helper methods to update state and check for notifications. | 77 // Helper methods to update state and check for notifications. |
| 74 void UpdateCellularOutOfCredits(const chromeos::NetworkState* cellular); | 78 void UpdateCellularOutOfCredits(const chromeos::NetworkState* cellular); |
| 75 void UpdateCellularActivating(const chromeos::NetworkState* cellular); | 79 void UpdateCellularActivating(const chromeos::NetworkState* cellular); |
| 76 | 80 |
| 77 std::string last_default_network_; | 81 std::string last_default_network_; |
| 78 bool did_show_out_of_credits_; | 82 bool did_show_out_of_credits_; |
| 79 base::Time out_of_credits_notify_time_; | 83 base::Time out_of_credits_notify_time_; |
| 80 std::set<std::string> cellular_activating_; | 84 std::set<std::string> cellular_activating_; |
| 81 base::WeakPtrFactory<NetworkStateNotifier> weak_ptr_factory_; | 85 base::WeakPtrFactory<NetworkStateNotifier> weak_ptr_factory_; |
| 82 | 86 |
| 83 DISALLOW_COPY_AND_ASSIGN(NetworkStateNotifier); | 87 DISALLOW_COPY_AND_ASSIGN(NetworkStateNotifier); |
| 84 }; | 88 }; |
| 85 | 89 |
| 86 } // namespace ash | 90 } // namespace ash |
| 87 | 91 |
| 88 #endif // ASH_SYSTEM_CHROMEOS_NETWORK_NETWORK_STATE_NOTIFIER_H_ | 92 #endif // ASH_SYSTEM_CHROMEOS_NETWORK_NETWORK_STATE_NOTIFIER_H_ |
| OLD | NEW |