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

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: Always -> Required 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..594acd100ded25882be76705bcde5b204b654fdb 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'
+ // to the UI for badging network icons.
+ const DeviceState* device =
+ NetworkHandler::Get()->network_state_handler()->GetDeviceState(
pneubeck (no reviews) 2015/02/25 09:57:04 instead of adding this cyclic dependency on NSH, h
stevenjb 2015/02/25 19:16:25 Moved to TranslateNetworkStateToONC. Was on the fe
+ 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