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

Unified Diff: chromeos/network/network_state_handler.h

Issue 11614035: Improve NetworkStateHandler API (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix TrayNetworkStateObserver Created 8 years 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: chromeos/network/network_state_handler.h
diff --git a/chromeos/network/network_state_handler.h b/chromeos/network/network_state_handler.h
index 8c2d12573c62d13aa87ee8a15bcb0b3fbaddd134..8fe91341057c3bb7770e054b064de7fe19f88169 100644
--- a/chromeos/network/network_state_handler.h
+++ b/chromeos/network/network_state_handler.h
@@ -67,7 +67,7 @@ class CHROMEOS_EXPORT NetworkStateHandler
bool TechnologyEnabled(const std::string& technology) const;
// Asynchronously sets the enabled state for |technology|.
- // Note: Modifes Manager state. Calls |error_callback| on failure.
+ // Note: Modifies Manager state. Calls |error_callback| on failure.
void SetTechnologyEnabled(
const std::string& technology,
bool enabled,
@@ -86,15 +86,16 @@ class CHROMEOS_EXPORT NetworkStateHandler
// observer this class and implement NetworkServiceChanged().
const NetworkState* GetNetworkState(const std::string& service_path) const;
- // Returns the "active" network (first network in the list if connected),
- // NULL if none.
- const NetworkState* ActiveNetwork() const;
+ // Returns the default connected network (which includes VPNs) or NULL.
+ // This is equivalent to ConnectedNetworkByType(kMatchTypeDefault).
+ const NetworkState* DefaultNetwork() const;
// Returns the first connected network of type |type|, otherwise NULL.
pneubeck (no reviews) 2012/12/19 15:22:38 Do we assume that the first connected network has
stevenjb 2012/12/19 18:01:07 Yes.
pneubeck (no reviews) 2012/12/19 19:40:06 As there are several users (uses in the code) of "
+ // |type| can be a type defined in service_constants.h, or the additional
+ // match types defined in NetworkState; see NetworkState::MatchesType().
const NetworkState* ConnectedNetworkByType(const std::string& type) const;
- // Returns the first connecting network of type |type|, otherwise NULL.
- // An empty type will return any connecting non-ethernet network.
+ // Like ConnectedNetworkByType() but returns the connecting network or NULL.
const NetworkState* ConnectingNetworkByType(const std::string& type) const;
// Returns the hardware (MAC) address for the first connected network
@@ -186,6 +187,10 @@ class CHROMEOS_EXPORT NetworkStateHandler
const std::string& key,
const base::Value& value);
+ // Checks to see if the default network changed. Signals observers and
+ // returns true if it has.
+ bool CheckDefaultNetworkChanged();
+
// Shill property handler instance, owned by this class.
scoped_ptr<internal::ShillPropertyHandler> shill_property_handler_;
@@ -200,8 +205,8 @@ class CHROMEOS_EXPORT NetworkStateHandler
std::set<std::string> available_technologies_;
std::set<std::string> enabled_technologies_;
- // Keeps track of the active network for notifying observers when it changes.
- std::string active_network_path_;
+ // Keeps track of the default network for notifying observers when it changes.
+ std::string default_network_path_;
DISALLOW_COPY_AND_ASSIGN(NetworkStateHandler);
};

Powered by Google App Engine
This is Rietveld 408576698