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

Unified Diff: chromeos/network/network_state.cc

Issue 948943003: Better support for Cellular roaming state in ONC (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 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: chromeos/network/network_state.cc
diff --git a/chromeos/network/network_state.cc b/chromeos/network/network_state.cc
index bd53eae5d141dd190c160e18d13a9109b7993f55..22965266851d9281a6424820c0ce77c13771c079 100644
--- a/chromeos/network/network_state.cc
+++ b/chromeos/network/network_state.cc
@@ -7,7 +7,10 @@
#include "base/stl_util.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/stringprintf.h"
+#include "chromeos/network/device_state.h"
+#include "chromeos/network/network_handler.h"
#include "chromeos/network/network_profile_handler.h"
+#include "chromeos/network/network_state_handler.h"
#include "chromeos/network/network_type_pattern.h"
#include "chromeos/network/network_util.h"
#include "chromeos/network/onc/onc_utils.h"
@@ -235,10 +238,27 @@ void NetworkState::GetStateProperties(base::DictionaryValue* dictionary) const {
network_technology());
dictionary->SetStringWithoutPathExpansion(shill::kActivationStateProperty,
activation_state());
- dictionary->SetStringWithoutPathExpansion(shill::kRoamingStateProperty,
- roaming());
- dictionary->SetBooleanWithoutPathExpansion(shill::kOutOfCreditsProperty,
- cellular_out_of_credits());
+ if (NetworkTypePattern::Cellular().MatchesType(type())) {
+ dictionary->SetStringWithoutPathExpansion(shill::kRoamingStateProperty,
+ roaming());
+ dictionary->SetBooleanWithoutPathExpansion(shill::kOutOfCreditsProperty,
+ cellular_out_of_credits());
+ // We need to set Device[Cellular.ProviderRequiresRoaming] so that
+ // the Shill -> ONC translation can provide 'ProviderRequiresRoaming'
armansito 2015/02/24 03:05:03 nit: Is there an additional indentation here?
stevenjb 2015/02/24 16:31:18 Done.
+ // to the UI for badging network icons.
+ const DeviceState* device =
+ NetworkHandler::Get()->network_state_handler()->GetDeviceState(
+ device_path_);
+ if (device) {
+ scoped_ptr<base::DictionaryValue> device_dict(
+ new base::DictionaryValue);
+ device_dict->SetBooleanWithoutPathExpansion(
+ shill::kProviderRequiresRoamingProperty,
+ device->provider_requires_roaming());
+ dictionary->SetWithoutPathExpansion(shill::kDeviceProperty,
+ device_dict.release());
+ }
+ }
}
}

Powered by Google App Engine
This is Rietveld 408576698