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 "content/browser/renderer_host/render_widget_host_view_aura.h" | 5 #include "content/browser/renderer_host/render_widget_host_view_aura.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
(...skipping 1442 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1453 return scoped_refptr<ui::Texture>(); | 1453 return scoped_refptr<ui::Texture>(); |
1454 | 1454 |
1455 return scoped_refptr<ui::Texture>( | 1455 return scoped_refptr<ui::Texture>( |
1456 factory->CreateOwnedTexture( | 1456 factory->CreateOwnedTexture( |
1457 container->size(), device_scale_factor_, texture_id)); | 1457 container->size(), device_scale_factor_, texture_id)); |
1458 } | 1458 } |
1459 | 1459 |
1460 //////////////////////////////////////////////////////////////////////////////// | 1460 //////////////////////////////////////////////////////////////////////////////// |
1461 // RenderWidgetHostViewAura, ui::EventHandler implementation: | 1461 // RenderWidgetHostViewAura, ui::EventHandler implementation: |
1462 | 1462 |
1463 ui::EventResult RenderWidgetHostViewAura::OnKeyEvent(ui::KeyEvent* event) { | 1463 void RenderWidgetHostViewAura::OnKeyEvent(ui::KeyEvent* event) { |
1464 TRACE_EVENT0("browser", "RenderWidgetHostViewAura::OnKeyEvent"); | 1464 TRACE_EVENT0("browser", "RenderWidgetHostViewAura::OnKeyEvent"); |
1465 if (popup_child_host_view_ && popup_child_host_view_->NeedsInputGrab() && | 1465 if (popup_child_host_view_ && popup_child_host_view_->NeedsInputGrab()) { |
1466 popup_child_host_view_->OnKeyEvent(event)) | 1466 popup_child_host_view_->OnKeyEvent(event); |
1467 return ui::ER_HANDLED; | 1467 if (event->handled()) |
| 1468 return; |
| 1469 } |
1468 | 1470 |
1469 // We need to handle the Escape key for Pepper Flash. | 1471 // We need to handle the Escape key for Pepper Flash. |
1470 if (is_fullscreen_ && event->key_code() == ui::VKEY_ESCAPE) { | 1472 if (is_fullscreen_ && event->key_code() == ui::VKEY_ESCAPE) { |
1471 // Focus the window we were created from. | 1473 // Focus the window we were created from. |
1472 if (host_tracker_.get() && !host_tracker_->windows().empty()) { | 1474 if (host_tracker_.get() && !host_tracker_->windows().empty()) { |
1473 aura::Window* host = *(host_tracker_->windows().begin()); | 1475 aura::Window* host = *(host_tracker_->windows().begin()); |
1474 aura::client::FocusClient* client = aura::client::GetFocusClient(host); | 1476 aura::client::FocusClient* client = aura::client::GetFocusClient(host); |
1475 if (client) | 1477 if (client) |
1476 host->Focus(); | 1478 host->Focus(); |
1477 } | 1479 } |
(...skipping 12 matching lines...) Expand all Loading... |
1490 false /* is_char */, | 1492 false /* is_char */, |
1491 event->GetCharacter() ? event->GetCharacter() : event->key_code(), | 1493 event->GetCharacter() ? event->GetCharacter() : event->key_code(), |
1492 event->flags(), | 1494 event->flags(), |
1493 base::Time::Now().ToDoubleT()); | 1495 base::Time::Now().ToDoubleT()); |
1494 host_->ForwardKeyboardEvent(webkit_event); | 1496 host_->ForwardKeyboardEvent(webkit_event); |
1495 } else { | 1497 } else { |
1496 NativeWebKeyboardEvent webkit_event(event); | 1498 NativeWebKeyboardEvent webkit_event(event); |
1497 host_->ForwardKeyboardEvent(webkit_event); | 1499 host_->ForwardKeyboardEvent(webkit_event); |
1498 } | 1500 } |
1499 } | 1501 } |
1500 return ui::ER_HANDLED; | 1502 event->SetHandled(); |
1501 } | 1503 } |
1502 | 1504 |
1503 ui::EventResult RenderWidgetHostViewAura::OnMouseEvent(ui::MouseEvent* event) { | 1505 ui::EventResult RenderWidgetHostViewAura::OnMouseEvent(ui::MouseEvent* event) { |
1504 TRACE_EVENT0("browser", "RenderWidgetHostViewAura::OnMouseEvent"); | 1506 TRACE_EVENT0("browser", "RenderWidgetHostViewAura::OnMouseEvent"); |
1505 | 1507 |
1506 if (mouse_locked_) { | 1508 if (mouse_locked_) { |
1507 // Hide the cursor if someone else has shown it. | 1509 // Hide the cursor if someone else has shown it. |
1508 aura::client::CursorClient* cursor_client = | 1510 aura::client::CursorClient* cursor_client = |
1509 aura::client::GetCursorClient(window_->GetRootWindow()); | 1511 aura::client::GetCursorClient(window_->GetRootWindow()); |
1510 if (cursor_client && cursor_client->IsCursorVisible()) | 1512 if (cursor_client && cursor_client->IsCursorVisible()) |
(...skipping 481 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1992 RenderWidgetHost* widget) { | 1994 RenderWidgetHost* widget) { |
1993 return new RenderWidgetHostViewAura(widget); | 1995 return new RenderWidgetHostViewAura(widget); |
1994 } | 1996 } |
1995 | 1997 |
1996 // static | 1998 // static |
1997 void RenderWidgetHostViewPort::GetDefaultScreenInfo(WebScreenInfo* results) { | 1999 void RenderWidgetHostViewPort::GetDefaultScreenInfo(WebScreenInfo* results) { |
1998 GetScreenInfoForWindow(results, NULL); | 2000 GetScreenInfoForWindow(results, NULL); |
1999 } | 2001 } |
2000 | 2002 |
2001 } // namespace content | 2003 } // namespace content |
OLD | NEW |