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

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

Issue 15937008: Unify ActivateCellular into network_connect.cc (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 7 years, 7 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
« no previous file with comments | « chrome/browser/ui/ash/chrome_shell_delegate_views.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 a86e41adfa51be4dc014188e38e9939375dc7dc5..43fdc6b03d89e1cead86d8b8c3bcbbfc17d9ec69 100644
--- a/chrome/browser/ui/webui/options/chromeos/internet_options_handler.cc
+++ b/chrome/browser/ui/webui/options/chromeos/internet_options_handler.cc
@@ -533,26 +533,6 @@ void PopulateVPNDetails(
hostname_ui_data);
}
-// Activate the cellular device pointed to by the service path.
-void Activate(std::string service_path) {
- chromeos::Network* network = NULL;
- if (!service_path.empty()) {
- network = chromeos::CrosLibrary::Get()->GetNetworkLibrary()->
- FindNetworkByPath(service_path);
- } else {
- NOTREACHED();
- return;
- }
-
- if (network->type() != chromeos::TYPE_CELLULAR)
- return;
-
- chromeos::CellularNetwork* cellular =
- static_cast<chromeos::CellularNetwork*>(network);
- if (cellular->activation_state() != chromeos::ACTIVATION_STATE_ACTIVATED)
- cellular->StartActivation();
-}
-
// Given a list of supported carrier's by the device, return the index of
// the carrier the device is currently using.
int FindCurrentCarrierIndex(const base::ListValue* carriers,
@@ -923,12 +903,7 @@ void InternetOptionsHandler::ShowMorePlanInfoCallback(const ListValue* args) {
NOTREACHED();
return;
}
-
- const chromeos::CellularNetwork* cellular =
- cros_->FindCellularNetworkByPath(service_path);
- if (!cellular)
- return;
- ash::Shell::GetInstance()->delegate()->OpenMobileSetup(service_path);
+ chromeos::network_connect::ShowMobileSetup(service_path);
}
void InternetOptionsHandler::BuyDataPlanCallback(const ListValue* args) {
@@ -940,7 +915,7 @@ void InternetOptionsHandler::BuyDataPlanCallback(const ListValue* args) {
NOTREACHED();
return;
}
- ash::Shell::GetInstance()->delegate()->OpenMobileSetup(service_path);
+ chromeos::network_connect::ShowMobileSetup(service_path);
}
void InternetOptionsHandler::SetApnCallback(const ListValue* args) {
@@ -971,7 +946,7 @@ void InternetOptionsHandler::CarrierStatusCallback(
const std::string& error_message) {
if ((error == chromeos::NETWORK_METHOD_ERROR_NONE) &&
cros_->CellularDeviceUsesDirectActivation()) {
- Activate(service_path);
+ chromeos::network_connect::ActivateCellular(service_path);
UpdateConnectionData(cros_->FindNetworkByPath(service_path));
}
@@ -1667,17 +1642,10 @@ void InternetOptionsHandler::NetworkCommandCallback(const ListValue* args) {
} else if (command == kTagDisconnect && type != chromeos::TYPE_ETHERNET) {
cros_->DisconnectFromNetwork(network);
} else if (command == kTagActivate && type == chromeos::TYPE_CELLULAR) {
- if (!cros_->CellularDeviceUsesDirectActivation()) {
- ash::Shell::GetInstance()->delegate()->OpenMobileSetup(
- network->service_path());
- } else {
- Activate(service_path);
- // Update network properties after we start activation. The Activate
- // call is a blocking call, which blocks on finishing the "start" of
- // the activation, hence when we query for network properties after
- // this call is done, we will have the "activating" activation state.
- UpdateConnectionData(network);
- }
+ chromeos::network_connect::ActivateCellular(service_path);
+ // Activation may update network properties (e.g. ActivationState), so
+ // request them here in case they change.
+ UpdateConnectionData(network);
} else {
VLOG(1) << "Unknown command: " << command;
NOTREACHED();
« no previous file with comments | « chrome/browser/ui/ash/chrome_shell_delegate_views.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698