OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/webui_login_view.h" | 5 #include "chrome/browser/chromeos/login/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 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
290 bool WebUILoginView::HandleContextMenu( | 290 bool WebUILoginView::HandleContextMenu( |
291 const content::ContextMenuParams& params) { | 291 const content::ContextMenuParams& params) { |
292 // Do not show the context menu. | 292 // Do not show the context menu. |
293 #ifndef NDEBUG | 293 #ifndef NDEBUG |
294 return false; | 294 return false; |
295 #else | 295 #else |
296 return true; | 296 return true; |
297 #endif | 297 #endif |
298 } | 298 } |
299 | 299 |
300 void WebUILoginView::HandleKeyboardEvent(const NativeWebKeyboardEvent& event) { | 300 void WebUILoginView::HandleKeyboardEvent(content::WebContents* source, |
| 301 const NativeWebKeyboardEvent& event) { |
301 unhandled_keyboard_event_handler_.HandleKeyboardEvent(event, | 302 unhandled_keyboard_event_handler_.HandleKeyboardEvent(event, |
302 GetFocusManager()); | 303 GetFocusManager()); |
303 | 304 |
304 // Make sure error bubble is cleared on keyboard event. This is needed | 305 // Make sure error bubble is cleared on keyboard event. This is needed |
305 // when the focus is inside an iframe. Only clear on KeyDown to prevent hiding | 306 // when the focus is inside an iframe. Only clear on KeyDown to prevent hiding |
306 // an immediate authentication error (See crbug.com/103643). | 307 // an immediate authentication error (See crbug.com/103643). |
307 if (event.type == WebKit::WebInputEvent::KeyDown) { | 308 if (event.type == WebKit::WebInputEvent::KeyDown) { |
308 content::WebUI* web_ui = GetWebUI(); | 309 content::WebUI* web_ui = GetWebUI(); |
309 if (web_ui) | 310 if (web_ui) |
310 web_ui->CallJavascriptFunction("cr.ui.Oobe.clearErrors"); | 311 web_ui->CallJavascriptFunction("cr.ui.Oobe.clearErrors"); |
311 } | 312 } |
312 } | 313 } |
313 | 314 |
314 bool WebUILoginView::IsPopupOrPanel(const WebContents* source) const { | 315 bool WebUILoginView::IsPopupOrPanel(const WebContents* source) const { |
315 return true; | 316 return true; |
316 } | 317 } |
317 | 318 |
318 bool WebUILoginView::TakeFocus(bool reverse) { | 319 bool WebUILoginView::TakeFocus(content::WebContents* source, bool reverse) { |
319 ash::SystemTray* tray = ash::Shell::GetInstance()->system_tray(); | 320 ash::SystemTray* tray = ash::Shell::GetInstance()->system_tray(); |
320 if (tray && tray->GetWidget()->IsVisible()) { | 321 if (tray && tray->GetWidget()->IsVisible()) { |
321 tray->SetNextFocusableView(this); | 322 tray->SetNextFocusableView(this); |
322 ash::Shell::GetInstance()->RotateFocus(reverse ? ash::Shell::BACKWARD : | 323 ash::Shell::GetInstance()->RotateFocus(reverse ? ash::Shell::BACKWARD : |
323 ash::Shell::FORWARD); | 324 ash::Shell::FORWARD); |
324 } | 325 } |
325 | 326 |
326 return true; | 327 return true; |
327 } | 328 } |
328 | 329 |
(...skipping 27 matching lines...) Expand all Loading... |
356 aura::Env::GetInstance()->set_render_white_bg(true); | 357 aura::Env::GetInstance()->set_render_white_bg(true); |
357 } | 358 } |
358 | 359 |
359 void WebUILoginView::ReturnFocus(bool reverse) { | 360 void WebUILoginView::ReturnFocus(bool reverse) { |
360 // Return the focus to the web contents. | 361 // Return the focus to the web contents. |
361 webui_login_->web_contents()->FocusThroughTabTraversal(reverse); | 362 webui_login_->web_contents()->FocusThroughTabTraversal(reverse); |
362 GetWidget()->Activate(); | 363 GetWidget()->Activate(); |
363 } | 364 } |
364 | 365 |
365 } // namespace chromeos | 366 } // namespace chromeos |
OLD | NEW |