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/common/focus_cycler.h" | 7 #include "ash/common/focus_cycler.h" |
8 #include "ash/common/system/status_area_widget_delegate.h" | 8 #include "ash/common/system/status_area_widget_delegate.h" |
9 #include "ash/common/system/tray/system_tray.h" | 9 #include "ash/common/system/tray/system_tray.h" |
10 #include "ash/common/wm_shell.h" | 10 #include "ash/common/wm_shell.h" |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 | 165 |
166 private: | 166 private: |
167 WebUILoginView* const webui_login_view_; | 167 WebUILoginView* const webui_login_view_; |
168 views::FocusSearch status_area_focus_search_; | 168 views::FocusSearch status_area_focus_search_; |
169 | 169 |
170 DISALLOW_COPY_AND_ASSIGN(StatusAreaFocusTraversable); | 170 DISALLOW_COPY_AND_ASSIGN(StatusAreaFocusTraversable); |
171 }; | 171 }; |
172 | 172 |
173 // WebUILoginView public: ------------------------------------------------------ | 173 // WebUILoginView public: ------------------------------------------------------ |
174 | 174 |
175 WebUILoginView::WebUILoginView() | 175 WebUILoginView::WebUILoginView() { |
176 : webui_login_(NULL), | |
177 is_hidden_(false), | |
178 webui_visible_(false), | |
179 should_emit_login_prompt_visible_(true), | |
180 forward_keyboard_event_(true) { | |
181 registrar_.Add(this, | 176 registrar_.Add(this, |
182 chrome::NOTIFICATION_LOGIN_OR_LOCK_WEBUI_VISIBLE, | 177 chrome::NOTIFICATION_LOGIN_OR_LOCK_WEBUI_VISIBLE, |
183 content::NotificationService::AllSources()); | 178 content::NotificationService::AllSources()); |
184 registrar_.Add(this, | 179 registrar_.Add(this, |
185 chrome::NOTIFICATION_LOGIN_NETWORK_ERROR_SHOWN, | 180 chrome::NOTIFICATION_LOGIN_NETWORK_ERROR_SHOWN, |
186 content::NotificationService::AllSources()); | 181 content::NotificationService::AllSources()); |
187 | 182 |
188 accel_map_[ui::Accelerator(ui::VKEY_ESCAPE, ui::EF_NONE)] = | 183 accel_map_[ui::Accelerator(ui::VKEY_ESCAPE, ui::EF_NONE)] = |
189 kAccelNameCancel; | 184 kAccelNameCancel; |
190 accel_map_[ui::Accelerator(ui::VKEY_E, | 185 accel_map_[ui::Accelerator(ui::VKEY_E, |
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
418 void WebUILoginView::SetUIEnabled(bool enabled) { | 413 void WebUILoginView::SetUIEnabled(bool enabled) { |
419 forward_keyboard_event_ = enabled; | 414 forward_keyboard_event_ = enabled; |
420 if (chrome::IsRunningInMash()) { | 415 if (chrome::IsRunningInMash()) { |
421 NOTIMPLEMENTED(); | 416 NOTIMPLEMENTED(); |
422 return; | 417 return; |
423 } | 418 } |
424 ash::SystemTray* tray = ash::Shell::GetInstance()->GetPrimarySystemTray(); | 419 ash::SystemTray* tray = ash::Shell::GetInstance()->GetPrimarySystemTray(); |
425 | 420 |
426 // We disable the UI to prevent user from interracting with UI elements, | 421 // We disable the UI to prevent user from interracting with UI elements, |
427 // particullary with the system tray menu. However, in case if the system tray | 422 // particullary with the system tray menu. However, in case if the system tray |
428 // bubble is opened at this point, it remains opened and interactictive even | 423 // bubble is opened at this point, it remains opened and interactive even |
429 // after SystemTray::SetEnabled(false) call, which can be dangerous | 424 // after SystemTray::SetEnabled(false) call, which can be dangerous |
430 // (http://crbug.com/497080). Close the menu to fix it. Calling | 425 // (http://crbug.com/497080). Close the menu to fix it. Calling |
431 // SystemTray::SetEnabled(false) guarantees, that the menu will not be opened | 426 // SystemTray::SetEnabled(false) guarantees, that the menu will not be opened |
432 // until the UI is enabled again. | 427 // until the UI is enabled again. |
433 if (!enabled && tray->HasSystemBubble()) | 428 if (!enabled && tray->HasSystemBubble()) |
434 tray->CloseSystemBubble(); | 429 tray->CloseSystemBubble(); |
435 | 430 |
436 tray->SetEnabled(enabled); | 431 tray->SetEnabled(enabled); |
437 } | 432 } |
438 | 433 |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
598 event.type == blink::WebGestureEvent::GesturePinchUpdate || | 593 event.type == blink::WebGestureEvent::GesturePinchUpdate || |
599 event.type == blink::WebGestureEvent::GesturePinchEnd; | 594 event.type == blink::WebGestureEvent::GesturePinchEnd; |
600 } | 595 } |
601 | 596 |
602 void WebUILoginView::OnLoginPromptVisible() { | 597 void WebUILoginView::OnLoginPromptVisible() { |
603 // If we're hidden than will generate this signal once we're shown. | 598 // If we're hidden than will generate this signal once we're shown. |
604 if (is_hidden_ || webui_visible_) { | 599 if (is_hidden_ || webui_visible_) { |
605 VLOG(1) << "Login WebUI >> not emitting signal, hidden: " << is_hidden_; | 600 VLOG(1) << "Login WebUI >> not emitting signal, hidden: " << is_hidden_; |
606 return; | 601 return; |
607 } | 602 } |
608 TRACE_EVENT0("chromeos", "WebUILoginView::OnLoginPromoptVisible"); | 603 TRACE_EVENT0("chromeos", "WebUILoginView::OnLoginPromptVisible"); |
609 if (should_emit_login_prompt_visible_) { | 604 if (should_emit_login_prompt_visible_) { |
610 VLOG(1) << "Login WebUI >> login-prompt-visible"; | 605 VLOG(1) << "Login WebUI >> login-prompt-visible"; |
611 chromeos::DBusThreadManager::Get()->GetSessionManagerClient()-> | 606 chromeos::DBusThreadManager::Get()->GetSessionManagerClient()-> |
612 EmitLoginPromptVisible(); | 607 EmitLoginPromptVisible(); |
613 } | 608 } |
614 | 609 |
615 webui_visible_ = true; | 610 webui_visible_ = true; |
616 } | 611 } |
617 | 612 |
618 } // namespace chromeos | 613 } // namespace chromeos |
OLD | NEW |