Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(396)

Side by Side Diff: chrome/browser/chromeos/login/ui/webui_login_view.cc

Issue 2295843006: Signin screen and locked screen status area focus advancing (Closed)
Patch Set: Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/tray/system_tray.h" 8 #include "ash/common/system/tray/system_tray.h"
9 #include "ash/common/system/tray/system_tray_notifier.h"
9 #include "ash/common/wm_shell.h" 10 #include "ash/common/wm_shell.h"
10 #include "ash/shell.h" 11 #include "ash/shell.h"
11 #include "base/bind.h" 12 #include "base/bind.h"
12 #include "base/callback.h" 13 #include "base/callback.h"
13 #include "base/i18n/rtl.h" 14 #include "base/i18n/rtl.h"
14 #include "base/logging.h" 15 #include "base/logging.h"
15 #include "base/macros.h" 16 #include "base/macros.h"
16 #include "base/strings/utf_string_conversions.h" 17 #include "base/strings/utf_string_conversions.h"
17 #include "base/trace_event/trace_event.h" 18 #include "base/trace_event/trace_event.h"
18 #include "base/values.h" 19 #include "base/values.h"
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 accel_map_[ui::Accelerator(ui::VKEY_S, 154 accel_map_[ui::Accelerator(ui::VKEY_S,
154 ui::EF_CONTROL_DOWN | ui::EF_ALT_DOWN)] = 155 ui::EF_CONTROL_DOWN | ui::EF_ALT_DOWN)] =
155 kAccelNameAppLaunchBailout; 156 kAccelNameAppLaunchBailout;
156 157
157 accel_map_[ui::Accelerator(ui::VKEY_N, 158 accel_map_[ui::Accelerator(ui::VKEY_N,
158 ui::EF_CONTROL_DOWN | ui::EF_ALT_DOWN)] = 159 ui::EF_CONTROL_DOWN | ui::EF_ALT_DOWN)] =
159 kAccelNameAppLaunchNetworkConfig; 160 kAccelNameAppLaunchNetworkConfig;
160 161
161 for (AccelMap::iterator i(accel_map_.begin()); i != accel_map_.end(); ++i) 162 for (AccelMap::iterator i(accel_map_.begin()); i != accel_map_.end(); ++i)
162 AddAccelerator(i->first); 163 AddAccelerator(i->first);
164 ash::WmShell::Get()->system_tray_notifier()->AddStatusAreaFocusObserver(this);
163 } 165 }
164 166
165 WebUILoginView::~WebUILoginView() { 167 WebUILoginView::~WebUILoginView() {
166 FOR_EACH_OBSERVER(web_modal::ModalDialogHostObserver, 168 FOR_EACH_OBSERVER(web_modal::ModalDialogHostObserver,
167 observer_list_, 169 observer_list_,
168 OnHostDestroying()); 170 OnHostDestroying());
169 171
170 if (!chrome::IsRunningInMash() && 172 ash::WmShell::Get()->system_tray_notifier()->RemoveStatusAreaFocusObserver(
171 ash::Shell::GetInstance()->HasPrimaryStatusArea()) { 173 this);
172 ash::Shell::GetInstance()->GetPrimarySystemTray()->
173 SetNextFocusableView(NULL);
174 } else {
175 NOTIMPLEMENTED();
176 }
177 } 174 }
178 175
179 void WebUILoginView::Init() { 176 void WebUILoginView::Init() {
180 Profile* signin_profile = ProfileHelper::GetSigninProfile(); 177 Profile* signin_profile = ProfileHelper::GetSigninProfile();
181 webui_login_ = new views::WebView(signin_profile); 178 webui_login_ = new views::WebView(signin_profile);
182 webui_login_->set_allow_accelerators(true); 179 webui_login_->set_allow_accelerators(true);
183 AddChildView(webui_login_); 180 AddChildView(webui_login_);
184 181
185 WebContents* web_contents = webui_login_->GetWebContents(); 182 WebContents* web_contents = webui_login_->GetWebContents();
186 183
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after
430 if (!forward_keyboard_event_) 427 if (!forward_keyboard_event_)
431 return false; 428 return false;
432 429
433 // Focus is accepted, but the Ash system tray is not available in Mash, so 430 // Focus is accepted, but the Ash system tray is not available in Mash, so
434 // exit early. 431 // exit early.
435 if (chrome::IsRunningInMash()) 432 if (chrome::IsRunningInMash())
436 return true; 433 return true;
437 434
438 ash::SystemTray* tray = ash::Shell::GetInstance()->GetPrimarySystemTray(); 435 ash::SystemTray* tray = ash::Shell::GetInstance()->GetPrimarySystemTray();
439 if (tray && tray->GetWidget()->IsVisible()) { 436 if (tray && tray->GetWidget()->IsVisible()) {
440 tray->SetNextFocusableView(this);
441 ash::WmShell::Get()->focus_cycler()->RotateFocus( 437 ash::WmShell::Get()->focus_cycler()->RotateFocus(
442 reverse ? ash::FocusCycler::BACKWARD : ash::FocusCycler::FORWARD); 438 reverse ? ash::FocusCycler::BACKWARD : ash::FocusCycler::FORWARD);
443 } 439 }
444 440
445 return true; 441 return true;
446 } 442 }
447 443
448 void WebUILoginView::RequestMediaAccessPermission( 444 void WebUILoginView::RequestMediaAccessPermission(
449 WebContents* web_contents, 445 WebContents* web_contents,
450 const content::MediaStreamRequest& request, 446 const content::MediaStreamRequest& request,
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
501 497
502 bool WebUILoginView::PreHandleGestureEvent( 498 bool WebUILoginView::PreHandleGestureEvent(
503 content::WebContents* source, 499 content::WebContents* source,
504 const blink::WebGestureEvent& event) { 500 const blink::WebGestureEvent& event) {
505 // Disable pinch zooming. 501 // Disable pinch zooming.
506 return event.type == blink::WebGestureEvent::GesturePinchBegin || 502 return event.type == blink::WebGestureEvent::GesturePinchBegin ||
507 event.type == blink::WebGestureEvent::GesturePinchUpdate || 503 event.type == blink::WebGestureEvent::GesturePinchUpdate ||
508 event.type == blink::WebGestureEvent::GesturePinchEnd; 504 event.type == blink::WebGestureEvent::GesturePinchEnd;
509 } 505 }
510 506
507 void WebUILoginView::OnWillReturnFocusToWebContents(bool reverse) {
508 AboutToRequestFocusFromTabTraversal(reverse);
509 }
510
511 void WebUILoginView::OnLoginPromptVisible() { 511 void WebUILoginView::OnLoginPromptVisible() {
512 // If we're hidden than will generate this signal once we're shown. 512 // If we're hidden than will generate this signal once we're shown.
513 if (is_hidden_ || webui_visible_) { 513 if (is_hidden_ || webui_visible_) {
514 VLOG(1) << "Login WebUI >> not emitting signal, hidden: " << is_hidden_; 514 VLOG(1) << "Login WebUI >> not emitting signal, hidden: " << is_hidden_;
515 return; 515 return;
516 } 516 }
517 TRACE_EVENT0("chromeos", "WebUILoginView::OnLoginPromoptVisible"); 517 TRACE_EVENT0("chromeos", "WebUILoginView::OnLoginPromoptVisible");
518 if (should_emit_login_prompt_visible_) { 518 if (should_emit_login_prompt_visible_) {
519 VLOG(1) << "Login WebUI >> login-prompt-visible"; 519 VLOG(1) << "Login WebUI >> login-prompt-visible";
520 chromeos::DBusThreadManager::Get()->GetSessionManagerClient()-> 520 chromeos::DBusThreadManager::Get()->GetSessionManagerClient()->
521 EmitLoginPromptVisible(); 521 EmitLoginPromptVisible();
522 } 522 }
523 523
524 webui_visible_ = true; 524 webui_visible_ = true;
525 } 525 }
526 526
527 } // namespace chromeos 527 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698