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