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

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

Issue 14753003: Don't open mobile setup when activating Sprint network from network menu (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 8 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: 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 70e4e890048b5fb86320deaf7ce8c8b1a7051b08..60aa1b307b5cd090ee673ed78de69a3735219dbb 100644
--- a/chrome/browser/ui/webui/options/chromeos/internet_options_handler.cc
+++ b/chrome/browser/ui/webui/options/chromeos/internet_options_handler.cc
@@ -550,15 +550,6 @@ void Activate(std::string service_path) {
cellular->StartActivation();
}
-// Check if the current cellular device can be activated by directly calling
-// it's activate function instead of going through the activation process.
-// Note: Currently Sprint is the only carrier that uses this.
-bool UseDirectActivation() {
- const chromeos::NetworkDevice* device =
- chromeos::CrosLibrary::Get()->GetNetworkLibrary()->FindCellularDevice();
- return device && (device->carrier() == shill::kCarrierSprint);
-}
-
// 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,
@@ -961,10 +952,13 @@ void InternetOptionsHandler::CarrierStatusCallback(
const std::string& service_path,
chromeos::NetworkMethodErrorType error,
const std::string& error_message) {
- if ((error == chromeos::NETWORK_METHOD_ERROR_NONE) &&
- UseDirectActivation()) {
- Activate(service_path);
- UpdateConnectionData(cros_->FindNetworkByPath(service_path));
+ if ((error == chromeos::NETWORK_METHOD_ERROR_NONE)) {
+ chromeos::CellularNetwork* network =
+ cros_->FindCellularNetworkByPath(service_path);
+ if (network && network->UsesDirectActivation()) {
+ Activate(service_path);
+ UpdateConnectionData(network);
+ }
}
UpdateCarrier();
@@ -1654,16 +1648,18 @@ 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 (!UseDirectActivation()) {
+ chromeos::CellularNetwork* cellular =
+ static_cast<chromeos::CellularNetwork*>(network);
+ if (!cellular->UsesDirectActivation()) {
ash::Shell::GetInstance()->delegate()->OpenMobileSetup(
- network->service_path());
+ cellular->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);
+ UpdateConnectionData(cellular);
}
} else {
VLOG(1) << "Unknown command: " << command;

Powered by Google App Engine
This is Rietveld 408576698