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 <set> | 7 #include <set> |
8 | 8 |
9 #include "base/auto_reset.h" | 9 #include "base/auto_reset.h" |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 2713 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2724 } | 2724 } |
2725 | 2725 |
2726 void RenderWidgetHostViewAura::DetachFromInputMethod() { | 2726 void RenderWidgetHostViewAura::DetachFromInputMethod() { |
2727 ui::InputMethod* input_method = GetInputMethod(); | 2727 ui::InputMethod* input_method = GetInputMethod(); |
2728 if (input_method) | 2728 if (input_method) |
2729 input_method->DetachTextInputClient(this); | 2729 input_method->DetachTextInputClient(this); |
2730 } | 2730 } |
2731 | 2731 |
2732 void RenderWidgetHostViewAura::ForwardKeyboardEvent( | 2732 void RenderWidgetHostViewAura::ForwardKeyboardEvent( |
2733 const NativeWebKeyboardEvent& event) { | 2733 const NativeWebKeyboardEvent& event) { |
| 2734 RenderWidgetHostImpl* target_host = host_; |
| 2735 |
| 2736 // If there are multiple widgets on the page (such as when there are |
| 2737 // out-of-process iframes), pick the one that should process this event. |
| 2738 if (host_->delegate()) { |
| 2739 RenderWidgetHostImpl* focused_host = |
| 2740 host_->delegate()->GetFocusedRenderWidgetHost(); |
| 2741 if (focused_host) |
| 2742 target_host = focused_host; |
| 2743 } |
| 2744 |
2734 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) | 2745 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) |
2735 ui::TextEditKeyBindingsDelegateAuraLinux* keybinding_delegate = | 2746 ui::TextEditKeyBindingsDelegateAuraLinux* keybinding_delegate = |
2736 ui::GetTextEditKeyBindingsDelegate(); | 2747 ui::GetTextEditKeyBindingsDelegate(); |
2737 std::vector<ui::TextEditCommandAuraLinux> commands; | 2748 std::vector<ui::TextEditCommandAuraLinux> commands; |
2738 if (!event.skip_in_browser && | 2749 if (!event.skip_in_browser && |
2739 keybinding_delegate && | 2750 keybinding_delegate && |
2740 event.os_event && | 2751 event.os_event && |
2741 keybinding_delegate->MatchEvent(*event.os_event, &commands)) { | 2752 keybinding_delegate->MatchEvent(*event.os_event, &commands)) { |
2742 // Transform from ui/ types to content/ types. | 2753 // Transform from ui/ types to content/ types. |
2743 EditCommands edit_commands; | 2754 EditCommands edit_commands; |
2744 for (std::vector<ui::TextEditCommandAuraLinux>::const_iterator it = | 2755 for (std::vector<ui::TextEditCommandAuraLinux>::const_iterator it = |
2745 commands.begin(); it != commands.end(); ++it) { | 2756 commands.begin(); it != commands.end(); ++it) { |
2746 edit_commands.push_back(EditCommand(it->GetCommandString(), | 2757 edit_commands.push_back(EditCommand(it->GetCommandString(), |
2747 it->argument())); | 2758 it->argument())); |
2748 } | 2759 } |
2749 host_->Send(new InputMsg_SetEditCommandsForNextKeyEvent( | 2760 // TODO(alexmos): This needs to be refactored to work with subframe |
2750 host_->GetRoutingID(), edit_commands)); | 2761 // RenderWidgetHosts for OOPIF. See https://crbug.com/549334. |
| 2762 target_host->Send(new InputMsg_SetEditCommandsForNextKeyEvent( |
| 2763 target_host->GetRoutingID(), edit_commands)); |
| 2764 |
2751 NativeWebKeyboardEvent copy_event(event); | 2765 NativeWebKeyboardEvent copy_event(event); |
2752 copy_event.match_edit_command = true; | 2766 copy_event.match_edit_command = true; |
2753 host_->ForwardKeyboardEvent(copy_event); | 2767 target_host->ForwardKeyboardEvent(event); |
2754 return; | 2768 return; |
2755 } | 2769 } |
2756 #endif | 2770 #endif |
2757 | 2771 |
2758 host_->ForwardKeyboardEvent(event); | 2772 target_host->ForwardKeyboardEvent(event); |
2759 } | 2773 } |
2760 | 2774 |
2761 void RenderWidgetHostViewAura::SelectionUpdated(bool is_editable, | 2775 void RenderWidgetHostViewAura::SelectionUpdated(bool is_editable, |
2762 bool is_empty_text_form_control, | 2776 bool is_empty_text_form_control, |
2763 const ui::SelectionBound& start, | 2777 const ui::SelectionBound& start, |
2764 const ui::SelectionBound& end) { | 2778 const ui::SelectionBound& end) { |
2765 selection_controller_->OnSelectionEditable(is_editable); | 2779 selection_controller_->OnSelectionEditable(is_editable); |
2766 selection_controller_->OnSelectionEmpty(is_empty_text_form_control); | 2780 selection_controller_->OnSelectionEmpty(is_empty_text_form_control); |
2767 selection_controller_->OnSelectionBoundsChanged(start, end); | 2781 selection_controller_->OnSelectionBoundsChanged(start, end); |
2768 } | 2782 } |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2884 | 2898 |
2885 //////////////////////////////////////////////////////////////////////////////// | 2899 //////////////////////////////////////////////////////////////////////////////// |
2886 // RenderWidgetHostViewBase, public: | 2900 // RenderWidgetHostViewBase, public: |
2887 | 2901 |
2888 // static | 2902 // static |
2889 void RenderWidgetHostViewBase::GetDefaultScreenInfo(WebScreenInfo* results) { | 2903 void RenderWidgetHostViewBase::GetDefaultScreenInfo(WebScreenInfo* results) { |
2890 GetScreenInfoForWindow(results, NULL); | 2904 GetScreenInfoForWindow(results, NULL); |
2891 } | 2905 } |
2892 | 2906 |
2893 } // namespace content | 2907 } // namespace content |
OLD | NEW |