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
3 // found in the LICENSE file.
5 #include "chrome/browser/ui/webui/chromeos/mobile_setup_ui.h"
11 #include "base/bind.h"
12 #include "base/bind_helpers.h"
13 #include "base/json/json_writer.h"
14 #include "base/logging.h"
15 #include "base/memory/ref_counted_memory.h"
16 #include "base/memory/weak_ptr.h"
17 #include "base/message_loop/message_loop.h"
18 #include "base/metrics/histogram.h"
19 #include "base/strings/string_piece.h"
20 #include "base/strings/string_util.h"
21 #include "base/strings/utf_string_conversions.h"
22 #include "base/values.h"
23 #include "chrome/browser/browser_process.h"
24 #include "chrome/browser/chromeos/mobile/mobile_activator.h"
25 #include "chrome/browser/profiles/profile.h"
26 #include "chrome/browser/ui/browser_list.h"
27 #include "chrome/common/url_constants.h"
28 #include "chrome/grit/generated_resources.h"
29 #include "chrome/grit/locale_settings.h"
30 #include "chromeos/network/device_state.h"
31 #include "chromeos/network/network_configuration_handler.h"
32 #include "chromeos/network/network_event_log.h"
33 #include "chromeos/network/network_state.h"
34 #include "chromeos/network/network_state_handler.h"
35 #include "chromeos/network/network_state_handler_observer.h"
36 #include "content/public/browser/browser_thread.h"
37 #include "content/public/browser/render_frame_host.h"
38 #include "content/public/browser/url_data_source.h"
39 #include "content/public/browser/web_contents.h"
40 #include "content/public/browser/web_ui.h"
41 #include "content/public/browser/web_ui_message_handler.h"
42 #include "grit/browser_resources.h"
43 #include "third_party/cros_system_api/dbus/service_constants.h"
44 #include "ui/base/l10n/l10n_util.h"
45 #include "ui/base/resource/resource_bundle.h"
46 #include "ui/base/webui/jstemplate_builder.h"
47 #include "ui/base/webui/web_ui_util.h"
50 using chromeos::MobileActivator
;
51 using chromeos::NetworkHandler
;
52 using chromeos::NetworkState
;
53 using content::BrowserThread
;
54 using content::RenderViewHost
;
55 using content::WebContents
;
56 using content::WebUIMessageHandler
;
60 // Host page JS API function names.
61 const char kJsApiStartActivation
[] = "startActivation";
62 const char kJsApiSetTransactionStatus
[] = "setTransactionStatus";
63 const char kJsApiPaymentPortalLoad
[] = "paymentPortalLoad";
64 const char kJsGetDeviceInfo
[] = "getDeviceInfo";
65 const char kJsApiResultOK
[] = "ok";
67 const char kJsDeviceStatusChangedCallback
[] =
68 "mobile.MobileSetup.deviceStateChanged";
69 const char kJsPortalFrameLoadFailedCallback
[] =
70 "mobile.MobileSetup.portalFrameLoadError";
71 const char kJsPortalFrameLoadCompletedCallback
[] =
72 "mobile.MobileSetup.portalFrameLoadCompleted";
73 const char kJsGetDeviceInfoCallback
[] =
74 "mobile.MobileSetupPortal.onGotDeviceInfo";
75 const char kJsConnectivityChangedCallback
[] =
76 "mobile.MobileSetupPortal.onConnectivityChanged";
78 void DataRequestFailed(
79 const std::string
& service_path
,
80 const content::URLDataSource::GotDataCallback
& callback
) {
81 NET_LOG_ERROR("Data Request Failed for Mobile Setup", service_path
);
82 scoped_refptr
<base::RefCountedBytes
> html_bytes(new base::RefCountedBytes
);
83 callback
.Run(html_bytes
.get());
86 // Converts the network properties into a JS object.
87 void GetDeviceInfo(const base::DictionaryValue
& properties
,
88 base::DictionaryValue
* value
) {
90 properties
.GetStringWithoutPathExpansion(shill::kNameProperty
, &name
);
91 std::string activation_type
;
92 properties
.GetStringWithoutPathExpansion(
93 shill::kActivationTypeProperty
,
95 const base::DictionaryValue
* payment_dict
;
96 std::string payment_url
, post_method
, post_data
;
97 if (properties
.GetDictionaryWithoutPathExpansion(
98 shill::kPaymentPortalProperty
, &payment_dict
)) {
99 payment_dict
->GetStringWithoutPathExpansion(
100 shill::kPaymentPortalURL
, &payment_url
);
101 payment_dict
->GetStringWithoutPathExpansion(
102 shill::kPaymentPortalMethod
, &post_method
);
103 payment_dict
->GetStringWithoutPathExpansion(
104 shill::kPaymentPortalPostData
, &post_data
);
107 value
->SetString("activation_type", activation_type
);
108 value
->SetString("carrier", name
);
109 value
->SetString("payment_url", payment_url
);
110 if (base::LowerCaseEqualsASCII(post_method
, "post") && !post_data
.empty())
111 value
->SetString("post_data", post_data
);
113 // Use the cached DeviceState properties.
114 std::string device_path
;
115 if (!properties
.GetStringWithoutPathExpansion(
116 shill::kDeviceProperty
, &device_path
) ||
117 device_path
.empty()) {
120 const chromeos::DeviceState
* device
=
121 NetworkHandler::Get()->network_state_handler()->GetDeviceState(
126 value
->SetString("MEID", device
->meid());
127 value
->SetString("IMEI", device
->imei());
128 value
->SetString("MDN", device
->mdn());
131 void SetActivationStateAndError(MobileActivator::PlanActivationState state
,
132 const std::string
& error_description
,
133 base::DictionaryValue
* value
) {
134 value
->SetInteger("state", state
);
135 if (!error_description
.empty())
136 value
->SetString("error", error_description
);
141 class MobileSetupUIHTMLSource
: public content::URLDataSource
{
143 MobileSetupUIHTMLSource();
145 // content::URLDataSource implementation.
146 std::string
GetSource() const override
;
147 void StartDataRequest(
148 const std::string
& path
,
149 int render_process_id
,
151 const content::URLDataSource::GotDataCallback
& callback
) override
;
152 std::string
GetMimeType(const std::string
&) const override
{
155 bool ShouldAddContentSecurityPolicy() const override
{ return false; }
158 ~MobileSetupUIHTMLSource() override
{}
160 void GetPropertiesAndStartDataRequest(
161 const content::URLDataSource::GotDataCallback
& callback
,
162 const std::string
& service_path
,
163 const base::DictionaryValue
& properties
);
164 void GetPropertiesFailure(
165 const content::URLDataSource::GotDataCallback
& callback
,
166 const std::string
& service_path
,
167 const std::string
& error_name
,
168 scoped_ptr
<base::DictionaryValue
> error_data
);
170 base::WeakPtrFactory
<MobileSetupUIHTMLSource
> weak_ptr_factory_
;
172 DISALLOW_COPY_AND_ASSIGN(MobileSetupUIHTMLSource
);
175 // The handler for Javascript messages related to the "register" view.
176 class MobileSetupHandler
177 : public WebUIMessageHandler
,
178 public MobileActivator::Observer
,
179 public chromeos::NetworkStateHandlerObserver
,
180 public base::SupportsWeakPtr
<MobileSetupHandler
> {
182 MobileSetupHandler();
183 ~MobileSetupHandler() override
;
185 // WebUIMessageHandler implementation.
186 void RegisterMessages() override
;
191 // The network is not yet activated, and the webui is in activation flow.
193 // The network is activated, the webui displays network portal.
195 // Same as TYPE_PORTAL, but the network technology is LTE. The webui is
196 // additionally aware of network manager state and whether the portal can be
201 // MobileActivator::Observer.
202 void OnActivationStateChanged(const NetworkState
* network
,
203 MobileActivator::PlanActivationState new_state
,
204 const std::string
& error_description
) override
;
206 // Callbacks for NetworkConfigurationHandler::GetProperties.
207 void GetPropertiesAndCallStatusChanged(
208 MobileActivator::PlanActivationState state
,
209 const std::string
& error_description
,
210 const std::string
& service_path
,
211 const base::DictionaryValue
& properties
);
212 void GetPropertiesAndCallGetDeviceInfo(
213 const std::string
& service_path
,
214 const base::DictionaryValue
& properties
);
215 void GetPropertiesFailure(
216 const std::string
& service_path
,
217 const std::string
& callback_name
,
218 const std::string
& error_name
,
219 scoped_ptr
<base::DictionaryValue
> error_data
);
221 // Handlers for JS WebUI messages.
222 void HandleSetTransactionStatus(const base::ListValue
* args
);
223 void HandleStartActivation(const base::ListValue
* args
);
224 void HandlePaymentPortalLoad(const base::ListValue
* args
);
225 void HandleGetDeviceInfo(const base::ListValue
* args
);
227 // NetworkStateHandlerObserver implementation.
228 void NetworkConnectionStateChanged(const NetworkState
* network
) override
;
229 void DefaultNetworkChanged(const NetworkState
* default_network
) override
;
231 // Updates |lte_portal_reachable_| for lte network |network| and notifies
232 // webui of the new state if the reachability changed or |force_notification|
234 void UpdatePortalReachability(const NetworkState
* network
,
235 bool force_notification
);
237 // Sends message to host registration page with system/user info data.
238 void SendDeviceInfo();
240 // Type of the mobilesetup webui deduced from received messages.
242 // Whether portal page for lte networks can be reached in current network
243 // connection state. This value is reflected in portal webui for lte networks.
244 // Initial value is true.
245 bool lte_portal_reachable_
;
246 base::WeakPtrFactory
<MobileSetupHandler
> weak_ptr_factory_
;
248 DISALLOW_COPY_AND_ASSIGN(MobileSetupHandler
);
251 ////////////////////////////////////////////////////////////////////////////////
253 // MobileSetupUIHTMLSource
255 ////////////////////////////////////////////////////////////////////////////////
257 MobileSetupUIHTMLSource::MobileSetupUIHTMLSource()
258 : weak_ptr_factory_(this) {
261 std::string
MobileSetupUIHTMLSource::GetSource() const {
262 return chrome::kChromeUIMobileSetupHost
;
265 void MobileSetupUIHTMLSource::StartDataRequest(
266 const std::string
& path
,
267 int render_process_id
,
269 const content::URLDataSource::GotDataCallback
& callback
) {
270 NetworkHandler::Get()->network_configuration_handler()->GetShillProperties(
272 base::Bind(&MobileSetupUIHTMLSource::GetPropertiesAndStartDataRequest
,
273 weak_ptr_factory_
.GetWeakPtr(), callback
),
274 base::Bind(&MobileSetupUIHTMLSource::GetPropertiesFailure
,
275 weak_ptr_factory_
.GetWeakPtr(), callback
, path
));
278 void MobileSetupUIHTMLSource::GetPropertiesAndStartDataRequest(
279 const content::URLDataSource::GotDataCallback
& callback
,
280 const std::string
& service_path
,
281 const base::DictionaryValue
& properties
) {
282 const base::DictionaryValue
* payment_dict
;
283 std::string name
, usage_url
, activation_state
, payment_url
;
284 if (!properties
.GetStringWithoutPathExpansion(
285 shill::kNameProperty
, &name
) ||
286 !properties
.GetStringWithoutPathExpansion(
287 shill::kUsageURLProperty
, &usage_url
) ||
288 !properties
.GetStringWithoutPathExpansion(
289 shill::kActivationStateProperty
, &activation_state
) ||
290 !properties
.GetDictionaryWithoutPathExpansion(
291 shill::kPaymentPortalProperty
, &payment_dict
) ||
292 !payment_dict
->GetStringWithoutPathExpansion(
293 shill::kPaymentPortalURL
, &payment_url
)) {
294 DataRequestFailed(service_path
, callback
);
298 if (payment_url
.empty() && usage_url
.empty() &&
299 activation_state
!= shill::kActivationStateActivated
) {
300 DataRequestFailed(service_path
, callback
);
304 NET_LOG_EVENT("Starting mobile setup", service_path
);
305 base::DictionaryValue strings
;
307 strings
.SetString("connecting_header",
308 l10n_util::GetStringFUTF16(IDS_MOBILE_CONNECTING_HEADER
,
309 base::UTF8ToUTF16(name
)));
310 strings
.SetString("error_header",
311 l10n_util::GetStringUTF16(IDS_MOBILE_ERROR_HEADER
));
312 strings
.SetString("activating_header",
313 l10n_util::GetStringUTF16(IDS_MOBILE_ACTIVATING_HEADER
));
314 strings
.SetString("completed_header",
315 l10n_util::GetStringUTF16(IDS_MOBILE_COMPLETED_HEADER
));
316 strings
.SetString("please_wait",
317 l10n_util::GetStringUTF16(IDS_MOBILE_PLEASE_WAIT
));
318 strings
.SetString("completed_text",
319 l10n_util::GetStringUTF16(IDS_MOBILE_COMPLETED_TEXT
));
320 strings
.SetString("portal_unreachable_header",
321 l10n_util::GetStringUTF16(IDS_MOBILE_NO_CONNECTION_HEADER
));
322 strings
.SetString("invalid_device_info_header",
323 l10n_util::GetStringUTF16(IDS_MOBILE_INVALID_DEVICE_INFO_HEADER
));
324 strings
.SetString("title", l10n_util::GetStringUTF16(IDS_MOBILE_SETUP_TITLE
));
325 strings
.SetString("close_button",
326 l10n_util::GetStringUTF16(IDS_CLOSE
));
327 strings
.SetString("cancel_button",
328 l10n_util::GetStringUTF16(IDS_CANCEL
));
329 strings
.SetString("ok_button",
330 l10n_util::GetStringUTF16(IDS_OK
));
332 const std::string
& app_locale
= g_browser_process
->GetApplicationLocale();
333 webui::SetLoadTimeDataDefaults(app_locale
, &strings
);
335 // The webui differs based on whether the network is activated or not. If the
336 // network is activated, the webui goes straight to portal. Otherwise the
337 // webui is used for activation flow.
338 std::string full_html
;
339 if (activation_state
== shill::kActivationStateActivated
) {
340 static const base::StringPiece
html_for_activated(
341 ResourceBundle::GetSharedInstance().GetRawDataResource(
342 IDR_MOBILE_SETUP_PORTAL_PAGE_HTML
));
343 full_html
= webui::GetI18nTemplateHtml(html_for_activated
, &strings
);
345 static const base::StringPiece
html_for_non_activated(
346 ResourceBundle::GetSharedInstance().GetRawDataResource(
347 IDR_MOBILE_SETUP_PAGE_HTML
));
348 full_html
= webui::GetI18nTemplateHtml(html_for_non_activated
, &strings
);
351 callback
.Run(base::RefCountedString::TakeString(&full_html
));
354 void MobileSetupUIHTMLSource::GetPropertiesFailure(
355 const content::URLDataSource::GotDataCallback
& callback
,
356 const std::string
& service_path
,
357 const std::string
& error_name
,
358 scoped_ptr
<base::DictionaryValue
> error_data
) {
359 DataRequestFailed(service_path
, callback
);
362 ////////////////////////////////////////////////////////////////////////////////
364 // MobileSetupHandler
366 ////////////////////////////////////////////////////////////////////////////////
367 MobileSetupHandler::MobileSetupHandler()
368 : type_(TYPE_UNDETERMINED
),
369 lte_portal_reachable_(true),
370 weak_ptr_factory_(this) {
373 MobileSetupHandler::~MobileSetupHandler() {
374 if (type_
== TYPE_ACTIVATION
) {
375 MobileActivator::GetInstance()->RemoveObserver(this);
376 MobileActivator::GetInstance()->TerminateActivation();
377 } else if (type_
== TYPE_PORTAL_LTE
) {
378 NetworkHandler::Get()->network_state_handler()->RemoveObserver(this,
383 void MobileSetupHandler::OnActivationStateChanged(
384 const NetworkState
* network
,
385 MobileActivator::PlanActivationState state
,
386 const std::string
& error_description
) {
387 DCHECK_EQ(TYPE_ACTIVATION
, type_
);
392 base::DictionaryValue device_dict
;
393 SetActivationStateAndError(state
, error_description
, &device_dict
);
394 web_ui()->CallJavascriptFunction(kJsDeviceStatusChangedCallback
,
399 NetworkHandler::Get()->network_configuration_handler()->GetShillProperties(
401 base::Bind(&MobileSetupHandler::GetPropertiesAndCallStatusChanged
,
402 weak_ptr_factory_
.GetWeakPtr(), state
, error_description
),
403 base::Bind(&MobileSetupHandler::GetPropertiesFailure
,
404 weak_ptr_factory_
.GetWeakPtr(), network
->path(),
405 kJsDeviceStatusChangedCallback
));
408 void MobileSetupHandler::GetPropertiesAndCallStatusChanged(
409 MobileActivator::PlanActivationState state
,
410 const std::string
& error_description
,
411 const std::string
& service_path
,
412 const base::DictionaryValue
& properties
) {
413 base::DictionaryValue device_dict
;
414 GetDeviceInfo(properties
, &device_dict
);
415 SetActivationStateAndError(state
, error_description
, &device_dict
);
416 web_ui()->CallJavascriptFunction(kJsDeviceStatusChangedCallback
, device_dict
);
419 void MobileSetupHandler::RegisterMessages() {
420 web_ui()->RegisterMessageCallback(kJsApiStartActivation
,
421 base::Bind(&MobileSetupHandler::HandleStartActivation
,
422 base::Unretained(this)));
423 web_ui()->RegisterMessageCallback(kJsApiSetTransactionStatus
,
424 base::Bind(&MobileSetupHandler::HandleSetTransactionStatus
,
425 base::Unretained(this)));
426 web_ui()->RegisterMessageCallback(kJsApiPaymentPortalLoad
,
427 base::Bind(&MobileSetupHandler::HandlePaymentPortalLoad
,
428 base::Unretained(this)));
429 web_ui()->RegisterMessageCallback(kJsGetDeviceInfo
,
430 base::Bind(&MobileSetupHandler::HandleGetDeviceInfo
,
431 base::Unretained(this)));
434 void MobileSetupHandler::HandleStartActivation(const base::ListValue
* args
) {
435 DCHECK_EQ(TYPE_UNDETERMINED
, type_
);
440 std::string path
= web_ui()->GetWebContents()->GetURL().path();
444 LOG(WARNING
) << "Starting activation for service " << path
;
446 type_
= TYPE_ACTIVATION
;
447 MobileActivator::GetInstance()->AddObserver(this);
448 MobileActivator::GetInstance()->InitiateActivation(path
.substr(1));
451 void MobileSetupHandler::HandleSetTransactionStatus(
452 const base::ListValue
* args
) {
453 DCHECK_EQ(TYPE_ACTIVATION
, type_
);
457 const size_t kSetTransactionStatusParamCount
= 1;
458 if (args
->GetSize() != kSetTransactionStatusParamCount
)
460 // Get change callback function name.
462 if (!args
->GetString(0, &status
))
465 MobileActivator::GetInstance()->OnSetTransactionStatus(
466 base::LowerCaseEqualsASCII(status
, kJsApiResultOK
));
469 void MobileSetupHandler::HandlePaymentPortalLoad(const base::ListValue
* args
) {
470 // Only activation flow webui is interested in these events.
471 if (type_
!= TYPE_ACTIVATION
|| !web_ui())
474 const size_t kPaymentPortalLoadParamCount
= 1;
475 if (args
->GetSize() != kPaymentPortalLoadParamCount
)
477 // Get change callback function name.
479 if (!args
->GetString(0, &result
))
482 MobileActivator::GetInstance()->OnPortalLoaded(
483 base::LowerCaseEqualsASCII(result
, kJsApiResultOK
));
486 void MobileSetupHandler::HandleGetDeviceInfo(const base::ListValue
* args
) {
487 DCHECK_NE(TYPE_ACTIVATION
, type_
);
491 std::string path
= web_ui()->GetWebContents()->GetURL().path();
495 chromeos::NetworkStateHandler
* nsh
=
496 NetworkHandler::Get()->network_state_handler();
497 // TODO: Figure out why the path has an extra '/' in the front. (e.g. It is
498 // '//service/5' instead of '/service/5'.
499 const NetworkState
* network
= nsh
->GetNetworkState(path
.substr(1));
501 web_ui()->GetWebContents()->Close();
505 // If this is the initial call, update the network status and start observing
506 // network changes, but only for LTE networks. The other networks should
507 // ignore network status.
508 if (type_
== TYPE_UNDETERMINED
) {
509 if (network
->network_technology() == shill::kNetworkTechnologyLte
||
510 network
->network_technology() == shill::kNetworkTechnologyLteAdvanced
) {
511 type_
= TYPE_PORTAL_LTE
;
512 nsh
->AddObserver(this, FROM_HERE
);
513 // Update the network status and notify the webui. This is the initial
514 // network state so the webui should be notified no matter what.
515 UpdatePortalReachability(network
,
516 true /* force notification */);
519 // For non-LTE networks network state is ignored, so report the portal is
520 // reachable, so it gets shown.
521 web_ui()->CallJavascriptFunction(kJsConnectivityChangedCallback
,
522 base::FundamentalValue(true));
526 NetworkHandler::Get()->network_configuration_handler()->GetShillProperties(
528 base::Bind(&MobileSetupHandler::GetPropertiesAndCallGetDeviceInfo
,
529 weak_ptr_factory_
.GetWeakPtr()),
530 base::Bind(&MobileSetupHandler::GetPropertiesFailure
,
531 weak_ptr_factory_
.GetWeakPtr(), network
->path(),
532 kJsGetDeviceInfoCallback
));
535 void MobileSetupHandler::GetPropertiesAndCallGetDeviceInfo(
536 const std::string
& service_path
,
537 const base::DictionaryValue
& properties
) {
538 base::DictionaryValue device_info
;
539 GetDeviceInfo(properties
, &device_info
);
540 web_ui()->CallJavascriptFunction(kJsGetDeviceInfoCallback
, device_info
);
543 void MobileSetupHandler::GetPropertiesFailure(
544 const std::string
& service_path
,
545 const std::string
& callback_name
,
546 const std::string
& error_name
,
547 scoped_ptr
<base::DictionaryValue
> error_data
) {
548 NET_LOG_ERROR("MobileActivator GetProperties Failed: " + error_name
,
550 // Invoke |callback_name| with an empty dictionary.
551 base::DictionaryValue device_dict
;
552 web_ui()->CallJavascriptFunction(callback_name
, device_dict
);
555 void MobileSetupHandler::DefaultNetworkChanged(
556 const NetworkState
* default_network
) {
560 std::string path
= web_ui()->GetWebContents()->GetURL().path().substr(1);
564 const NetworkState
* network
=
565 NetworkHandler::Get()->network_state_handler()->GetNetworkState(path
);
567 LOG(ERROR
) << "Service path lost";
568 web_ui()->GetWebContents()->Close();
572 UpdatePortalReachability(network
, false /* do not force notification */);
575 void MobileSetupHandler::NetworkConnectionStateChanged(
576 const NetworkState
* network
) {
580 std::string path
= web_ui()->GetWebContents()->GetURL().path().substr(1);
581 if (path
.empty() || path
!= network
->path())
584 UpdatePortalReachability(network
, false /* do not force notification */);
587 void MobileSetupHandler::UpdatePortalReachability(
588 const NetworkState
* network
,
589 bool force_notification
) {
592 DCHECK_EQ(type_
, TYPE_PORTAL_LTE
);
594 chromeos::NetworkStateHandler
* nsh
=
595 NetworkHandler::Get()->network_state_handler();
596 bool portal_reachable
=
597 (network
->IsConnectedState() ||
598 (nsh
->DefaultNetwork() &&
599 nsh
->DefaultNetwork()->connection_state() == shill::kStateOnline
));
601 if (force_notification
|| portal_reachable
!= lte_portal_reachable_
) {
602 web_ui()->CallJavascriptFunction(kJsConnectivityChangedCallback
,
603 base::FundamentalValue(portal_reachable
));
606 lte_portal_reachable_
= portal_reachable
;
609 ////////////////////////////////////////////////////////////////////////////////
613 ////////////////////////////////////////////////////////////////////////////////
615 MobileSetupUI::MobileSetupUI(content::WebUI
* web_ui
)
616 : WebUIController(web_ui
) {
617 web_ui
->AddMessageHandler(new MobileSetupHandler());
618 MobileSetupUIHTMLSource
* html_source
= new MobileSetupUIHTMLSource();
620 // Set up the chrome://mobilesetup/ source.
621 Profile
* profile
= Profile::FromWebUI(web_ui
);
622 content::URLDataSource::Add(profile
, html_source
);
624 content::WebContentsObserver::Observe(web_ui
->GetWebContents());
627 void MobileSetupUI::DidCommitProvisionalLoadForFrame(
628 content::RenderFrameHost
* render_frame_host
,
630 ui::PageTransition transition_type
) {
631 if (render_frame_host
->GetFrameName() != "paymentForm")
634 web_ui()->CallJavascriptFunction(
635 kJsPortalFrameLoadCompletedCallback
);
638 void MobileSetupUI::DidFailProvisionalLoad(
639 content::RenderFrameHost
* render_frame_host
,
640 const GURL
& validated_url
,
642 const base::string16
& error_description
,
643 bool was_ignored_by_handler
) {
644 if (render_frame_host
->GetFrameName() != "paymentForm")
647 base::FundamentalValue
result_value(-error_code
);
648 web_ui()->CallJavascriptFunction(kJsPortalFrameLoadFailedCallback
,