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

Unified Diff: chromeos/dbus/fake_shill_device_client.cc

Issue 399303003: Eliminate use of sim unlock UI notifications (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 5 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/dbus/fake_shill_device_client.cc
diff --git a/chromeos/dbus/fake_shill_device_client.cc b/chromeos/dbus/fake_shill_device_client.cc
index de352b1314e96b98f7189b219f23763b56109ad7..a81cbfbdfe4c8561faeac13f5cfd49397d6d6301 100644
--- a/chromeos/dbus/fake_shill_device_client.cc
+++ b/chromeos/dbus/fake_shill_device_client.cc
@@ -22,6 +22,8 @@ namespace chromeos {
namespace {
+std::string kSimPin = "1111";
+
void ErrorFunction(const std::string& device_path,
const std::string& error_name,
const std::string& error_message) {
@@ -129,10 +131,35 @@ void FakeShillDeviceClient::RequirePin(const dbus::ObjectPath& device_path,
bool require,
const base::Closure& callback,
const ErrorCallback& error_callback) {
- if (!stub_devices_.HasKey(device_path.value())) {
+ VLOG(1) << "RequirePin: " << device_path.value();
+ if (pin != kSimPin) {
+ base::MessageLoop::current()->PostTask(
+ FROM_HERE,
+ base::Bind(error_callback, shill::kErrorResultIncorrectPin, ""));
+ return;
+ }
+ base::DictionaryValue* device_properties = NULL;
+ if (!stub_devices_.GetDictionaryWithoutPathExpansion(device_path.value(),
+ &device_properties)) {
PostDeviceNotFoundError(error_callback);
return;
}
+ base::DictionaryValue* simlock_dict = NULL;
+ if (!device_properties->GetDictionaryWithoutPathExpansion(
+ shill::kSIMLockStatusProperty, &simlock_dict)) {
+ simlock_dict = new base::DictionaryValue;
+ device_properties->SetWithoutPathExpansion(
+ shill::kSIMLockStatusProperty, simlock_dict);
+ }
+ simlock_dict->Clear();
+ simlock_dict->Set(shill::kSIMLockEnabledProperty,
+ new base::FundamentalValue(require));
armansito 2014/07/18 03:34:58 nit: SetBoolean?
stevenjb 2014/07/18 17:39:23 Done.
+ // TODO(stevenjb): Investigate why non-empty value breaks UI.
+ std::string lock_type = ""; // shill::kSIMLockPin
+ simlock_dict->SetString(shill::kSIMLockTypeProperty, lock_type);
+ simlock_dict->SetInteger(shill::kSIMLockRetriesLeftProperty, 5);
+
+ NotifyObserversPropertyChanged(device_path, shill::kSIMLockStatusProperty);
base::MessageLoop::current()->PostTask(FROM_HERE, callback);
}
@@ -140,6 +167,13 @@ void FakeShillDeviceClient::EnterPin(const dbus::ObjectPath& device_path,
const std::string& pin,
const base::Closure& callback,
const ErrorCallback& error_callback) {
+ VLOG(1) << "EnterPin: " << device_path.value();
+ if (pin != kSimPin) {
+ base::MessageLoop::current()->PostTask(
+ FROM_HERE,
+ base::Bind(error_callback, shill::kErrorResultIncorrectPin, ""));
+ return;
+ }
if (!stub_devices_.HasKey(device_path.value())) {
PostDeviceNotFoundError(error_callback);
return;
@@ -152,6 +186,7 @@ void FakeShillDeviceClient::UnblockPin(const dbus::ObjectPath& device_path,
const std::string& pin,
const base::Closure& callback,
const ErrorCallback& error_callback) {
+ VLOG(1) << "UnblockPin: " << device_path.value();
if (!stub_devices_.HasKey(device_path.value())) {
PostDeviceNotFoundError(error_callback);
return;
@@ -164,6 +199,7 @@ void FakeShillDeviceClient::ChangePin(const dbus::ObjectPath& device_path,
const std::string& new_pin,
const base::Closure& callback,
const ErrorCallback& error_callback) {
+ VLOG(1) << "ChangePin: " << device_path.value();
if (!stub_devices_.HasKey(device_path.value())) {
PostDeviceNotFoundError(error_callback);
return;

Powered by Google App Engine
This is Rietveld 408576698