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

Unified Diff: chrome/browser/ui/webui/options/chromeos/internet_options_handler.cc

Issue 700383008: Use setProperties for Cellular APN (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@issue_430113_internet_options_2
Patch Set: Created 6 years, 1 month 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/ui/webui/options/chromeos/internet_options_handler.cc
diff --git a/chrome/browser/ui/webui/options/chromeos/internet_options_handler.cc b/chrome/browser/ui/webui/options/chromeos/internet_options_handler.cc
index fc1ef302d75dfdcea4542f3723aee3e42e038d2e..a58ea2919e8b52c46a04a6851f46e3d14630fbe9 100644
--- a/chrome/browser/ui/webui/options/chromeos/internet_options_handler.cc
+++ b/chrome/browser/ui/webui/options/chromeos/internet_options_handler.cc
@@ -34,7 +34,6 @@
#include "chromeos/login/login_state.h"
#include "chromeos/network/device_state.h"
#include "chromeos/network/managed_network_configuration_handler.h"
-#include "chromeos/network/network_configuration_handler.h"
pneubeck (no reviews) 2014/12/01 13:54:10 yuhuu!
stevenjb 2015/01/09 20:10:59 :)
#include "chromeos/network/network_connection_handler.h"
#include "chromeos/network/network_device_handler.h"
#include "chromeos/network/network_event_log.h"
@@ -88,7 +87,6 @@ const char kUpdateCarrierFunction[] =
// Setter methods called from JS that still need to be converted to match
// networkingPrivate methods.
-const char kSetApnMessage[] = "setApn";
const char kSetCarrierMessage[] = "setCarrier";
const char kShowMorePlanInfoMessage[] = "showMorePlanInfo";
const char kSimOperationMessage[] = "simOperation";
@@ -283,9 +281,6 @@ void InternetOptionsHandler::RegisterMessages() {
web_ui()->RegisterMessageCallback(kShowMorePlanInfoMessage,
base::Bind(&InternetOptionsHandler::ShowMorePlanInfoCallback,
base::Unretained(this)));
- web_ui()->RegisterMessageCallback(kSetApnMessage,
- base::Bind(&InternetOptionsHandler::SetApnCallback,
- base::Unretained(this)));
web_ui()->RegisterMessageCallback(kSetCarrierMessage,
base::Bind(&InternetOptionsHandler::SetCarrierCallback,
base::Unretained(this)));
@@ -329,64 +324,6 @@ void InternetOptionsHandler::ShowMorePlanInfoCallback(
ui::NetworkConnect::Get()->ShowMobileSetup(service_path);
}
-void InternetOptionsHandler::SetApnCallback(const base::ListValue* args) {
- std::string service_path;
- if (!args->GetString(0, &service_path)) {
- NOTREACHED();
- return;
- }
- NetworkHandler::Get()->network_configuration_handler()->GetProperties(
- service_path,
- base::Bind(&InternetOptionsHandler::SetApnProperties,
- weak_factory_.GetWeakPtr(), base::Owned(args->DeepCopy())),
- base::Bind(&ShillError, "SetApnCallback"));
-}
-
-void InternetOptionsHandler::SetApnProperties(
- const base::ListValue* args,
- const std::string& service_path,
- const base::DictionaryValue& shill_properties) {
- std::string apn, username, password;
- if (!args->GetString(1, &apn) ||
- !args->GetString(2, &username) ||
- !args->GetString(3, &password)) {
- NOTREACHED();
- return;
- }
- NET_LOG_EVENT("SetApnCallback", service_path);
-
- if (apn.empty()) {
- std::vector<std::string> properties_to_clear;
- properties_to_clear.push_back(shill::kCellularApnProperty);
- NetworkHandler::Get()->network_configuration_handler()->ClearProperties(
- service_path, properties_to_clear,
- base::Bind(&base::DoNothing),
- base::Bind(&ShillError, "ClearCellularApnProperties"));
- return;
- }
-
- const base::DictionaryValue* shill_apn_dict = NULL;
- std::string network_id;
- if (shill_properties.GetDictionaryWithoutPathExpansion(
- shill::kCellularApnProperty, &shill_apn_dict)) {
- shill_apn_dict->GetStringWithoutPathExpansion(
- shill::kApnNetworkIdProperty, &network_id);
- }
- base::DictionaryValue properties;
- base::DictionaryValue* apn_dict = new base::DictionaryValue;
- apn_dict->SetStringWithoutPathExpansion(shill::kApnProperty, apn);
- apn_dict->SetStringWithoutPathExpansion(shill::kApnNetworkIdProperty,
- network_id);
- apn_dict->SetStringWithoutPathExpansion(shill::kApnUsernameProperty,
- username);
- apn_dict->SetStringWithoutPathExpansion(shill::kApnPasswordProperty,
- password);
- properties.SetWithoutPathExpansion(shill::kCellularApnProperty, apn_dict);
- NetworkHandler::Get()->network_configuration_handler()->SetProperties(
- service_path, properties,
- base::Bind(&base::DoNothing),
- base::Bind(&ShillError, "SetApnProperties"));
-}
void InternetOptionsHandler::CarrierStatusCallback() {
NetworkStateHandler* handler = NetworkHandler::Get()->network_state_handler();

Powered by Google App Engine
This is Rietveld 408576698