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

Side by Side Diff: chrome/browser/ui/webui/chromeos/mobile_setup_ui.cc

Issue 12597010: Update activation flow for lte devices not to show 3G loading page. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 7 years, 9 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/resources/chromeos/mobile_setup.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/ui/webui/chromeos/mobile_setup_ui.h" 5 #include "chrome/browser/ui/webui/chromeos/mobile_setup_ui.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <map> 8 #include <map>
9 #include <string> 9 #include <string>
10 10
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 233
234 if (!network || (!network->SupportsActivation() && !network->activated())) { 234 if (!network || (!network->SupportsActivation() && !network->activated())) {
235 LOG(WARNING) << "Can't find device to activate for service path " << path; 235 LOG(WARNING) << "Can't find device to activate for service path " << path;
236 scoped_refptr<base::RefCountedBytes> html_bytes(new base::RefCountedBytes); 236 scoped_refptr<base::RefCountedBytes> html_bytes(new base::RefCountedBytes);
237 callback.Run(html_bytes); 237 callback.Run(html_bytes);
238 return; 238 return;
239 } 239 }
240 240
241 LOG(WARNING) << "Starting mobile setup for " << path; 241 LOG(WARNING) << "Starting mobile setup for " << path;
242 DictionaryValue strings; 242 DictionaryValue strings;
243 // The webui differs based on whether the network is activated or not. If the
244 // network is activated, the webui goes straight to portal. Otherwise the
245 // webui is used for activation flow.
246 if (network->activated()) {
247 strings.SetString("portal_unreachable_header",
248 l10n_util::GetStringUTF16(IDS_MOBILE_NO_CONNECTION_HEADER));
249 } else {
250 strings.SetString("connecting_header",
251 l10n_util::GetStringFUTF16(IDS_MOBILE_CONNECTING_HEADER,
252 network ? UTF8ToUTF16(network->name()) : string16()));
253 strings.SetString("error_header",
254 l10n_util::GetStringUTF16(IDS_MOBILE_ERROR_HEADER));
255 strings.SetString("activating_header",
256 l10n_util::GetStringUTF16(IDS_MOBILE_ACTIVATING_HEADER));
257 strings.SetString("completed_header",
258 l10n_util::GetStringUTF16(IDS_MOBILE_COMPLETED_HEADER));
259 strings.SetString("please_wait",
260 l10n_util::GetStringUTF16(IDS_MOBILE_PLEASE_WAIT));
261 strings.SetString("completed_text",
262 l10n_util::GetStringUTF16(IDS_MOBILE_COMPLETED_TEXT));
263 }
264 243
265 // Strings shared between both webui versions. 244 strings.SetString("connecting_header",
245 l10n_util::GetStringFUTF16(IDS_MOBILE_CONNECTING_HEADER,
246 network ? UTF8ToUTF16(network->name()) : string16()));
247 strings.SetString("error_header",
248 l10n_util::GetStringUTF16(IDS_MOBILE_ERROR_HEADER));
249 strings.SetString("activating_header",
250 l10n_util::GetStringUTF16(IDS_MOBILE_ACTIVATING_HEADER));
251 strings.SetString("completed_header",
252 l10n_util::GetStringUTF16(IDS_MOBILE_COMPLETED_HEADER));
253 strings.SetString("please_wait",
254 l10n_util::GetStringUTF16(IDS_MOBILE_PLEASE_WAIT));
255 strings.SetString("completed_text",
256 l10n_util::GetStringUTF16(IDS_MOBILE_COMPLETED_TEXT));
257 strings.SetString("portal_unreachable_header",
258 l10n_util::GetStringUTF16(IDS_MOBILE_NO_CONNECTION_HEADER));
266 strings.SetString("title", l10n_util::GetStringUTF16(IDS_MOBILE_SETUP_TITLE)); 259 strings.SetString("title", l10n_util::GetStringUTF16(IDS_MOBILE_SETUP_TITLE));
267 strings.SetString("close_button", 260 strings.SetString("close_button",
268 l10n_util::GetStringUTF16(IDS_CLOSE)); 261 l10n_util::GetStringUTF16(IDS_CLOSE));
269 strings.SetString("cancel_button", 262 strings.SetString("cancel_button",
270 l10n_util::GetStringUTF16(IDS_CANCEL)); 263 l10n_util::GetStringUTF16(IDS_CANCEL));
271 strings.SetString("ok_button", 264 strings.SetString("ok_button",
272 l10n_util::GetStringUTF16(IDS_OK)); 265 l10n_util::GetStringUTF16(IDS_OK));
273 webui::SetFontAndTextDirection(&strings); 266 webui::SetFontAndTextDirection(&strings);
274 267
268 // The webui differs based on whether the network is activated or not. If the
269 // network is activated, the webui goes straight to portal. Otherwise the
270 // webui is used for activation flow.
275 int html_page = network->activated() ? IDR_MOBILE_SETUP_PORTAL_PAGE_HTML : 271 int html_page = network->activated() ? IDR_MOBILE_SETUP_PORTAL_PAGE_HTML :
276 IDR_MOBILE_SETUP_PAGE_HTML; 272 IDR_MOBILE_SETUP_PAGE_HTML;
277 static const base::StringPiece html( 273 static const base::StringPiece html(
278 ResourceBundle::GetSharedInstance().GetRawDataResource(html_page)); 274 ResourceBundle::GetSharedInstance().GetRawDataResource(html_page));
279 275
280 std::string full_html = webui::GetI18nTemplateHtml(html, &strings); 276 std::string full_html = webui::GetI18nTemplateHtml(html, &strings);
281 277
282 callback.Run(base::RefCountedString::TakeString(&full_html)); 278 callback.Run(base::RefCountedString::TakeString(&full_html));
283 } 279 }
284 280
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
398 CellularNetwork* network = 394 CellularNetwork* network =
399 network_lib->FindCellularNetworkByPath(path.substr(1)); 395 network_lib->FindCellularNetworkByPath(path.substr(1));
400 if (!network) { 396 if (!network) {
401 web_ui()->GetWebContents()->Close(); 397 web_ui()->GetWebContents()->Close();
402 return; 398 return;
403 } 399 }
404 400
405 // If this is the initial call, update the network status and start observing 401 // If this is the initial call, update the network status and start observing
406 // network changes, but only for LTE networks. The other networks should 402 // network changes, but only for LTE networks. The other networks should
407 // ignore network status. 403 // ignore network status.
408 if (type_ == TYPE_UNDETERMINED && 404 if (type_ == TYPE_UNDETERMINED) {
409 (network->network_technology() == chromeos::NETWORK_TECHNOLOGY_LTE || 405 if (network->network_technology() == chromeos::NETWORK_TECHNOLOGY_LTE ||
410 network->network_technology() == 406 network->network_technology() ==
411 chromeos::NETWORK_TECHNOLOGY_LTE_ADVANCED)) { 407 chromeos::NETWORK_TECHNOLOGY_LTE_ADVANCED) {
412 type_ = TYPE_PORTAL_LTE; 408 type_ = TYPE_PORTAL_LTE;
413 network_lib->AddNetworkManagerObserver(this); 409 network_lib->AddNetworkManagerObserver(this);
414 // Update the network status and notify the webui. This is the initial 410 // Update the network status and notify the webui. This is the initial
415 // network state so the webui should be notified no matter what. 411 // network state so the webui should be notified no matter what.
416 UpdatePortalReachability(network_lib, network, true /*force notification*/); 412 UpdatePortalReachability(network_lib,
417 } else { 413 network,
418 type_ = TYPE_PORTAL; 414 true /*force notification*/);
415 } else {
416 type_ = TYPE_PORTAL;
417 // For non-LTE networks network state is ignored, so report the portal is
418 // reachable, so it gets shown.
419 web_ui()->CallJavascriptFunction(kJsConnectivityChangedCallback,
420 base::FundamentalValue(true));
421 }
419 } 422 }
420 423
421 DictionaryValue device_info; 424 DictionaryValue device_info;
422 GetDeviceInfo(network, &device_info); 425 GetDeviceInfo(network, &device_info);
423 web_ui()->CallJavascriptFunction(kJsGetDeviceInfoCallback, device_info); 426 web_ui()->CallJavascriptFunction(kJsGetDeviceInfoCallback, device_info);
424 } 427 }
425 428
426 void MobileSetupHandler::OnNetworkManagerChanged(NetworkLibrary* network_lib) { 429 void MobileSetupHandler::OnNetworkManagerChanged(NetworkLibrary* network_lib) {
427 if (!web_ui()) 430 if (!web_ui())
428 return; 431 return;
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
461 lte_portal_reachable_ = portal_reachable; 464 lte_portal_reachable_ = portal_reachable;
462 } 465 }
463 466
464 void MobileSetupHandler::GetDeviceInfo(CellularNetwork* network, 467 void MobileSetupHandler::GetDeviceInfo(CellularNetwork* network,
465 DictionaryValue* value) { 468 DictionaryValue* value) {
466 DCHECK(network); 469 DCHECK(network);
467 chromeos::NetworkLibrary* cros = 470 chromeos::NetworkLibrary* cros =
468 chromeos::CrosLibrary::Get()->GetNetworkLibrary(); 471 chromeos::CrosLibrary::Get()->GetNetworkLibrary();
469 if (!cros) 472 if (!cros)
470 return; 473 return;
474 value->SetBoolean("activate_over_non_cellular_network",
475 network->activate_over_non_cellular_network());
471 value->SetString("carrier", network->name()); 476 value->SetString("carrier", network->name());
472 value->SetString("payment_url", network->payment_url()); 477 value->SetString("payment_url", network->payment_url());
473 if (network->using_post() && network->post_data().length()) 478 if (network->using_post() && network->post_data().length())
474 value->SetString("post_data", network->post_data()); 479 value->SetString("post_data", network->post_data());
475 480
476 const chromeos::NetworkDevice* device = 481 const chromeos::NetworkDevice* device =
477 cros->FindNetworkDeviceByPath(network->device_path()); 482 cros->FindNetworkDeviceByPath(network->device_path());
478 if (device) { 483 if (device) {
479 value->SetString("MEID", device->meid()); 484 value->SetString("MEID", device->meid());
480 value->SetString("IMEI", device->imei()); 485 value->SetString("IMEI", device->imei());
(...skipping 14 matching lines...) Expand all
495 500
496 // Set up the chrome://mobilesetup/ source. 501 // Set up the chrome://mobilesetup/ source.
497 Profile* profile = Profile::FromWebUI(web_ui); 502 Profile* profile = Profile::FromWebUI(web_ui);
498 content::URLDataSource::Add(profile, html_source); 503 content::URLDataSource::Add(profile, html_source);
499 } 504 }
500 505
501 void MobileSetupUI::RenderViewCreated(RenderViewHost* host) { 506 void MobileSetupUI::RenderViewCreated(RenderViewHost* host) {
502 // Destroyed by the corresponding RenderViewHost 507 // Destroyed by the corresponding RenderViewHost
503 new PortalFrameLoadObserver(AsWeakPtr(), host); 508 new PortalFrameLoadObserver(AsWeakPtr(), host);
504 } 509 }
OLDNEW
« no previous file with comments | « chrome/browser/resources/chromeos/mobile_setup.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698