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

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
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 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
461 lte_portal_reachable_ = portal_reachable; 457 lte_portal_reachable_ = portal_reachable;
462 } 458 }
463 459
464 void MobileSetupHandler::GetDeviceInfo(CellularNetwork* network, 460 void MobileSetupHandler::GetDeviceInfo(CellularNetwork* network,
465 DictionaryValue* value) { 461 DictionaryValue* value) {
466 DCHECK(network); 462 DCHECK(network);
467 chromeos::NetworkLibrary* cros = 463 chromeos::NetworkLibrary* cros =
468 chromeos::CrosLibrary::Get()->GetNetworkLibrary(); 464 chromeos::CrosLibrary::Get()->GetNetworkLibrary();
469 if (!cros) 465 if (!cros)
470 return; 466 return;
467 value->SetBoolean("activate_over_non_cellular_network",
468 network->activate_over_non_cellular_network());
471 value->SetString("carrier", network->name()); 469 value->SetString("carrier", network->name());
472 value->SetString("payment_url", network->payment_url()); 470 value->SetString("payment_url", network->payment_url());
473 if (network->using_post() && network->post_data().length()) 471 if (network->using_post() && network->post_data().length())
474 value->SetString("post_data", network->post_data()); 472 value->SetString("post_data", network->post_data());
475 473
476 const chromeos::NetworkDevice* device = 474 const chromeos::NetworkDevice* device =
477 cros->FindNetworkDeviceByPath(network->device_path()); 475 cros->FindNetworkDeviceByPath(network->device_path());
478 if (device) { 476 if (device) {
479 value->SetString("MEID", device->meid()); 477 value->SetString("MEID", device->meid());
480 value->SetString("IMEI", device->imei()); 478 value->SetString("IMEI", device->imei());
(...skipping 14 matching lines...) Expand all
495 493
496 // Set up the chrome://mobilesetup/ source. 494 // Set up the chrome://mobilesetup/ source.
497 Profile* profile = Profile::FromWebUI(web_ui); 495 Profile* profile = Profile::FromWebUI(web_ui);
498 content::URLDataSource::Add(profile, html_source); 496 content::URLDataSource::Add(profile, html_source);
499 } 497 }
500 498
501 void MobileSetupUI::RenderViewCreated(RenderViewHost* host) { 499 void MobileSetupUI::RenderViewCreated(RenderViewHost* host) {
502 // Destroyed by the corresponding RenderViewHost 500 // Destroyed by the corresponding RenderViewHost
503 new PortalFrameLoadObserver(AsWeakPtr(), host); 501 new PortalFrameLoadObserver(AsWeakPtr(), host);
504 } 502 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698