Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(385)

Unified Diff: chrome/browser/chromeos/cros/network_library.h

Issue 4229006: Revert 64888 - Push for ers:... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 10 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/chromeos/cros/network_library.h
===================================================================
--- chrome/browser/chromeos/cros/network_library.h (revision 64888)
+++ chrome/browser/chromeos/cros/network_library.h (working copy)
@@ -48,11 +48,14 @@
state_ == STATE_IDLE; }
ConnectionError error() const { return error_; }
ConnectionState state() const { return state_; }
- // Is this the active network, i.e, the one through which
- // network traffic is being routed? A network can be connected,
- // but not be carrying traffic.
- bool is_active() const { return is_active_; }
+ void set_service_path(const std::string& service_path) {
+ service_path_ = service_path; }
+ void set_connecting(bool connecting) { state_ = (connecting ?
+ STATE_ASSOCIATION : STATE_IDLE); }
+ void set_connected(bool connected) { state_ = (connected ?
+ STATE_READY : STATE_IDLE); }
+
// Clear the fields.
virtual void Clear();
@@ -66,8 +69,7 @@
Network()
: type_(TYPE_UNKNOWN),
state_(STATE_UNKNOWN),
- error_(ERROR_UNKNOWN),
- is_active_(false) {}
+ error_(ERROR_UNKNOWN) {}
explicit Network(const Network& network);
explicit Network(const ServiceInfo* service);
virtual ~Network() {}
@@ -78,19 +80,6 @@
ConnectionType type_;
ConnectionState state_;
ConnectionError error_;
- bool is_active_;
-
- private:
- void set_service_path(const std::string& service_path) {
- service_path_ = service_path; }
- void set_connecting(bool connecting) { state_ = (connecting ?
- STATE_ASSOCIATION : STATE_IDLE); }
- void set_connected(bool connected) { state_ = (connected ?
- STATE_READY : STATE_IDLE); }
- void set_state(ConnectionState state) { state_ = state; }
- void set_active(bool is_active) { is_active_ = is_active; }
-
- friend class NetworkLibraryImpl;
};
class EthernetNetwork : public Network {
@@ -130,6 +119,8 @@
bool auto_connect() const { return auto_connect_; }
bool favorite() const { return favorite_; }
+ void set_name(const std::string& name) { name_ = name; }
+ void set_strength(int strength) { strength_ = strength; }
void set_auto_connect(bool auto_connect) { auto_connect_ = auto_connect; }
void set_favorite(bool favorite) { favorite_ = favorite; }
@@ -149,12 +140,6 @@
int strength_;
bool auto_connect_;
bool favorite_;
-
- private:
- void set_name(const std::string& name) { name_ = name; }
- void set_strength(int strength) { strength_ = strength; }
-
- friend class NetworkLibraryImpl;
};
class CellularNetwork : public WirelessNetwork {
@@ -173,6 +158,9 @@
// Starts device activation process. Returns false if the device state does
// not permit activation.
bool StartActivation() const;
+ void set_activation_state(ActivationState state) {
+ activation_state_ = state;
+ }
const ActivationState activation_state() const { return activation_state_; }
const NetworkTechnology network_technology() const {
return network_technology_;
@@ -183,6 +171,9 @@
const std::string& operator_name() const { return operator_name_; }
const std::string& operator_code() const { return operator_code_; }
const std::string& payment_url() const { return payment_url_; }
+ void set_payment_url(const std::string& url) {
+ payment_url_ = url;
+ }
const std::string& meid() const { return meid_; }
const std::string& imei() const { return imei_; }
const std::string& imsi() const { return imsi_; }
@@ -243,25 +234,6 @@
std::string last_update_;
unsigned int prl_version_;
CellularDataPlanList data_plans_;
-
- private:
- void set_activation_state(ActivationState state) {
- activation_state_ = state;
- }
- void set_payment_url(const std::string& url) {
- payment_url_ = url;
- }
- void set_network_technology(NetworkTechnology technology) {
- network_technology_ = technology;
- }
- void set_roaming_state(NetworkRoamingState state) {
- roaming_state_ = state;
- }
- void set_restricted_pool(bool restricted_pool) {
- restricted_pool_ = restricted_pool;
- }
-
- friend class NetworkLibraryImpl;
};
class WifiNetwork : public WirelessNetwork {
@@ -367,48 +339,28 @@
// library like this: chromeos::CrosLibrary::Get()->GetNetworkLibrary()
class NetworkLibrary {
public:
- class NetworkManagerObserver {
+ class Observer {
public:
- // Called when the state of the network manager has changed,
- // for example, networks have appeared or disappeared.
- virtual void OnNetworkManagerChanged(NetworkLibrary* obj) = 0;
+ // Called when the network has changed. (wifi networks, and ethernet)
+ virtual void NetworkChanged(NetworkLibrary* obj) = 0;
+ // Called when the cellular data plan has changed.
+ virtual void CellularDataPlanChanged(NetworkLibrary* obj) {}
};
- class NetworkObserver {
+ class PropertyObserver {
public:
- // Called when the state of a single network has changed,
- // for example signal strength or connection state.
- virtual void OnNetworkChanged(NetworkLibrary* cros,
- const Network* network) = 0;
+ virtual void PropertyChanged(const char* service_path,
+ const char* key,
+ const Value* value) = 0;
};
- class CellularDataPlanObserver {
- public:
- // Called when the cellular data plan has changed.
- virtual void OnCellularDataPlanChanged(NetworkLibrary* obj) = 0;
- };
-
virtual ~NetworkLibrary() {}
+ virtual void AddObserver(Observer* observer) = 0;
+ virtual void RemoveObserver(Observer* observer) = 0;
+ virtual void AddProperyObserver(const char* service_path,
+ PropertyObserver* observer) = 0;
+ virtual void RemoveProperyObserver(PropertyObserver* observer) = 0;
- virtual void AddNetworkManagerObserver(NetworkManagerObserver* observer) = 0;
- virtual void RemoveNetworkManagerObserver(
- NetworkManagerObserver* observer) = 0;
-
- // An attempt to add an observer that has already been added for a
- // give service path will be ignored.
- virtual void AddNetworkObserver(const std::string& service_path,
- NetworkObserver* observer) = 0;
- // Remove an observer of a single network
- virtual void RemoveNetworkObserver(const std::string& service_path,
- NetworkObserver* observer) = 0;
- // Stop |observer| from observing any networks
- virtual void RemoveObserverForAllNetworks(NetworkObserver* observer) = 0;
-
- virtual void AddCellularDataPlanObserver(
- CellularDataPlanObserver* observer) = 0;
- virtual void RemoveCellularDataPlanObserver(
- CellularDataPlanObserver* observer) = 0;
-
// Return the active Ethernet network (or a default structure if inactive).
virtual EthernetNetwork* ethernet_network() = 0;
virtual bool ethernet_connecting() const = 0;
@@ -505,8 +457,6 @@
virtual bool wifi_enabled() const = 0;
virtual bool cellular_enabled() const = 0;
- virtual const Network* active_network() const = 0;
-
virtual bool offline_mode() const = 0;
// Enables/disables the ethernet network device.
« no previous file with comments | « chrome/browser/chromeos/cros/mock_network_library.h ('k') | chrome/browser/chromeos/cros/network_library.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698