Commit 672bec75 authored by gauravsh@chromium.org's avatar gauravsh@chromium.org

Add additional cellular-related properties to Network|DeviceState

These properties (specifically related to cellular activation)
are used by MobileActivator and needed to transition it to use
the Network*Handlers.

BUG=188753

Review URL: https://chromiumcodereview.appspot.com/17091006

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@208009 0039d316-1c4b-4281-b951-d872f2087c98
parent 82f67a43
......@@ -68,6 +68,14 @@ bool DeviceState::PropertyChanged(const std::string& key,
return false;
// Ignore other SIMLockStatus properties.
return true;
} else if (key == flimflam::kMeidProperty) {
return GetStringValue(key, value, &meid_);
} else if (key == flimflam::kImeiProperty) {
return GetStringValue(key, value, &imei_);
} else if (key == flimflam::kIccidProperty) {
return GetStringValue(key, value, &iccid_);
} else if (key == flimflam::kMdnProperty) {
return GetStringValue(key, value, &mdn_);
} else if (key == shill::kSIMPresentProperty) {
return GetBooleanValue(key, value, &sim_present_);
}
......
......@@ -25,7 +25,11 @@ class CHROMEOS_EXPORT DeviceState : public ManagedState {
bool provider_requires_roaming() const { return provider_requires_roaming_; }
bool support_network_scan() const { return support_network_scan_; }
bool scanning() const { return scanning_; }
std::string sim_lock_type() const { return sim_lock_type_; }
const std::string& sim_lock_type() const { return sim_lock_type_; }
const std::string& meid() const { return meid_; }
const std::string& imei() const { return imei_; }
const std::string& iccid() const { return iccid_; }
const std::string& mdn() const { return mdn_; }
// Returns true if the technology family is GSM and sim_present_ is false.
bool IsSimAbsent() const;
......@@ -40,6 +44,10 @@ class CHROMEOS_EXPORT DeviceState : public ManagedState {
bool scanning_;
std::string technology_family_;
std::string sim_lock_type_;
std::string meid_;
std::string imei_;
std::string iccid_;
std::string mdn_;
bool sim_present_;
DISALLOW_COPY_AND_ASSIGN(DeviceState);
......
......@@ -177,6 +177,20 @@ bool NetworkState::PropertyChanged(const std::string& key,
return GetBooleanValue(key, value, &activate_over_non_cellular_networks_);
} else if (key == shill::kOutOfCreditsProperty) {
return GetBooleanValue(key, value, &cellular_out_of_credits_);
} else if (key == flimflam::kUsageURLProperty) {
return GetStringValue(key, value, &usage_url_);
} else if (key == flimflam::kPaymentPortalProperty) {
const DictionaryValue& dict = static_cast<const DictionaryValue&>(value);
if (!dict.GetStringWithoutPathExpansion(flimflam::kPaymentPortalURL,
&payment_url_))
return false;
if (!dict.GetStringWithoutPathExpansion(flimflam::kPaymentPortalMethod,
&post_method_))
return false;
if (!dict.GetStringWithoutPathExpansion(flimflam::kPaymentPortalPostData,
&post_data_))
return false;
return true;
} else if (key == flimflam::kWifiHexSsid) {
return GetStringValue(key, value, &hex_ssid_);
} else if (key == flimflam::kCountryProperty) {
......@@ -258,6 +272,18 @@ void NetworkState::GetProperties(base::DictionaryValue* dictionary) const {
activate_over_non_cellular_networks_);
dictionary->SetBooleanWithoutPathExpansion(shill::kOutOfCreditsProperty,
cellular_out_of_credits_);
base::DictionaryValue* payment_portal_properties = new DictionaryValue;
payment_portal_properties->SetStringWithoutPathExpansion(
flimflam::kPaymentPortalURL,
payment_url_);
payment_portal_properties->SetStringWithoutPathExpansion(
flimflam::kPaymentPortalMethod,
post_method_);
payment_portal_properties->SetStringWithoutPathExpansion(
flimflam::kPaymentPortalPostData,
post_data_);
dictionary->SetWithoutPathExpansion(flimflam::kPaymentPortalProperty,
payment_portal_properties);
}
void NetworkState::GetConfigProperties(
......
......@@ -70,6 +70,10 @@ public:
return activate_over_non_cellular_networks_;
}
bool cellular_out_of_credits() const { return cellular_out_of_credits_; }
const std::string& usage_url() const { return usage_url_; }
const std::string& payment_url() const { return payment_url_; }
const std::string& post_method() const { return post_method_; }
const std::string& post_data() const { return post_data_; }
bool IsConnectedState() const;
bool IsConnectingState() const;
......@@ -100,6 +104,8 @@ public:
dns_servers_ = dns_servers;
}
// TODO(gauravsh): Audit the list of properties that we are caching. We should
// only be doing this for commonly accessed properties. crbug.com/252553
// Common Network Service properties
std::string security_;
std::string device_path_;
......@@ -134,6 +140,11 @@ public:
std::string roaming_;
bool activate_over_non_cellular_networks_;
bool cellular_out_of_credits_;
// Cellular payment portal properties.
std::string usage_url_;
std::string payment_url_;
std::string post_method_;
std::string post_data_;
DISALLOW_COPY_AND_ASSIGN(NetworkState);
};
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment