| 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 695 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 706 OnSetRendererPrefs(params.renderer_preferences); | 706 OnSetRendererPrefs(params.renderer_preferences); |
| 707 | 707 |
| 708 if (!params.enable_auto_resize) { | 708 if (!params.enable_auto_resize) { |
| 709 OnResize(params.initial_size); | 709 OnResize(params.initial_size); |
| 710 } else { | 710 } else { |
| 711 OnEnableAutoResize(params.min_size, params.max_size); | 711 OnEnableAutoResize(params.min_size, params.max_size); |
| 712 } | 712 } |
| 713 | 713 |
| 714 new IdleUserDetector(this); | 714 new IdleUserDetector(this); |
| 715 | 715 |
| 716 if (command_line.HasSwitch(switches::kDomAutomationController)) | |
| 717 enabled_bindings_ |= BINDINGS_POLICY_DOM_AUTOMATION; | |
| 718 if (command_line.HasSwitch(switches::kStatsCollectionController)) | |
| 719 enabled_bindings_ |= BINDINGS_POLICY_STATS_COLLECTION; | |
| 720 | |
| 721 GetContentClient()->renderer()->RenderViewCreated(this); | 716 GetContentClient()->renderer()->RenderViewCreated(this); |
| 722 | 717 |
| 723 // Ensure that sandbox flags are inherited from an opener in a different | 718 // Ensure that sandbox flags are inherited from an opener in a different |
| 724 // process. In that case, the browser process will set any inherited sandbox | 719 // process. In that case, the browser process will set any inherited sandbox |
| 725 // flags in |replicated_frame_state|, so apply them here. | 720 // flags in |replicated_frame_state|, so apply them here. |
| 726 if (!was_created_by_renderer && webview()->mainFrame()->isWebLocalFrame()) { | 721 if (!was_created_by_renderer && webview()->mainFrame()->isWebLocalFrame()) { |
| 727 webview()->mainFrame()->toWebLocalFrame()->forceSandboxFlags( | 722 webview()->mainFrame()->toWebLocalFrame()->forceSandboxFlags( |
| 728 params.replicated_frame_state.sandbox_flags); | 723 params.replicated_frame_state.sandbox_flags); |
| 729 } | 724 } |
| 730 | 725 |
| (...skipping 468 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1199 return true; | 1194 return true; |
| 1200 } | 1195 } |
| 1201 | 1196 |
| 1202 bool handled = true; | 1197 bool handled = true; |
| 1203 IPC_BEGIN_MESSAGE_MAP(RenderViewImpl, message) | 1198 IPC_BEGIN_MESSAGE_MAP(RenderViewImpl, message) |
| 1204 IPC_MESSAGE_HANDLER(InputMsg_ExecuteEditCommand, OnExecuteEditCommand) | 1199 IPC_MESSAGE_HANDLER(InputMsg_ExecuteEditCommand, OnExecuteEditCommand) |
| 1205 IPC_MESSAGE_HANDLER(InputMsg_MoveCaret, OnMoveCaret) | 1200 IPC_MESSAGE_HANDLER(InputMsg_MoveCaret, OnMoveCaret) |
| 1206 IPC_MESSAGE_HANDLER(InputMsg_ScrollFocusedEditableNodeIntoRect, | 1201 IPC_MESSAGE_HANDLER(InputMsg_ScrollFocusedEditableNodeIntoRect, |
| 1207 OnScrollFocusedEditableNodeIntoRect) | 1202 OnScrollFocusedEditableNodeIntoRect) |
| 1208 IPC_MESSAGE_HANDLER(ViewMsg_SetPageScale, OnSetPageScale) | 1203 IPC_MESSAGE_HANDLER(ViewMsg_SetPageScale, OnSetPageScale) |
| 1209 IPC_MESSAGE_HANDLER(ViewMsg_AllowBindings, OnAllowBindings) | |
| 1210 IPC_MESSAGE_HANDLER(ViewMsg_SetInitialFocus, OnSetInitialFocus) | 1204 IPC_MESSAGE_HANDLER(ViewMsg_SetInitialFocus, OnSetInitialFocus) |
| 1211 IPC_MESSAGE_HANDLER(ViewMsg_UpdateTargetURL_ACK, OnUpdateTargetURLAck) | 1205 IPC_MESSAGE_HANDLER(ViewMsg_UpdateTargetURL_ACK, OnUpdateTargetURLAck) |
| 1212 IPC_MESSAGE_HANDLER(ViewMsg_UpdateWebPreferences, OnUpdateWebPreferences) | 1206 IPC_MESSAGE_HANDLER(ViewMsg_UpdateWebPreferences, OnUpdateWebPreferences) |
| 1213 IPC_MESSAGE_HANDLER(ViewMsg_EnumerateDirectoryResponse, | 1207 IPC_MESSAGE_HANDLER(ViewMsg_EnumerateDirectoryResponse, |
| 1214 OnEnumerateDirectoryResponse) | 1208 OnEnumerateDirectoryResponse) |
| 1215 IPC_MESSAGE_HANDLER(ViewMsg_ClosePage, OnClosePage) | 1209 IPC_MESSAGE_HANDLER(ViewMsg_ClosePage, OnClosePage) |
| 1216 IPC_MESSAGE_HANDLER(ViewMsg_MoveOrResizeStarted, OnMoveOrResizeStarted) | 1210 IPC_MESSAGE_HANDLER(ViewMsg_MoveOrResizeStarted, OnMoveOrResizeStarted) |
| 1217 IPC_MESSAGE_HANDLER(ViewMsg_SetBackgroundOpaque, OnSetBackgroundOpaque) | 1211 IPC_MESSAGE_HANDLER(ViewMsg_SetBackgroundOpaque, OnSetBackgroundOpaque) |
| 1218 IPC_MESSAGE_HANDLER(ViewMsg_EnablePreferredSizeChangedMode, | 1212 IPC_MESSAGE_HANDLER(ViewMsg_EnablePreferredSizeChangedMode, |
| 1219 OnEnablePreferredSizeChangedMode) | 1213 OnEnablePreferredSizeChangedMode) |
| (...skipping 781 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2001 blink::WebFrameWidget* RenderViewImpl::GetWebFrameWidget() { | 1995 blink::WebFrameWidget* RenderViewImpl::GetWebFrameWidget() { |
| 2002 return frame_widget_; | 1996 return frame_widget_; |
| 2003 } | 1997 } |
| 2004 | 1998 |
| 2005 bool RenderViewImpl::ShouldDisplayScrollbars(int width, int height) const { | 1999 bool RenderViewImpl::ShouldDisplayScrollbars(int width, int height) const { |
| 2006 return (!send_preferred_size_changes_ || | 2000 return (!send_preferred_size_changes_ || |
| 2007 (disable_scrollbars_size_limit_.width() <= width || | 2001 (disable_scrollbars_size_limit_.width() <= width || |
| 2008 disable_scrollbars_size_limit_.height() <= height)); | 2002 disable_scrollbars_size_limit_.height() <= height)); |
| 2009 } | 2003 } |
| 2010 | 2004 |
| 2011 int RenderViewImpl::GetEnabledBindings() const { | |
| 2012 return enabled_bindings_; | |
| 2013 } | |
| 2014 | |
| 2015 bool RenderViewImpl::GetContentStateImmediately() const { | 2005 bool RenderViewImpl::GetContentStateImmediately() const { |
| 2016 return send_content_state_immediately_; | 2006 return send_content_state_immediately_; |
| 2017 } | 2007 } |
| 2018 | 2008 |
| 2019 void RenderViewImpl::OnSetPageScale(float page_scale_factor) { | 2009 void RenderViewImpl::OnSetPageScale(float page_scale_factor) { |
| 2020 if (!webview()) | 2010 if (!webview()) |
| 2021 return; | 2011 return; |
| 2022 webview()->setPageScaleFactor(page_scale_factor); | 2012 webview()->setPageScaleFactor(page_scale_factor); |
| 2023 } | 2013 } |
| 2024 | 2014 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 2037 if (uses_temporary_zoom_level_) | 2027 if (uses_temporary_zoom_level_) |
| 2038 return; | 2028 return; |
| 2039 break; | 2029 break; |
| 2040 default: | 2030 default: |
| 2041 NOTIMPLEMENTED(); | 2031 NOTIMPLEMENTED(); |
| 2042 } | 2032 } |
| 2043 webview()->hidePopups(); | 2033 webview()->hidePopups(); |
| 2044 SetZoomLevel(zoom_level); | 2034 SetZoomLevel(zoom_level); |
| 2045 } | 2035 } |
| 2046 | 2036 |
| 2047 void RenderViewImpl::OnAllowBindings(int enabled_bindings_flags) { | |
| 2048 if ((enabled_bindings_flags & BINDINGS_POLICY_WEB_UI) && | |
| 2049 !(enabled_bindings_ & BINDINGS_POLICY_WEB_UI)) { | |
| 2050 // WebUIExtensionData deletes itself when we're destroyed. | |
| 2051 new WebUIExtensionData(this); | |
| 2052 } | |
| 2053 | |
| 2054 enabled_bindings_ |= enabled_bindings_flags; | |
| 2055 | |
| 2056 // Keep track of the total bindings accumulated in this process. | |
| 2057 RenderProcess::current()->AddBindings(enabled_bindings_flags); | |
| 2058 | |
| 2059 if (main_render_frame_) | |
| 2060 main_render_frame_->MaybeEnableMojoBindings(); | |
| 2061 } | |
| 2062 | |
| 2063 void RenderViewImpl::OnUpdateWebPreferences(const WebPreferences& prefs) { | 2037 void RenderViewImpl::OnUpdateWebPreferences(const WebPreferences& prefs) { |
| 2064 webkit_preferences_ = prefs; | 2038 webkit_preferences_ = prefs; |
| 2065 ApplyWebPreferencesInternal(webkit_preferences_, webview(), compositor_deps_); | 2039 ApplyWebPreferencesInternal(webkit_preferences_, webview(), compositor_deps_); |
| 2066 } | 2040 } |
| 2067 | 2041 |
| 2068 void RenderViewImpl::OnEnumerateDirectoryResponse( | 2042 void RenderViewImpl::OnEnumerateDirectoryResponse( |
| 2069 int id, | 2043 int id, |
| 2070 const std::vector<base::FilePath>& paths) { | 2044 const std::vector<base::FilePath>& paths) { |
| 2071 if (!enumeration_completions_[id]) | 2045 if (!enumeration_completions_[id]) |
| 2072 return; | 2046 return; |
| (...skipping 642 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2715 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); | 2689 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); |
| 2716 } | 2690 } |
| 2717 | 2691 |
| 2718 std::unique_ptr<InputEventAck> ack( | 2692 std::unique_ptr<InputEventAck> ack( |
| 2719 new InputEventAck(InputEventAckSource::MAIN_THREAD, input_event->type(), | 2693 new InputEventAck(InputEventAckSource::MAIN_THREAD, input_event->type(), |
| 2720 INPUT_EVENT_ACK_STATE_NOT_CONSUMED)); | 2694 INPUT_EVENT_ACK_STATE_NOT_CONSUMED)); |
| 2721 OnInputEventAck(std::move(ack)); | 2695 OnInputEventAck(std::move(ack)); |
| 2722 } | 2696 } |
| 2723 | 2697 |
| 2724 } // namespace content | 2698 } // namespace content |
| OLD | NEW |