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/web_contents/web_contents_impl.h" | 5 #include "content/browser/web_contents/web_contents_impl.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <cmath> | 9 #include <cmath> |
10 #include <utility> | 10 #include <utility> |
(...skipping 2734 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2745 WebContentsImpl::GetOrCreateRootBrowserAccessibilityManager() { | 2745 WebContentsImpl::GetOrCreateRootBrowserAccessibilityManager() { |
2746 RenderFrameHostImpl* rfh = GetMainFrame(); | 2746 RenderFrameHostImpl* rfh = GetMainFrame(); |
2747 return rfh ? rfh->GetOrCreateBrowserAccessibilityManager() : nullptr; | 2747 return rfh ? rfh->GetOrCreateBrowserAccessibilityManager() : nullptr; |
2748 } | 2748 } |
2749 | 2749 |
2750 void WebContentsImpl::MoveRangeSelectionExtent(const gfx::Point& extent) { | 2750 void WebContentsImpl::MoveRangeSelectionExtent(const gfx::Point& extent) { |
2751 RenderFrameHost* focused_frame = GetFocusedFrame(); | 2751 RenderFrameHost* focused_frame = GetFocusedFrame(); |
2752 if (!focused_frame) | 2752 if (!focused_frame) |
2753 return; | 2753 return; |
2754 | 2754 |
2755 focused_frame->Send(new InputMsg_MoveRangeSelectionExtent( | 2755 focused_frame->GetFrameInputHandler()->MoveRangeSelectionExtent(extent); |
2756 focused_frame->GetRoutingID(), extent)); | |
2757 } | 2756 } |
2758 | 2757 |
2759 void WebContentsImpl::SelectRange(const gfx::Point& base, | 2758 void WebContentsImpl::SelectRange(const gfx::Point& base, |
2760 const gfx::Point& extent) { | 2759 const gfx::Point& extent) { |
2761 RenderFrameHost* focused_frame = GetFocusedFrame(); | 2760 RenderFrameHost* focused_frame = GetFocusedFrame(); |
2762 if (!focused_frame) | 2761 if (!focused_frame) |
2763 return; | 2762 return; |
2764 | 2763 |
2765 focused_frame->Send( | 2764 focused_frame->GetFrameInputHandler()->SelectRange(base, extent); |
2766 new InputMsg_SelectRange(focused_frame->GetRoutingID(), base, extent)); | |
2767 } | 2765 } |
2768 | 2766 |
2769 void WebContentsImpl::AdjustSelectionByCharacterOffset(int start_adjust, | 2767 void WebContentsImpl::AdjustSelectionByCharacterOffset(int start_adjust, |
2770 int end_adjust) { | 2768 int end_adjust) { |
2771 RenderFrameHost* focused_frame = GetFocusedFrame(); | 2769 RenderFrameHost* focused_frame = GetFocusedFrame(); |
2772 if (!focused_frame) | 2770 if (!focused_frame) |
2773 return; | 2771 return; |
2774 | 2772 |
2775 focused_frame->Send(new InputMsg_AdjustSelectionByCharacterOffset( | 2773 focused_frame->GetFrameInputHandler()->AdjustSelectionByCharacterOffset( |
2776 focused_frame->GetRoutingID(), start_adjust, end_adjust)); | 2774 start_adjust, end_adjust); |
2777 } | 2775 } |
2778 | 2776 |
2779 void WebContentsImpl::UpdatePreferredSize(const gfx::Size& pref_size) { | 2777 void WebContentsImpl::UpdatePreferredSize(const gfx::Size& pref_size) { |
2780 const gfx::Size old_size = GetPreferredSize(); | 2778 const gfx::Size old_size = GetPreferredSize(); |
2781 preferred_size_ = pref_size; | 2779 preferred_size_ = pref_size; |
2782 OnPreferredSizeChanged(old_size); | 2780 OnPreferredSizeChanged(old_size); |
2783 } | 2781 } |
2784 | 2782 |
2785 void WebContentsImpl::ResizeDueToAutoResize( | 2783 void WebContentsImpl::ResizeDueToAutoResize( |
2786 RenderWidgetHostImpl* render_widget_host, | 2784 RenderWidgetHostImpl* render_widget_host, |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2926 | 2924 |
2927 void WebContentsImpl::ReloadLoFiImages() { | 2925 void WebContentsImpl::ReloadLoFiImages() { |
2928 SendToAllFrames(new FrameMsg_ReloadLoFiImages(MSG_ROUTING_NONE)); | 2926 SendToAllFrames(new FrameMsg_ReloadLoFiImages(MSG_ROUTING_NONE)); |
2929 } | 2927 } |
2930 | 2928 |
2931 void WebContentsImpl::Undo() { | 2929 void WebContentsImpl::Undo() { |
2932 RenderFrameHost* focused_frame = GetFocusedFrame(); | 2930 RenderFrameHost* focused_frame = GetFocusedFrame(); |
2933 if (!focused_frame) | 2931 if (!focused_frame) |
2934 return; | 2932 return; |
2935 | 2933 |
2936 focused_frame->Send(new InputMsg_Undo(focused_frame->GetRoutingID())); | 2934 focused_frame->GetFrameInputHandler()->Undo(); |
2937 RecordAction(base::UserMetricsAction("Undo")); | 2935 RecordAction(base::UserMetricsAction("Undo")); |
2938 } | 2936 } |
2939 | 2937 |
2940 void WebContentsImpl::Redo() { | 2938 void WebContentsImpl::Redo() { |
2941 RenderFrameHost* focused_frame = GetFocusedFrame(); | 2939 RenderFrameHost* focused_frame = GetFocusedFrame(); |
2942 if (!focused_frame) | 2940 if (!focused_frame) |
2943 return; | 2941 return; |
2944 focused_frame->Send(new InputMsg_Redo(focused_frame->GetRoutingID())); | 2942 focused_frame->GetFrameInputHandler()->Redo(); |
2945 RecordAction(base::UserMetricsAction("Redo")); | 2943 RecordAction(base::UserMetricsAction("Redo")); |
2946 } | 2944 } |
2947 | 2945 |
2948 void WebContentsImpl::Cut() { | 2946 void WebContentsImpl::Cut() { |
2949 RenderFrameHost* focused_frame = GetFocusedFrame(); | 2947 RenderFrameHost* focused_frame = GetFocusedFrame(); |
2950 if (!focused_frame) | 2948 if (!focused_frame) |
2951 return; | 2949 return; |
2952 | 2950 |
2953 focused_frame->Send(new InputMsg_Cut(focused_frame->GetRoutingID())); | 2951 focused_frame->GetFrameInputHandler()->Cut(); |
2954 RecordAction(base::UserMetricsAction("Cut")); | 2952 RecordAction(base::UserMetricsAction("Cut")); |
2955 } | 2953 } |
2956 | 2954 |
2957 void WebContentsImpl::Copy() { | 2955 void WebContentsImpl::Copy() { |
2958 RenderFrameHost* focused_frame = GetFocusedFrame(); | 2956 RenderFrameHost* focused_frame = GetFocusedFrame(); |
2959 if (!focused_frame) | 2957 if (!focused_frame) |
2960 return; | 2958 return; |
2961 | 2959 |
2962 focused_frame->Send(new InputMsg_Copy(focused_frame->GetRoutingID())); | 2960 focused_frame->GetFrameInputHandler()->Copy(); |
2963 RecordAction(base::UserMetricsAction("Copy")); | 2961 RecordAction(base::UserMetricsAction("Copy")); |
2964 } | 2962 } |
2965 | 2963 |
2966 void WebContentsImpl::CopyToFindPboard() { | 2964 void WebContentsImpl::CopyToFindPboard() { |
2967 #if defined(OS_MACOSX) | 2965 #if defined(OS_MACOSX) |
2968 RenderFrameHost* focused_frame = GetFocusedFrame(); | 2966 RenderFrameHost* focused_frame = GetFocusedFrame(); |
2969 if (!focused_frame) | 2967 if (!focused_frame) |
2970 return; | 2968 return; |
2971 | 2969 |
2972 // Windows/Linux don't have the concept of a find pasteboard. | 2970 // Windows/Linux don't have the concept of a find pasteboard. |
2973 focused_frame->Send( | 2971 focused_frame->GetFrameInputHandler()->CopyToFindPboard(); |
2974 new InputMsg_CopyToFindPboard(focused_frame->GetRoutingID())); | |
2975 RecordAction(base::UserMetricsAction("CopyToFindPboard")); | 2972 RecordAction(base::UserMetricsAction("CopyToFindPboard")); |
2976 #endif | 2973 #endif |
2977 } | 2974 } |
2978 | 2975 |
2979 void WebContentsImpl::Paste() { | 2976 void WebContentsImpl::Paste() { |
2980 RenderFrameHost* focused_frame = GetFocusedFrame(); | 2977 RenderFrameHost* focused_frame = GetFocusedFrame(); |
2981 if (!focused_frame) | 2978 if (!focused_frame) |
2982 return; | 2979 return; |
2983 | 2980 |
2984 focused_frame->Send(new InputMsg_Paste(focused_frame->GetRoutingID())); | 2981 focused_frame->GetFrameInputHandler()->Paste(); |
2985 RecordAction(base::UserMetricsAction("Paste")); | 2982 RecordAction(base::UserMetricsAction("Paste")); |
2986 } | 2983 } |
2987 | 2984 |
2988 void WebContentsImpl::PasteAndMatchStyle() { | 2985 void WebContentsImpl::PasteAndMatchStyle() { |
2989 RenderFrameHost* focused_frame = GetFocusedFrame(); | 2986 RenderFrameHost* focused_frame = GetFocusedFrame(); |
2990 if (!focused_frame) | 2987 if (!focused_frame) |
2991 return; | 2988 return; |
2992 | 2989 |
2993 focused_frame->Send(new InputMsg_PasteAndMatchStyle( | 2990 focused_frame->GetFrameInputHandler()->PasteAndMatchStyle(); |
2994 focused_frame->GetRoutingID())); | |
2995 RecordAction(base::UserMetricsAction("PasteAndMatchStyle")); | 2991 RecordAction(base::UserMetricsAction("PasteAndMatchStyle")); |
2996 } | 2992 } |
2997 | 2993 |
2998 void WebContentsImpl::Delete() { | 2994 void WebContentsImpl::Delete() { |
2999 RenderFrameHost* focused_frame = GetFocusedFrame(); | 2995 RenderFrameHost* focused_frame = GetFocusedFrame(); |
3000 if (!focused_frame) | 2996 if (!focused_frame) |
3001 return; | 2997 return; |
3002 | 2998 |
3003 focused_frame->Send(new InputMsg_Delete(focused_frame->GetRoutingID())); | 2999 focused_frame->GetFrameInputHandler()->Delete(); |
3004 RecordAction(base::UserMetricsAction("DeleteSelection")); | 3000 RecordAction(base::UserMetricsAction("DeleteSelection")); |
3005 } | 3001 } |
3006 | 3002 |
3007 void WebContentsImpl::SelectAll() { | 3003 void WebContentsImpl::SelectAll() { |
3008 RenderFrameHost* focused_frame = GetFocusedFrame(); | 3004 RenderFrameHost* focused_frame = GetFocusedFrame(); |
3009 if (!focused_frame) | 3005 if (!focused_frame) |
3010 return; | 3006 return; |
3011 | 3007 |
3012 focused_frame->Send(new InputMsg_SelectAll(focused_frame->GetRoutingID())); | 3008 focused_frame->GetFrameInputHandler()->SelectAll(); |
3013 RecordAction(base::UserMetricsAction("SelectAll")); | 3009 RecordAction(base::UserMetricsAction("SelectAll")); |
3014 } | 3010 } |
3015 | 3011 |
3016 void WebContentsImpl::CollapseSelection() { | 3012 void WebContentsImpl::CollapseSelection() { |
3017 RenderFrameHost* focused_frame = GetFocusedFrame(); | 3013 RenderFrameHost* focused_frame = GetFocusedFrame(); |
3018 if (!focused_frame) | 3014 if (!focused_frame) |
3019 return; | 3015 return; |
3020 | 3016 |
3021 focused_frame->Send( | 3017 focused_frame->GetFrameInputHandler()->CollapseSelection(); |
3022 new InputMsg_CollapseSelection(focused_frame->GetRoutingID())); | |
3023 } | 3018 } |
3024 | 3019 |
3025 void WebContentsImpl::Replace(const base::string16& word) { | 3020 void WebContentsImpl::Replace(const base::string16& word) { |
3026 RenderFrameHost* focused_frame = GetFocusedFrame(); | 3021 RenderFrameHost* focused_frame = GetFocusedFrame(); |
3027 if (!focused_frame) | 3022 if (!focused_frame) |
3028 return; | 3023 return; |
3029 | 3024 |
3030 focused_frame->Send(new InputMsg_Replace( | 3025 focused_frame->GetFrameInputHandler()->Replace(word); |
3031 focused_frame->GetRoutingID(), word)); | |
3032 } | 3026 } |
3033 | 3027 |
3034 void WebContentsImpl::ReplaceMisspelling(const base::string16& word) { | 3028 void WebContentsImpl::ReplaceMisspelling(const base::string16& word) { |
3035 RenderFrameHost* focused_frame = GetFocusedFrame(); | 3029 RenderFrameHost* focused_frame = GetFocusedFrame(); |
3036 if (!focused_frame) | 3030 if (!focused_frame) |
3037 return; | 3031 return; |
3038 | 3032 |
3039 focused_frame->Send(new InputMsg_ReplaceMisspelling( | 3033 focused_frame->GetFrameInputHandler()->ReplaceMisspelling(word); |
3040 focused_frame->GetRoutingID(), word)); | |
3041 } | 3034 } |
3042 | 3035 |
3043 void WebContentsImpl::NotifyContextMenuClosed( | 3036 void WebContentsImpl::NotifyContextMenuClosed( |
3044 const CustomContextMenuContext& context) { | 3037 const CustomContextMenuContext& context) { |
3045 RenderFrameHost* focused_frame = GetFocusedFrame(); | 3038 RenderFrameHost* focused_frame = GetFocusedFrame(); |
3046 if (!focused_frame) | 3039 if (!focused_frame) |
3047 return; | 3040 return; |
3048 | 3041 |
3049 focused_frame->Send(new FrameMsg_ContextMenuClosed( | 3042 focused_frame->Send(new FrameMsg_ContextMenuClosed( |
3050 focused_frame->GetRoutingID(), context)); | 3043 focused_frame->GetRoutingID(), context)); |
(...skipping 2609 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5660 RenderViewHost* render_view_host = RenderViewHost::From(render_widget_host); | 5653 RenderViewHost* render_view_host = RenderViewHost::From(render_widget_host); |
5661 if (!render_view_host) | 5654 if (!render_view_host) |
5662 continue; | 5655 continue; |
5663 render_view_host_set.insert(render_view_host); | 5656 render_view_host_set.insert(render_view_host); |
5664 } | 5657 } |
5665 for (RenderViewHost* render_view_host : render_view_host_set) | 5658 for (RenderViewHost* render_view_host : render_view_host_set) |
5666 render_view_host->OnWebkitPreferencesChanged(); | 5659 render_view_host->OnWebkitPreferencesChanged(); |
5667 } | 5660 } |
5668 | 5661 |
5669 } // namespace content | 5662 } // namespace content |
OLD | NEW |