OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/chromeos/login/ui/webui_login_view.h" | 5 #include "chrome/browser/chromeos/login/ui/webui_login_view.h" |
6 | 6 |
7 #include "ash/shell.h" | 7 #include "ash/shell.h" |
8 #include "ash/system/tray/system_tray.h" | 8 #include "ash/system/tray/system_tray.h" |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
304 tray->GetWidget()->Hide(); | 304 tray->GetWidget()->Hide(); |
305 } | 305 } |
306 } | 306 } |
307 } | 307 } |
308 | 308 |
309 void WebUILoginView::SetUIEnabled(bool enabled) { | 309 void WebUILoginView::SetUIEnabled(bool enabled) { |
310 forward_keyboard_event_ = enabled; | 310 forward_keyboard_event_ = enabled; |
311 ash::Shell::GetInstance()->GetPrimarySystemTray()->SetEnabled(enabled); | 311 ash::Shell::GetInstance()->GetPrimarySystemTray()->SetEnabled(enabled); |
312 } | 312 } |
313 | 313 |
| 314 void WebUILoginView::AddFrameObserver(FrameObserver* frame_observer) { |
| 315 if (frame_observer && !frame_observer_list_.HasObserver(frame_observer)) |
| 316 frame_observer_list_.AddObserver(frame_observer); |
| 317 } |
| 318 |
| 319 void WebUILoginView::RemoveFrameObserver(FrameObserver* frame_observer) { |
| 320 frame_observer_list_.RemoveObserver(frame_observer); |
| 321 } |
| 322 |
314 // WebUILoginView protected: --------------------------------------------------- | 323 // WebUILoginView protected: --------------------------------------------------- |
315 | 324 |
316 void WebUILoginView::Layout() { | 325 void WebUILoginView::Layout() { |
317 DCHECK(webui_login_); | 326 DCHECK(webui_login_); |
318 webui_login_->SetBoundsRect(bounds()); | 327 webui_login_->SetBoundsRect(bounds()); |
319 | 328 |
320 FOR_EACH_OBSERVER(web_modal::ModalDialogHostObserver, | 329 FOR_EACH_OBSERVER(web_modal::ModalDialogHostObserver, |
321 observer_list_, | 330 observer_list_, |
322 OnPositionRequiresUpdate()); | 331 OnPositionRequiresUpdate()); |
323 } | 332 } |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
423 } | 432 } |
424 | 433 |
425 void WebUILoginView::DidFailProvisionalLoad( | 434 void WebUILoginView::DidFailProvisionalLoad( |
426 int64 frame_id, | 435 int64 frame_id, |
427 const base::string16& frame_unique_name, | 436 const base::string16& frame_unique_name, |
428 bool is_main_frame, | 437 bool is_main_frame, |
429 const GURL& validated_url, | 438 const GURL& validated_url, |
430 int error_code, | 439 int error_code, |
431 const base::string16& error_description, | 440 const base::string16& error_description, |
432 content::RenderViewHost* render_view_host) { | 441 content::RenderViewHost* render_view_host) { |
| 442 FOR_EACH_OBSERVER(FrameObserver, |
| 443 frame_observer_list_, |
| 444 DidFailProvisionalLoad(frame_id, |
| 445 frame_unique_name, |
| 446 is_main_frame, |
| 447 validated_url, |
| 448 error_code, |
| 449 error_description, |
| 450 render_view_host)); |
433 if (frame_unique_name != base::UTF8ToUTF16("gaia-frame")) | 451 if (frame_unique_name != base::UTF8ToUTF16("gaia-frame")) |
434 return; | 452 return; |
435 | 453 |
436 GetWebUI()->CallJavascriptFunction("login.GaiaSigninScreen.onFrameError", | 454 GetWebUI()->CallJavascriptFunction("login.GaiaSigninScreen.onFrameError", |
437 base::FundamentalValue(-error_code), | 455 base::FundamentalValue(-error_code), |
438 base::StringValue(validated_url.spec())); | 456 base::StringValue(validated_url.spec())); |
439 } | 457 } |
440 | 458 |
441 void WebUILoginView::OnLoginPromptVisible() { | 459 void WebUILoginView::OnLoginPromptVisible() { |
442 // If we're hidden than will generate this signal once we're shown. | 460 // If we're hidden than will generate this signal once we're shown. |
(...skipping 12 matching lines...) Expand all Loading... |
455 webui_visible_ = true; | 473 webui_visible_ = true; |
456 } | 474 } |
457 | 475 |
458 void WebUILoginView::ReturnFocus(bool reverse) { | 476 void WebUILoginView::ReturnFocus(bool reverse) { |
459 // Return the focus to the web contents. | 477 // Return the focus to the web contents. |
460 webui_login_->web_contents()->FocusThroughTabTraversal(reverse); | 478 webui_login_->web_contents()->FocusThroughTabTraversal(reverse); |
461 GetWidget()->Activate(); | 479 GetWidget()->Activate(); |
462 } | 480 } |
463 | 481 |
464 } // namespace chromeos | 482 } // namespace chromeos |
OLD | NEW |