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

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

Issue 6292008: Added flags to prevent messing with network connections while 3G device is be... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 11 months 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.cc
===================================================================
--- chrome/browser/chromeos/cros/network_library.cc (revision 71648)
+++ chrome/browser/chromeos/cros/network_library.cc (working copy)
@@ -842,6 +842,7 @@
connected_devices_(0),
wifi_scanning_(false),
offline_mode_(false),
+ is_locked_(false),
update_task_(NULL) {
if (EnsureCrosLoaded()) {
Init();
@@ -940,6 +941,26 @@
}
}
+ virtual void Lock() {
+ if (is_locked_)
+ return;
+ is_locked_ = true;
+ NotifyNetworkManagerChanged();
+ }
+
+ virtual void Unlock() {
+ DCHECK(is_locked_);
+ if (!is_locked_)
+ return;
+ is_locked_ = false;
+ NotifyNetworkManagerChanged();
+ is_locked_ = false;
Charlie Lee 2011/01/20 20:05:43 What's the reason for setting this twice?
zel 2011/01/20 22:06:14 Done.
+ }
+
+ virtual bool IsLocked() {
+ return is_locked_;
+ }
+
virtual void AddCellularDataPlanObserver(CellularDataPlanObserver* observer) {
if (!data_plan_observers_.HasObserver(observer))
data_plan_observers_.AddObserver(observer);
@@ -1300,14 +1321,20 @@
}
virtual void EnableEthernetNetworkDevice(bool enable) {
+ if (is_locked_)
+ return;
EnableNetworkDeviceType(TYPE_ETHERNET, enable);
}
virtual void EnableWifiNetworkDevice(bool enable) {
+ if (is_locked_)
+ return;
EnableNetworkDeviceType(TYPE_WIFI, enable);
}
virtual void EnableCellularNetworkDevice(bool enable) {
+ if (is_locked_)
+ return;
EnableNetworkDeviceType(TYPE_CELLULAR, enable);
}
@@ -1597,6 +1624,7 @@
}
void InitTestData() {
+ is_locked_ = true;
ethernet_ = new EthernetNetwork();
ethernet_->set_connected(true);
ethernet_->set_service_path("eth1");
@@ -1914,6 +1942,9 @@
// Currently not implemented. TODO: implement or eliminate.
bool offline_mode_;
+ // True if access network library is locked.
+ bool is_locked_;
+
// Delayed task to retrieve the network information.
CancelableTask* update_task_;
@@ -1939,6 +1970,9 @@
virtual void RemoveNetworkObserver(const std::string& service_path,
NetworkObserver* observer) {}
virtual void RemoveObserverForAllNetworks(NetworkObserver* observer) {}
+ virtual void Lock() {}
+ virtual void Unlock() {}
+ virtual bool IsLocked() { return true; }
virtual void AddCellularDataPlanObserver(
CellularDataPlanObserver* observer) {}
virtual void RemoveCellularDataPlanObserver(

Powered by Google App Engine
This is Rietveld 408576698