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 | |
2745 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) | 2734 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) |
2746 ui::TextEditKeyBindingsDelegateAuraLinux* keybinding_delegate = | 2735 ui::TextEditKeyBindingsDelegateAuraLinux* keybinding_delegate = |
2747 ui::GetTextEditKeyBindingsDelegate(); | 2736 ui::GetTextEditKeyBindingsDelegate(); |
2748 std::vector<ui::TextEditCommandAuraLinux> commands; | 2737 std::vector<ui::TextEditCommandAuraLinux> commands; |
2749 if (!event.skip_in_browser && | 2738 if (!event.skip_in_browser && |
2750 keybinding_delegate && | 2739 keybinding_delegate && |
2751 event.os_event && | 2740 event.os_event && |
2752 keybinding_delegate->MatchEvent(*event.os_event, &commands)) { | 2741 keybinding_delegate->MatchEvent(*event.os_event, &commands)) { |
2753 // Transform from ui/ types to content/ types. | 2742 // Transform from ui/ types to content/ types. |
2754 EditCommands edit_commands; | 2743 EditCommands edit_commands; |
2755 for (std::vector<ui::TextEditCommandAuraLinux>::const_iterator it = | 2744 for (std::vector<ui::TextEditCommandAuraLinux>::const_iterator it = |
2756 commands.begin(); it != commands.end(); ++it) { | 2745 commands.begin(); it != commands.end(); ++it) { |
2757 edit_commands.push_back(EditCommand(it->GetCommandString(), | 2746 edit_commands.push_back(EditCommand(it->GetCommandString(), |
2758 it->argument())); | 2747 it->argument())); |
2759 } | 2748 } |
2760 // TODO(alexmos): This needs to be refactored to work with subframe | 2749 host_->Send(new InputMsg_SetEditCommandsForNextKeyEvent( |
2761 // RenderWidgetHosts for OOPIF. See https://crbug.com/549334. | 2750 host_->GetRoutingID(), edit_commands)); |
2762 target_host->Send(new InputMsg_SetEditCommandsForNextKeyEvent( | |
2763 target_host->GetRoutingID(), edit_commands)); | |
2764 | |
2765 NativeWebKeyboardEvent copy_event(event); | 2751 NativeWebKeyboardEvent copy_event(event); |
2766 copy_event.match_edit_command = true; | 2752 copy_event.match_edit_command = true; |
2767 target_host->ForwardKeyboardEvent(event); | 2753 host_->ForwardKeyboardEvent(copy_event); |
2768 return; | 2754 return; |
2769 } | 2755 } |
2770 #endif | 2756 #endif |
2771 | 2757 |
2772 target_host->ForwardKeyboardEvent(event); | 2758 host_->ForwardKeyboardEvent(event); |
2773 } | 2759 } |
2774 | 2760 |
2775 void RenderWidgetHostViewAura::SelectionUpdated(bool is_editable, | 2761 void RenderWidgetHostViewAura::SelectionUpdated(bool is_editable, |
2776 bool is_empty_text_form_control, | 2762 bool is_empty_text_form_control, |
2777 const ui::SelectionBound& start, | 2763 const ui::SelectionBound& start, |
2778 const ui::SelectionBound& end) { | 2764 const ui::SelectionBound& end) { |
2779 selection_controller_->OnSelectionEditable(is_editable); | 2765 selection_controller_->OnSelectionEditable(is_editable); |
2780 selection_controller_->OnSelectionEmpty(is_empty_text_form_control); | 2766 selection_controller_->OnSelectionEmpty(is_empty_text_form_control); |
2781 selection_controller_->OnSelectionBoundsChanged(start, end); | 2767 selection_controller_->OnSelectionBoundsChanged(start, end); |
2782 } | 2768 } |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2898 | 2884 |
2899 //////////////////////////////////////////////////////////////////////////////// | 2885 //////////////////////////////////////////////////////////////////////////////// |
2900 // RenderWidgetHostViewBase, public: | 2886 // RenderWidgetHostViewBase, public: |
2901 | 2887 |
2902 // static | 2888 // static |
2903 void RenderWidgetHostViewBase::GetDefaultScreenInfo(WebScreenInfo* results) { | 2889 void RenderWidgetHostViewBase::GetDefaultScreenInfo(WebScreenInfo* results) { |
2904 GetScreenInfoForWindow(results, NULL); | 2890 GetScreenInfoForWindow(results, NULL); |
2905 } | 2891 } |
2906 | 2892 |
2907 } // namespace content | 2893 } // namespace content |
OLD | NEW |