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

Unified Diff: chrome/browser/ui/webui/options2/chromeos/internet_options_handler2.cc

Issue 10201015: [cros] Add network tray item for mobile network setup. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: nit Created 8 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
« no previous file with comments | « chrome/browser/ui/webui/options2/chromeos/internet_options_handler2.h ('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/options2/chromeos/internet_options_handler2.cc
diff --git a/chrome/browser/ui/webui/options2/chromeos/internet_options_handler2.cc b/chrome/browser/ui/webui/options2/chromeos/internet_options_handler2.cc
index f3440f072c5acd01a361245eac54cade3322f7d8..2497c7bb1ea3a66e71a4cd7ad5217675c0944d81 100644
--- a/chrome/browser/ui/webui/options2/chromeos/internet_options_handler2.cc
+++ b/chrome/browser/ui/webui/options2/chromeos/internet_options_handler2.cc
@@ -37,6 +37,7 @@
#include "chrome/browser/chromeos/status/network_menu_icon.h"
#include "chrome/browser/net/pref_proxy_config_tracker.h"
#include "chrome/browser/profiles/profile.h"
+#include "chrome/browser/profiles/profile_manager.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_list.h"
#include "chrome/browser/ui/browser_window.h"
@@ -501,13 +502,29 @@ void InternetOptionsHandler::DisableWifiCallback(const ListValue* args) {
}
void InternetOptionsHandler::EnableCellularCallback(const ListValue* args) {
+ // TODO(nkostylev): Code duplication, see NetworkMenu::ToggleCellular().
const chromeos::NetworkDevice* cellular = cros_->FindCellularDevice();
if (!cellular) {
LOG(ERROR) << "Didn't find cellular device, it should have been available.";
cros_->EnableCellularNetworkDevice(true);
- } else if (cellular->sim_lock_state() == chromeos::SIM_UNLOCKED ||
- cellular->sim_lock_state() == chromeos::SIM_UNKNOWN) {
+ } else if (!cellular->is_sim_locked()) {
+ if (cellular->is_sim_absent()) {
+ std::string setup_url;
+ chromeos::MobileConfig* config = chromeos::MobileConfig::GetInstance();
+ if (config->IsReady()) {
+ const chromeos::MobileConfig::LocaleConfig* locale_config =
+ config->GetLocaleConfig();
+ if (locale_config)
+ setup_url = locale_config->setup_url();
+ }
+ if (!setup_url.empty()) {
+ GetAppropriateBrowser()->ShowSingletonTab(GURL(setup_url));
+ } else {
+ // TODO(nkostylev): Show generic error message. http://crosbug.com/15444
+ }
+ } else {
cros_->EnableCellularNetworkDevice(true);
+ }
} else {
chromeos::SimDialogDelegate::ShowDialog(GetNativeWindow(),
chromeos::SimDialogDelegate::SIM_DIALOG_UNLOCK);
@@ -1048,6 +1065,11 @@ gfx::NativeWindow InternetOptionsHandler::GetNativeWindow() const {
return browser->window()->GetNativeHandle();
}
+Browser* InternetOptionsHandler::GetAppropriateBrowser() {
+ return Browser::GetOrCreateTabbedBrowser(
+ ProfileManager::GetDefaultProfileOrOffTheRecord());
+}
+
void InternetOptionsHandler::ButtonClickCallback(const ListValue* args) {
std::string str_type;
std::string service_path;
« no previous file with comments | « chrome/browser/ui/webui/options2/chromeos/internet_options_handler2.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698