OLD | NEW |
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/login/error_screen_handler.h" | 5 #include "chrome/browser/ui/webui/chromeos/login/error_screen_handler.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
10 #include "base/time.h" | 10 #include "base/time.h" |
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
320 } | 320 } |
321 | 321 |
322 void ErrorScreenHandler::HandleErrorScreenUpdate(const base::ListValue* args) { | 322 void ErrorScreenHandler::HandleErrorScreenUpdate(const base::ListValue* args) { |
323 UpdateStateInternal(network_state_informer_->state(), | 323 UpdateStateInternal(network_state_informer_->state(), |
324 network_state_informer_->network_name(), | 324 network_state_informer_->network_name(), |
325 kErrorReasonUpdate, | 325 kErrorReasonUpdate, |
326 network_state_informer_->last_network_type(), | 326 network_state_informer_->last_network_type(), |
327 false); | 327 false); |
328 } | 328 } |
329 | 329 |
| 330 void ErrorScreenHandler::HandleShowLoadingTimeoutError( |
| 331 const base::ListValue* args) { |
| 332 UpdateStateInternal(network_state_informer_->state(), |
| 333 network_state_informer_->network_name(), |
| 334 kErrorReasonLoadingTimeout, |
| 335 network_state_informer_->last_network_type(), |
| 336 false); |
| 337 } |
| 338 |
330 void ErrorScreenHandler::HandleUpdateGaiaIsLocal(const base::ListValue* args) { | 339 void ErrorScreenHandler::HandleUpdateGaiaIsLocal(const base::ListValue* args) { |
331 DCHECK(args && args->GetSize() == 1); | 340 DCHECK(args && args->GetSize() == 1); |
332 | 341 |
333 bool gaia_is_local = false; | 342 bool gaia_is_local = false; |
334 if (!args->GetBoolean(0, &gaia_is_local)) | 343 if (!args->GetBoolean(0, &gaia_is_local)) |
335 return; | 344 return; |
336 set_gaia_is_local(gaia_is_local); | 345 set_gaia_is_local(gaia_is_local); |
337 } | 346 } |
338 | 347 |
339 void ErrorScreenHandler::RegisterMessages() { | 348 void ErrorScreenHandler::RegisterMessages() { |
340 web_ui()->RegisterMessageCallback("fixCaptivePortal", | 349 web_ui()->RegisterMessageCallback("fixCaptivePortal", |
341 base::Bind(&ErrorScreenHandler::HandleFixCaptivePortal, | 350 base::Bind(&ErrorScreenHandler::HandleFixCaptivePortal, |
342 base::Unretained(this))); | 351 base::Unretained(this))); |
343 web_ui()->RegisterMessageCallback("showCaptivePortal", | 352 web_ui()->RegisterMessageCallback("showCaptivePortal", |
344 base::Bind(&ErrorScreenHandler::HandleShowCaptivePortal, | 353 base::Bind(&ErrorScreenHandler::HandleShowCaptivePortal, |
345 base::Unretained(this))); | 354 base::Unretained(this))); |
346 web_ui()->RegisterMessageCallback("hideCaptivePortal", | 355 web_ui()->RegisterMessageCallback("hideCaptivePortal", |
347 base::Bind(&ErrorScreenHandler::HandleHideCaptivePortal, | 356 base::Bind(&ErrorScreenHandler::HandleHideCaptivePortal, |
348 base::Unretained(this))); | 357 base::Unretained(this))); |
349 web_ui()->RegisterMessageCallback("errorScreenUpdate", | 358 web_ui()->RegisterMessageCallback("errorScreenUpdate", |
350 base::Bind(&ErrorScreenHandler::HandleErrorScreenUpdate, | 359 base::Bind(&ErrorScreenHandler::HandleErrorScreenUpdate, |
351 base::Unretained(this))); | 360 base::Unretained(this))); |
| 361 web_ui()->RegisterMessageCallback("showLoadingTimeoutError", |
| 362 base::Bind(&ErrorScreenHandler::HandleShowLoadingTimeoutError, |
| 363 base::Unretained(this))); |
352 web_ui()->RegisterMessageCallback("updateGaiaIsLocal", | 364 web_ui()->RegisterMessageCallback("updateGaiaIsLocal", |
353 base::Bind(&ErrorScreenHandler::HandleUpdateGaiaIsLocal, | 365 base::Bind(&ErrorScreenHandler::HandleUpdateGaiaIsLocal, |
354 base::Unretained(this))); | 366 base::Unretained(this))); |
355 } | 367 } |
356 | 368 |
357 void ErrorScreenHandler::GetLocalizedStrings( | 369 void ErrorScreenHandler::GetLocalizedStrings( |
358 base::DictionaryValue* localized_strings) { | 370 base::DictionaryValue* localized_strings) { |
359 localized_strings->SetString("offlineMessageTitle", | 371 localized_strings->SetString("offlineMessageTitle", |
360 l10n_util::GetStringUTF16(IDS_LOGIN_OFFLINE_TITLE)); | 372 l10n_util::GetStringUTF16(IDS_LOGIN_OFFLINE_TITLE)); |
361 localized_strings->SetString("offlineMessageBody", | 373 localized_strings->SetString("offlineMessageBody", |
(...skipping 13 matching lines...) Expand all Loading... |
375 void ErrorScreenHandler::Initialize() { | 387 void ErrorScreenHandler::Initialize() { |
376 } | 388 } |
377 | 389 |
378 gfx::NativeWindow ErrorScreenHandler::GetNativeWindow() { | 390 gfx::NativeWindow ErrorScreenHandler::GetNativeWindow() { |
379 if (native_window_delegate_) | 391 if (native_window_delegate_) |
380 return native_window_delegate_->GetNativeWindow(); | 392 return native_window_delegate_->GetNativeWindow(); |
381 return NULL; | 393 return NULL; |
382 } | 394 } |
383 | 395 |
384 } // namespace chromeos | 396 } // namespace chromeos |
OLD | NEW |