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

Side by Side Diff: content/browser/renderer_host/render_widget_host_view_aura.cc

Issue 235693002: Merge 260900 "linux_aura: Port GtkKeybindingsHandler to Aura." (Closed) Base URL: svn://svn.chromium.org/chrome/branches/1916/src/
Patch Set: Created 6 years, 8 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 | Annotate | Revision Log
OLDNEW
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/auto_reset.h" 7 #include "base/auto_reset.h"
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/callback_helpers.h" 10 #include "base/callback_helpers.h"
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 #if defined(OS_WIN) 87 #if defined(OS_WIN)
88 #include "content/browser/accessibility/browser_accessibility_manager_win.h" 88 #include "content/browser/accessibility/browser_accessibility_manager_win.h"
89 #include "content/browser/accessibility/browser_accessibility_win.h" 89 #include "content/browser/accessibility/browser_accessibility_win.h"
90 #include "content/browser/renderer_host/legacy_render_widget_host_win.h" 90 #include "content/browser/renderer_host/legacy_render_widget_host_win.h"
91 #include "content/common/plugin_constants_win.h" 91 #include "content/common/plugin_constants_win.h"
92 #include "ui/base/win/hidden_window.h" 92 #include "ui/base/win/hidden_window.h"
93 #include "ui/gfx/gdi_util.h" 93 #include "ui/gfx/gdi_util.h"
94 #include "ui/gfx/win/dpi.h" 94 #include "ui/gfx/win/dpi.h"
95 #endif 95 #endif
96 96
97 #if defined(OS_LINUX) && !defined(OS_CHROMEOS)
98 #include "content/common/input_messages.h"
99 #include "ui/events/x/text_edit_command_x11.h"
100 #include "ui/events/x/text_edit_key_bindings_delegate_x11.h"
101 #endif
102
97 using gfx::RectToSkIRect; 103 using gfx::RectToSkIRect;
98 using gfx::SkIRectToRect; 104 using gfx::SkIRectToRect;
99 105
100 using blink::WebScreenInfo; 106 using blink::WebScreenInfo;
101 using blink::WebTouchEvent; 107 using blink::WebTouchEvent;
102 108
103 namespace content { 109 namespace content {
104 110
105 namespace { 111 namespace {
106 112
(...skipping 2291 matching lines...) Expand 10 before | Expand all | Expand 10 after
2398 2404
2399 // Ignore character messages for VKEY_RETURN sent on CTRL+M. crbug.com/315547 2405 // Ignore character messages for VKEY_RETURN sent on CTRL+M. crbug.com/315547
2400 if (host_ && (accept_return_character_ || ch != ui::VKEY_RETURN)) { 2406 if (host_ && (accept_return_character_ || ch != ui::VKEY_RETURN)) {
2401 double now = ui::EventTimeForNow().InSecondsF(); 2407 double now = ui::EventTimeForNow().InSecondsF();
2402 // Send a blink::WebInputEvent::Char event to |host_|. 2408 // Send a blink::WebInputEvent::Char event to |host_|.
2403 NativeWebKeyboardEvent webkit_event(ui::ET_KEY_PRESSED, 2409 NativeWebKeyboardEvent webkit_event(ui::ET_KEY_PRESSED,
2404 true /* is_char */, 2410 true /* is_char */,
2405 ch, 2411 ch,
2406 flags, 2412 flags,
2407 now); 2413 now);
2408 host_->ForwardKeyboardEvent(webkit_event); 2414 ForwardKeyboardEvent(webkit_event);
2409 } 2415 }
2410 } 2416 }
2411 2417
2412 gfx::NativeWindow RenderWidgetHostViewAura::GetAttachedWindow() const { 2418 gfx::NativeWindow RenderWidgetHostViewAura::GetAttachedWindow() const {
2413 return window_; 2419 return window_;
2414 } 2420 }
2415 2421
2416 ui::TextInputType RenderWidgetHostViewAura::GetTextInputType() const { 2422 ui::TextInputType RenderWidgetHostViewAura::GetTextInputType() const {
2417 return text_input_type_; 2423 return text_input_type_;
2418 } 2424 }
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after
2786 } 2792 }
2787 2793
2788 // We don't have to communicate with an input method here. 2794 // We don't have to communicate with an input method here.
2789 if (!event->HasNativeEvent()) { 2795 if (!event->HasNativeEvent()) {
2790 NativeWebKeyboardEvent webkit_event( 2796 NativeWebKeyboardEvent webkit_event(
2791 event->type(), 2797 event->type(),
2792 event->is_char(), 2798 event->is_char(),
2793 event->is_char() ? event->GetCharacter() : event->key_code(), 2799 event->is_char() ? event->GetCharacter() : event->key_code(),
2794 event->flags(), 2800 event->flags(),
2795 ui::EventTimeForNow().InSecondsF()); 2801 ui::EventTimeForNow().InSecondsF());
2796 host_->ForwardKeyboardEvent(webkit_event); 2802 ForwardKeyboardEvent(webkit_event);
2797 } else { 2803 } else {
2798 NativeWebKeyboardEvent webkit_event(event); 2804 NativeWebKeyboardEvent webkit_event(event);
2799 host_->ForwardKeyboardEvent(webkit_event); 2805 ForwardKeyboardEvent(webkit_event);
2800 } 2806 }
2801 } 2807 }
2802 event->SetHandled(); 2808 event->SetHandled();
2803 } 2809 }
2804 2810
2805 void RenderWidgetHostViewAura::OnMouseEvent(ui::MouseEvent* event) { 2811 void RenderWidgetHostViewAura::OnMouseEvent(ui::MouseEvent* event) {
2806 TRACE_EVENT0("input", "RenderWidgetHostViewAura::OnMouseEvent"); 2812 TRACE_EVENT0("input", "RenderWidgetHostViewAura::OnMouseEvent");
2807 2813
2808 if (touch_editing_client_ && touch_editing_client_->HandleInputEvent(event)) 2814 if (touch_editing_client_ && touch_editing_client_->HandleInputEvent(event))
2809 return; 2815 return;
(...skipping 752 matching lines...) Expand 10 before | Expand all | Expand 10 after
3562 aura::WindowTreeHost* host = window_->GetHost(); 3568 aura::WindowTreeHost* host = window_->GetHost();
3563 return host ? host->compositor() : NULL; 3569 return host ? host->compositor() : NULL;
3564 } 3570 }
3565 3571
3566 void RenderWidgetHostViewAura::DetachFromInputMethod() { 3572 void RenderWidgetHostViewAura::DetachFromInputMethod() {
3567 ui::InputMethod* input_method = GetInputMethod(); 3573 ui::InputMethod* input_method = GetInputMethod();
3568 if (input_method && input_method->GetTextInputClient() == this) 3574 if (input_method && input_method->GetTextInputClient() == this)
3569 input_method->SetFocusedTextInputClient(NULL); 3575 input_method->SetFocusedTextInputClient(NULL);
3570 } 3576 }
3571 3577
3578 void RenderWidgetHostViewAura::ForwardKeyboardEvent(
3579 const NativeWebKeyboardEvent& event) {
3580 #if defined(OS_LINUX) && !defined(OS_CHROMEOS)
3581 ui::TextEditKeyBindingsDelegateX11* keybinding_delegate =
3582 ui::GetTextEditKeyBindingsDelegate();
3583 std::vector<ui::TextEditCommandX11> commands;
3584 if (!event.skip_in_browser &&
3585 keybinding_delegate &&
3586 event.os_event &&
3587 keybinding_delegate->MatchEvent(*event.os_event, &commands)) {
3588 // Transform from ui/ types to content/ types.
3589 EditCommands edit_commands;
3590 for (std::vector<ui::TextEditCommandX11>::const_iterator it =
3591 commands.begin(); it != commands.end(); ++it) {
3592 edit_commands.push_back(EditCommand(it->GetCommandString(),
3593 it->argument()));
3594 }
3595 host_->Send(new InputMsg_SetEditCommandsForNextKeyEvent(
3596 host_->GetRoutingID(), edit_commands));
3597 NativeWebKeyboardEvent copy_event(event);
3598 copy_event.match_edit_command = true;
3599 host_->ForwardKeyboardEvent(copy_event);
3600 return;
3601 }
3602 #endif
3603
3604 host_->ForwardKeyboardEvent(event);
3605 }
3606
3572 void RenderWidgetHostViewAura::LockResources() { 3607 void RenderWidgetHostViewAura::LockResources() {
3573 DCHECK(frame_provider_); 3608 DCHECK(frame_provider_);
3574 delegated_frame_evictor_->LockFrame(); 3609 delegated_frame_evictor_->LockFrame();
3575 } 3610 }
3576 3611
3577 void RenderWidgetHostViewAura::UnlockResources() { 3612 void RenderWidgetHostViewAura::UnlockResources() {
3578 DCHECK(frame_provider_); 3613 DCHECK(frame_provider_);
3579 delegated_frame_evictor_->UnlockFrame(); 3614 delegated_frame_evictor_->UnlockFrame();
3580 } 3615 }
3581 3616
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
3648 RenderWidgetHost* widget) { 3683 RenderWidgetHost* widget) {
3649 return new RenderWidgetHostViewAura(widget); 3684 return new RenderWidgetHostViewAura(widget);
3650 } 3685 }
3651 3686
3652 // static 3687 // static
3653 void RenderWidgetHostViewPort::GetDefaultScreenInfo(WebScreenInfo* results) { 3688 void RenderWidgetHostViewPort::GetDefaultScreenInfo(WebScreenInfo* results) {
3654 GetScreenInfoForWindow(results, NULL); 3689 GetScreenInfoForWindow(results, NULL);
3655 } 3690 }
3656 3691
3657 } // namespace content 3692 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/renderer_host/render_widget_host_view_aura.h ('k') | content/public/browser/native_web_keyboard_event.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698