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/tray/system_tray.h" | 8 #include "ash/common/system/tray/system_tray.h" |
9 #include "ash/common/wm_shell.h" | 9 #include "ash/common/wm_shell.h" |
10 #include "ash/shell.h" | 10 #include "ash/shell.h" |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 kAccelNameBootstrappingSlave; | 171 kAccelNameBootstrappingSlave; |
172 | 172 |
173 for (AccelMap::iterator i(accel_map_.begin()); i != accel_map_.end(); ++i) | 173 for (AccelMap::iterator i(accel_map_.begin()); i != accel_map_.end(); ++i) |
174 AddAccelerator(i->first); | 174 AddAccelerator(i->first); |
175 } | 175 } |
176 | 176 |
177 WebUILoginView::~WebUILoginView() { | 177 WebUILoginView::~WebUILoginView() { |
178 for (auto& observer : observer_list_) | 178 for (auto& observer : observer_list_) |
179 observer.OnHostDestroying(); | 179 observer.OnHostDestroying(); |
180 | 180 |
181 if (!ash_util::IsRunningInMash() && | 181 if (!IsRunningInMash() && ash::Shell::GetInstance()->HasPrimaryStatusArea()) { |
182 ash::Shell::GetInstance()->HasPrimaryStatusArea()) { | |
183 ash::Shell::GetInstance()->GetPrimarySystemTray()->SetNextFocusableView( | 182 ash::Shell::GetInstance()->GetPrimarySystemTray()->SetNextFocusableView( |
184 nullptr); | 183 nullptr); |
185 } else { | 184 } else { |
186 NOTIMPLEMENTED(); | 185 NOTIMPLEMENTED(); |
187 } | 186 } |
188 | 187 |
189 // Clear any delegates we have set on the WebView. | 188 // Clear any delegates we have set on the WebView. |
190 WebContents* web_contents = web_view()->GetWebContents(); | 189 WebContents* web_contents = web_view()->GetWebContents(); |
191 WebContentsModalDialogManager::FromWebContents(web_contents) | 190 WebContentsModalDialogManager::FromWebContents(web_contents) |
192 ->SetDelegate(nullptr); | 191 ->SetDelegate(nullptr); |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
316 gfx::NativeWindow WebUILoginView::GetNativeWindow() const { | 315 gfx::NativeWindow WebUILoginView::GetNativeWindow() const { |
317 return GetWidget()->GetNativeWindow(); | 316 return GetWidget()->GetNativeWindow(); |
318 } | 317 } |
319 | 318 |
320 void WebUILoginView::LoadURL(const GURL& url) { | 319 void WebUILoginView::LoadURL(const GURL& url) { |
321 if (!is_reusing_webview_) | 320 if (!is_reusing_webview_) |
322 web_view()->LoadInitialURL(url); | 321 web_view()->LoadInitialURL(url); |
323 web_view()->RequestFocus(); | 322 web_view()->RequestFocus(); |
324 | 323 |
325 // There is no Shell instance while running in mash. | 324 // There is no Shell instance while running in mash. |
326 if (ash_util::IsRunningInMash()) | 325 if (IsRunningInMash()) |
327 return; | 326 return; |
328 } | 327 } |
329 | 328 |
330 content::WebUI* WebUILoginView::GetWebUI() { | 329 content::WebUI* WebUILoginView::GetWebUI() { |
331 return web_view()->web_contents()->GetWebUI(); | 330 return web_view()->web_contents()->GetWebUI(); |
332 } | 331 } |
333 | 332 |
334 content::WebContents* WebUILoginView::GetWebContents() { | 333 content::WebContents* WebUILoginView::GetWebContents() { |
335 return web_view()->web_contents(); | 334 return web_view()->web_contents(); |
336 } | 335 } |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
452 } | 451 } |
453 | 452 |
454 bool WebUILoginView::TakeFocus(content::WebContents* source, bool reverse) { | 453 bool WebUILoginView::TakeFocus(content::WebContents* source, bool reverse) { |
455 // In case of blocked UI (ex.: sign in is in progress) | 454 // In case of blocked UI (ex.: sign in is in progress) |
456 // we should not process focus change events. | 455 // we should not process focus change events. |
457 if (!forward_keyboard_event_) | 456 if (!forward_keyboard_event_) |
458 return false; | 457 return false; |
459 | 458 |
460 // Focus is accepted, but the Ash system tray is not available in Mash, so | 459 // Focus is accepted, but the Ash system tray is not available in Mash, so |
461 // exit early. | 460 // exit early. |
462 if (ash_util::IsRunningInMash()) | 461 if (IsRunningInMash()) |
463 return true; | 462 return true; |
464 | 463 |
465 ash::SystemTray* tray = ash::Shell::GetInstance()->GetPrimarySystemTray(); | 464 ash::SystemTray* tray = ash::Shell::GetInstance()->GetPrimarySystemTray(); |
466 if (tray && tray->GetWidget()->IsVisible()) { | 465 if (tray && tray->GetWidget()->IsVisible()) { |
467 tray->SetNextFocusableView(this); | 466 tray->SetNextFocusableView(this); |
468 ash::WmShell::Get()->focus_cycler()->RotateFocus( | 467 ash::WmShell::Get()->focus_cycler()->RotateFocus( |
469 reverse ? ash::FocusCycler::BACKWARD : ash::FocusCycler::FORWARD); | 468 reverse ? ash::FocusCycler::BACKWARD : ash::FocusCycler::FORWARD); |
470 } | 469 } |
471 | 470 |
472 return true; | 471 return true; |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
508 if (should_emit_login_prompt_visible_) { | 507 if (should_emit_login_prompt_visible_) { |
509 VLOG(1) << "Login WebUI >> login-prompt-visible"; | 508 VLOG(1) << "Login WebUI >> login-prompt-visible"; |
510 chromeos::DBusThreadManager::Get()->GetSessionManagerClient()-> | 509 chromeos::DBusThreadManager::Get()->GetSessionManagerClient()-> |
511 EmitLoginPromptVisible(); | 510 EmitLoginPromptVisible(); |
512 } | 511 } |
513 | 512 |
514 webui_visible_ = true; | 513 webui_visible_ = true; |
515 } | 514 } |
516 | 515 |
517 } // namespace chromeos | 516 } // namespace chromeos |
OLD | NEW |