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/renderer/render_view_impl.h" | 5 #include "content/renderer/render_view_impl.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <cmath> | 8 #include <cmath> |
9 #include <memory> | 9 #include <memory> |
10 | 10 |
(...skipping 698 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
709 } else { | 709 } else { |
710 OnEnableAutoResize(params.min_size, params.max_size); | 710 OnEnableAutoResize(params.min_size, params.max_size); |
711 } | 711 } |
712 | 712 |
713 // We don't use HistoryController in OOPIF-enabled modes. | 713 // We don't use HistoryController in OOPIF-enabled modes. |
714 if (!SiteIsolationPolicy::UseSubframeNavigationEntries()) | 714 if (!SiteIsolationPolicy::UseSubframeNavigationEntries()) |
715 history_controller_.reset(new HistoryController(this)); | 715 history_controller_.reset(new HistoryController(this)); |
716 | 716 |
717 new IdleUserDetector(this); | 717 new IdleUserDetector(this); |
718 | 718 |
719 if (command_line.HasSwitch(switches::kDomAutomationController)) | |
720 enabled_bindings_ |= BINDINGS_POLICY_DOM_AUTOMATION; | |
721 if (command_line.HasSwitch(switches::kStatsCollectionController)) | |
722 enabled_bindings_ |= BINDINGS_POLICY_STATS_COLLECTION; | |
723 | |
724 GetContentClient()->renderer()->RenderViewCreated(this); | 719 GetContentClient()->renderer()->RenderViewCreated(this); |
725 | 720 |
726 // Ensure that sandbox flags are inherited from an opener in a different | 721 // Ensure that sandbox flags are inherited from an opener in a different |
727 // process. In that case, the browser process will set any inherited sandbox | 722 // process. In that case, the browser process will set any inherited sandbox |
728 // flags in |replicated_frame_state|, so apply them here. | 723 // flags in |replicated_frame_state|, so apply them here. |
729 if (!was_created_by_renderer && webview()->mainFrame()->isWebLocalFrame()) { | 724 if (!was_created_by_renderer && webview()->mainFrame()->isWebLocalFrame()) { |
730 webview()->mainFrame()->toWebLocalFrame()->forceSandboxFlags( | 725 webview()->mainFrame()->toWebLocalFrame()->forceSandboxFlags( |
731 params.replicated_frame_state.sandbox_flags); | 726 params.replicated_frame_state.sandbox_flags); |
732 } | 727 } |
733 | 728 |
(...skipping 467 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1201 } | 1196 } |
1202 | 1197 |
1203 bool handled = true; | 1198 bool handled = true; |
1204 IPC_BEGIN_MESSAGE_MAP(RenderViewImpl, message) | 1199 IPC_BEGIN_MESSAGE_MAP(RenderViewImpl, message) |
1205 IPC_MESSAGE_HANDLER(InputMsg_ExecuteEditCommand, OnExecuteEditCommand) | 1200 IPC_MESSAGE_HANDLER(InputMsg_ExecuteEditCommand, OnExecuteEditCommand) |
1206 IPC_MESSAGE_HANDLER(InputMsg_MoveCaret, OnMoveCaret) | 1201 IPC_MESSAGE_HANDLER(InputMsg_MoveCaret, OnMoveCaret) |
1207 IPC_MESSAGE_HANDLER(InputMsg_ScrollFocusedEditableNodeIntoRect, | 1202 IPC_MESSAGE_HANDLER(InputMsg_ScrollFocusedEditableNodeIntoRect, |
1208 OnScrollFocusedEditableNodeIntoRect) | 1203 OnScrollFocusedEditableNodeIntoRect) |
1209 IPC_MESSAGE_HANDLER(ViewMsg_SetPageScale, OnSetPageScale) | 1204 IPC_MESSAGE_HANDLER(ViewMsg_SetPageScale, OnSetPageScale) |
1210 IPC_MESSAGE_HANDLER(ViewMsg_Zoom, OnZoom) | 1205 IPC_MESSAGE_HANDLER(ViewMsg_Zoom, OnZoom) |
1211 IPC_MESSAGE_HANDLER(ViewMsg_AllowBindings, OnAllowBindings) | |
1212 IPC_MESSAGE_HANDLER(ViewMsg_SetInitialFocus, OnSetInitialFocus) | 1206 IPC_MESSAGE_HANDLER(ViewMsg_SetInitialFocus, OnSetInitialFocus) |
1213 IPC_MESSAGE_HANDLER(ViewMsg_UpdateTargetURL_ACK, OnUpdateTargetURLAck) | 1207 IPC_MESSAGE_HANDLER(ViewMsg_UpdateTargetURL_ACK, OnUpdateTargetURLAck) |
1214 IPC_MESSAGE_HANDLER(ViewMsg_UpdateWebPreferences, OnUpdateWebPreferences) | 1208 IPC_MESSAGE_HANDLER(ViewMsg_UpdateWebPreferences, OnUpdateWebPreferences) |
1215 IPC_MESSAGE_HANDLER(ViewMsg_EnumerateDirectoryResponse, | 1209 IPC_MESSAGE_HANDLER(ViewMsg_EnumerateDirectoryResponse, |
1216 OnEnumerateDirectoryResponse) | 1210 OnEnumerateDirectoryResponse) |
1217 IPC_MESSAGE_HANDLER(ViewMsg_ClosePage, OnClosePage) | 1211 IPC_MESSAGE_HANDLER(ViewMsg_ClosePage, OnClosePage) |
1218 IPC_MESSAGE_HANDLER(ViewMsg_MoveOrResizeStarted, OnMoveOrResizeStarted) | 1212 IPC_MESSAGE_HANDLER(ViewMsg_MoveOrResizeStarted, OnMoveOrResizeStarted) |
1219 IPC_MESSAGE_HANDLER(ViewMsg_ClearFocusedElement, OnClearFocusedElement) | 1213 IPC_MESSAGE_HANDLER(ViewMsg_ClearFocusedElement, OnClearFocusedElement) |
1220 IPC_MESSAGE_HANDLER(ViewMsg_SetBackgroundOpaque, OnSetBackgroundOpaque) | 1214 IPC_MESSAGE_HANDLER(ViewMsg_SetBackgroundOpaque, OnSetBackgroundOpaque) |
1221 IPC_MESSAGE_HANDLER(ViewMsg_EnablePreferredSizeChangedMode, | 1215 IPC_MESSAGE_HANDLER(ViewMsg_EnablePreferredSizeChangedMode, |
(...skipping 846 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2068 blink::WebFrameWidget* RenderViewImpl::GetWebFrameWidget() { | 2062 blink::WebFrameWidget* RenderViewImpl::GetWebFrameWidget() { |
2069 return frame_widget_; | 2063 return frame_widget_; |
2070 } | 2064 } |
2071 | 2065 |
2072 bool RenderViewImpl::ShouldDisplayScrollbars(int width, int height) const { | 2066 bool RenderViewImpl::ShouldDisplayScrollbars(int width, int height) const { |
2073 return (!send_preferred_size_changes_ || | 2067 return (!send_preferred_size_changes_ || |
2074 (disable_scrollbars_size_limit_.width() <= width || | 2068 (disable_scrollbars_size_limit_.width() <= width || |
2075 disable_scrollbars_size_limit_.height() <= height)); | 2069 disable_scrollbars_size_limit_.height() <= height)); |
2076 } | 2070 } |
2077 | 2071 |
2078 int RenderViewImpl::GetEnabledBindings() const { | |
2079 return enabled_bindings_; | |
2080 } | |
2081 | |
2082 bool RenderViewImpl::GetContentStateImmediately() const { | 2072 bool RenderViewImpl::GetContentStateImmediately() const { |
2083 return send_content_state_immediately_; | 2073 return send_content_state_immediately_; |
2084 } | 2074 } |
2085 | 2075 |
2086 void RenderViewImpl::OnSetPageScale(float page_scale_factor) { | 2076 void RenderViewImpl::OnSetPageScale(float page_scale_factor) { |
2087 if (!webview()) | 2077 if (!webview()) |
2088 return; | 2078 return; |
2089 webview()->setPageScaleFactor(page_scale_factor); | 2079 webview()->setPageScaleFactor(page_scale_factor); |
2090 } | 2080 } |
2091 | 2081 |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2134 if (uses_temporary_zoom_level_) | 2124 if (uses_temporary_zoom_level_) |
2135 return; | 2125 return; |
2136 break; | 2126 break; |
2137 default: | 2127 default: |
2138 NOTIMPLEMENTED(); | 2128 NOTIMPLEMENTED(); |
2139 } | 2129 } |
2140 webview()->hidePopups(); | 2130 webview()->hidePopups(); |
2141 SetZoomLevel(zoom_level); | 2131 SetZoomLevel(zoom_level); |
2142 } | 2132 } |
2143 | 2133 |
2144 void RenderViewImpl::OnAllowBindings(int enabled_bindings_flags) { | |
2145 if ((enabled_bindings_flags & BINDINGS_POLICY_WEB_UI) && | |
2146 !(enabled_bindings_ & BINDINGS_POLICY_WEB_UI)) { | |
2147 // WebUIExtensionData deletes itself when we're destroyed. | |
2148 new WebUIExtensionData(this); | |
2149 } | |
2150 | |
2151 enabled_bindings_ |= enabled_bindings_flags; | |
2152 | |
2153 // Keep track of the total bindings accumulated in this process. | |
2154 RenderProcess::current()->AddBindings(enabled_bindings_flags); | |
2155 | |
2156 if (main_render_frame_) | |
2157 main_render_frame_->MaybeEnableMojoBindings(); | |
2158 } | |
2159 | |
2160 void RenderViewImpl::OnUpdateWebPreferences(const WebPreferences& prefs) { | 2134 void RenderViewImpl::OnUpdateWebPreferences(const WebPreferences& prefs) { |
2161 webkit_preferences_ = prefs; | 2135 webkit_preferences_ = prefs; |
2162 ApplyWebPreferencesInternal(webkit_preferences_, webview(), compositor_deps_); | 2136 ApplyWebPreferencesInternal(webkit_preferences_, webview(), compositor_deps_); |
2163 } | 2137 } |
2164 | 2138 |
2165 void RenderViewImpl::OnEnumerateDirectoryResponse( | 2139 void RenderViewImpl::OnEnumerateDirectoryResponse( |
2166 int id, | 2140 int id, |
2167 const std::vector<base::FilePath>& paths) { | 2141 const std::vector<base::FilePath>& paths) { |
2168 if (!enumeration_completions_[id]) | 2142 if (!enumeration_completions_[id]) |
2169 return; | 2143 return; |
(...skipping 649 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2819 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); | 2793 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); |
2820 } | 2794 } |
2821 | 2795 |
2822 std::unique_ptr<InputEventAck> ack( | 2796 std::unique_ptr<InputEventAck> ack( |
2823 new InputEventAck(InputEventAckSource::MAIN_THREAD, input_event->type, | 2797 new InputEventAck(InputEventAckSource::MAIN_THREAD, input_event->type, |
2824 INPUT_EVENT_ACK_STATE_NOT_CONSUMED)); | 2798 INPUT_EVENT_ACK_STATE_NOT_CONSUMED)); |
2825 OnInputEventAck(std::move(ack)); | 2799 OnInputEventAck(std::move(ack)); |
2826 } | 2800 } |
2827 | 2801 |
2828 } // namespace content | 2802 } // namespace content |
OLD | NEW |