| 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 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 305 tray->GetWidget()->Hide(); | 305 tray->GetWidget()->Hide(); |
| 306 } | 306 } |
| 307 } | 307 } |
| 308 } | 308 } |
| 309 | 309 |
| 310 void WebUILoginView::SetUIEnabled(bool enabled) { | 310 void WebUILoginView::SetUIEnabled(bool enabled) { |
| 311 forward_keyboard_event_ = enabled; | 311 forward_keyboard_event_ = enabled; |
| 312 ash::Shell::GetInstance()->GetPrimarySystemTray()->SetEnabled(enabled); | 312 ash::Shell::GetInstance()->GetPrimarySystemTray()->SetEnabled(enabled); |
| 313 } | 313 } |
| 314 | 314 |
| 315 void WebUILoginView::AddFrameObserver(FrameObserver* frame_observer) { |
| 316 DCHECK(frame_observer); |
| 317 DCHECK(!frame_observer_list_.HasObserver(frame_observer)); |
| 318 frame_observer_list_.AddObserver(frame_observer); |
| 319 } |
| 320 |
| 321 void WebUILoginView::RemoveFrameObserver(FrameObserver* frame_observer) { |
| 322 DCHECK(frame_observer); |
| 323 DCHECK(frame_observer_list_.HasObserver(frame_observer)); |
| 324 frame_observer_list_.RemoveObserver(frame_observer); |
| 325 } |
| 326 |
| 315 // WebUILoginView protected: --------------------------------------------------- | 327 // WebUILoginView protected: --------------------------------------------------- |
| 316 | 328 |
| 317 void WebUILoginView::Layout() { | 329 void WebUILoginView::Layout() { |
| 318 DCHECK(webui_login_); | 330 DCHECK(webui_login_); |
| 319 webui_login_->SetBoundsRect(bounds()); | 331 webui_login_->SetBoundsRect(bounds()); |
| 320 | 332 |
| 321 FOR_EACH_OBSERVER(web_modal::ModalDialogHostObserver, | 333 FOR_EACH_OBSERVER(web_modal::ModalDialogHostObserver, |
| 322 observer_list_, | 334 observer_list_, |
| 323 OnPositionRequiresUpdate()); | 335 OnPositionRequiresUpdate()); |
| 324 } | 336 } |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 422 event.type == blink::WebGestureEvent::GesturePinchUpdate || | 434 event.type == blink::WebGestureEvent::GesturePinchUpdate || |
| 423 event.type == blink::WebGestureEvent::GesturePinchEnd; | 435 event.type == blink::WebGestureEvent::GesturePinchEnd; |
| 424 } | 436 } |
| 425 | 437 |
| 426 void WebUILoginView::DidFailProvisionalLoad( | 438 void WebUILoginView::DidFailProvisionalLoad( |
| 427 content::RenderFrameHost* render_frame_host, | 439 content::RenderFrameHost* render_frame_host, |
| 428 bool is_main_frame, | 440 bool is_main_frame, |
| 429 const GURL& validated_url, | 441 const GURL& validated_url, |
| 430 int error_code, | 442 int error_code, |
| 431 const base::string16& error_description) { | 443 const base::string16& error_description) { |
| 444 FOR_EACH_OBSERVER(FrameObserver, |
| 445 frame_observer_list_, |
| 446 OnFrameError(render_frame_host->GetFrameName())); |
| 432 if (render_frame_host->GetFrameName() != "gaia-frame") | 447 if (render_frame_host->GetFrameName() != "gaia-frame") |
| 433 return; | 448 return; |
| 434 | 449 |
| 435 GetWebUI()->CallJavascriptFunction("login.GaiaSigninScreen.onFrameError", | 450 GetWebUI()->CallJavascriptFunction("login.GaiaSigninScreen.onFrameError", |
| 436 base::FundamentalValue(-error_code), | 451 base::FundamentalValue(-error_code), |
| 437 base::StringValue(validated_url.spec())); | 452 base::StringValue(validated_url.spec())); |
| 438 } | 453 } |
| 439 | 454 |
| 440 void WebUILoginView::OnLoginPromptVisible() { | 455 void WebUILoginView::OnLoginPromptVisible() { |
| 441 // If we're hidden than will generate this signal once we're shown. | 456 // If we're hidden than will generate this signal once we're shown. |
| (...skipping 12 matching lines...) Expand all Loading... |
| 454 webui_visible_ = true; | 469 webui_visible_ = true; |
| 455 } | 470 } |
| 456 | 471 |
| 457 void WebUILoginView::ReturnFocus(bool reverse) { | 472 void WebUILoginView::ReturnFocus(bool reverse) { |
| 458 // Return the focus to the web contents. | 473 // Return the focus to the web contents. |
| 459 webui_login_->web_contents()->FocusThroughTabTraversal(reverse); | 474 webui_login_->web_contents()->FocusThroughTabTraversal(reverse); |
| 460 GetWidget()->Activate(); | 475 GetWidget()->Activate(); |
| 461 } | 476 } |
| 462 | 477 |
| 463 } // namespace chromeos | 478 } // namespace chromeos |
| OLD | NEW |