Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(34)

Side by Side Diff: content/renderer/render_view_impl.cc

Issue 2566583002: Change allowed bindings to be per RenderFrame instead of per RenderView. (Closed)
Patch Set: Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 700 matching lines...) Expand 10 before | Expand all | Expand 10 after
711 } else { 711 } else {
712 OnEnableAutoResize(params.min_size, params.max_size); 712 OnEnableAutoResize(params.min_size, params.max_size);
713 } 713 }
714 714
715 // We don't use HistoryController in OOPIF-enabled modes. 715 // We don't use HistoryController in OOPIF-enabled modes.
716 if (!SiteIsolationPolicy::UseSubframeNavigationEntries()) 716 if (!SiteIsolationPolicy::UseSubframeNavigationEntries())
717 history_controller_.reset(new HistoryController(this)); 717 history_controller_.reset(new HistoryController(this));
718 718
719 new IdleUserDetector(this); 719 new IdleUserDetector(this);
720 720
721 if (command_line.HasSwitch(switches::kDomAutomationController))
722 enabled_bindings_ |= BINDINGS_POLICY_DOM_AUTOMATION;
723 if (command_line.HasSwitch(switches::kStatsCollectionController))
724 enabled_bindings_ |= BINDINGS_POLICY_STATS_COLLECTION;
725
726 GetContentClient()->renderer()->RenderViewCreated(this); 721 GetContentClient()->renderer()->RenderViewCreated(this);
727 722
728 // Ensure that sandbox flags are inherited from an opener in a different 723 // Ensure that sandbox flags are inherited from an opener in a different
729 // process. In that case, the browser process will set any inherited sandbox 724 // process. In that case, the browser process will set any inherited sandbox
730 // flags in |replicated_frame_state|, so apply them here. 725 // flags in |replicated_frame_state|, so apply them here.
731 if (!was_created_by_renderer && webview()->mainFrame()->isWebLocalFrame()) { 726 if (!was_created_by_renderer && webview()->mainFrame()->isWebLocalFrame()) {
732 webview()->mainFrame()->toWebLocalFrame()->forceSandboxFlags( 727 webview()->mainFrame()->toWebLocalFrame()->forceSandboxFlags(
733 params.replicated_frame_state.sandbox_flags); 728 params.replicated_frame_state.sandbox_flags);
734 } 729 }
735 730
(...skipping 468 matching lines...) Expand 10 before | Expand all | Expand 10 after
1204 return true; 1199 return true;
1205 } 1200 }
1206 1201
1207 bool handled = true; 1202 bool handled = true;
1208 IPC_BEGIN_MESSAGE_MAP(RenderViewImpl, message) 1203 IPC_BEGIN_MESSAGE_MAP(RenderViewImpl, message)
1209 IPC_MESSAGE_HANDLER(InputMsg_ExecuteEditCommand, OnExecuteEditCommand) 1204 IPC_MESSAGE_HANDLER(InputMsg_ExecuteEditCommand, OnExecuteEditCommand)
1210 IPC_MESSAGE_HANDLER(InputMsg_MoveCaret, OnMoveCaret) 1205 IPC_MESSAGE_HANDLER(InputMsg_MoveCaret, OnMoveCaret)
1211 IPC_MESSAGE_HANDLER(InputMsg_ScrollFocusedEditableNodeIntoRect, 1206 IPC_MESSAGE_HANDLER(InputMsg_ScrollFocusedEditableNodeIntoRect,
1212 OnScrollFocusedEditableNodeIntoRect) 1207 OnScrollFocusedEditableNodeIntoRect)
1213 IPC_MESSAGE_HANDLER(ViewMsg_SetPageScale, OnSetPageScale) 1208 IPC_MESSAGE_HANDLER(ViewMsg_SetPageScale, OnSetPageScale)
1214 IPC_MESSAGE_HANDLER(ViewMsg_AllowBindings, OnAllowBindings)
1215 IPC_MESSAGE_HANDLER(ViewMsg_SetInitialFocus, OnSetInitialFocus) 1209 IPC_MESSAGE_HANDLER(ViewMsg_SetInitialFocus, OnSetInitialFocus)
1216 IPC_MESSAGE_HANDLER(ViewMsg_UpdateTargetURL_ACK, OnUpdateTargetURLAck) 1210 IPC_MESSAGE_HANDLER(ViewMsg_UpdateTargetURL_ACK, OnUpdateTargetURLAck)
1217 IPC_MESSAGE_HANDLER(ViewMsg_UpdateWebPreferences, OnUpdateWebPreferences) 1211 IPC_MESSAGE_HANDLER(ViewMsg_UpdateWebPreferences, OnUpdateWebPreferences)
1218 IPC_MESSAGE_HANDLER(ViewMsg_EnumerateDirectoryResponse, 1212 IPC_MESSAGE_HANDLER(ViewMsg_EnumerateDirectoryResponse,
1219 OnEnumerateDirectoryResponse) 1213 OnEnumerateDirectoryResponse)
1220 IPC_MESSAGE_HANDLER(ViewMsg_ClosePage, OnClosePage) 1214 IPC_MESSAGE_HANDLER(ViewMsg_ClosePage, OnClosePage)
1221 IPC_MESSAGE_HANDLER(ViewMsg_MoveOrResizeStarted, OnMoveOrResizeStarted) 1215 IPC_MESSAGE_HANDLER(ViewMsg_MoveOrResizeStarted, OnMoveOrResizeStarted)
1222 IPC_MESSAGE_HANDLER(ViewMsg_SetBackgroundOpaque, OnSetBackgroundOpaque) 1216 IPC_MESSAGE_HANDLER(ViewMsg_SetBackgroundOpaque, OnSetBackgroundOpaque)
1223 IPC_MESSAGE_HANDLER(ViewMsg_EnablePreferredSizeChangedMode, 1217 IPC_MESSAGE_HANDLER(ViewMsg_EnablePreferredSizeChangedMode,
1224 OnEnablePreferredSizeChangedMode) 1218 OnEnablePreferredSizeChangedMode)
(...skipping 806 matching lines...) Expand 10 before | Expand all | Expand 10 after
2031 blink::WebFrameWidget* RenderViewImpl::GetWebFrameWidget() { 2025 blink::WebFrameWidget* RenderViewImpl::GetWebFrameWidget() {
2032 return frame_widget_; 2026 return frame_widget_;
2033 } 2027 }
2034 2028
2035 bool RenderViewImpl::ShouldDisplayScrollbars(int width, int height) const { 2029 bool RenderViewImpl::ShouldDisplayScrollbars(int width, int height) const {
2036 return (!send_preferred_size_changes_ || 2030 return (!send_preferred_size_changes_ ||
2037 (disable_scrollbars_size_limit_.width() <= width || 2031 (disable_scrollbars_size_limit_.width() <= width ||
2038 disable_scrollbars_size_limit_.height() <= height)); 2032 disable_scrollbars_size_limit_.height() <= height));
2039 } 2033 }
2040 2034
2041 int RenderViewImpl::GetEnabledBindings() const {
2042 return enabled_bindings_;
2043 }
2044
2045 bool RenderViewImpl::GetContentStateImmediately() const { 2035 bool RenderViewImpl::GetContentStateImmediately() const {
2046 return send_content_state_immediately_; 2036 return send_content_state_immediately_;
2047 } 2037 }
2048 2038
2049 void RenderViewImpl::OnSetPageScale(float page_scale_factor) { 2039 void RenderViewImpl::OnSetPageScale(float page_scale_factor) {
2050 if (!webview()) 2040 if (!webview())
2051 return; 2041 return;
2052 webview()->setPageScaleFactor(page_scale_factor); 2042 webview()->setPageScaleFactor(page_scale_factor);
2053 } 2043 }
2054 2044
(...skipping 12 matching lines...) Expand all
2067 if (uses_temporary_zoom_level_) 2057 if (uses_temporary_zoom_level_)
2068 return; 2058 return;
2069 break; 2059 break;
2070 default: 2060 default:
2071 NOTIMPLEMENTED(); 2061 NOTIMPLEMENTED();
2072 } 2062 }
2073 webview()->hidePopups(); 2063 webview()->hidePopups();
2074 SetZoomLevel(zoom_level); 2064 SetZoomLevel(zoom_level);
2075 } 2065 }
2076 2066
2077 void RenderViewImpl::OnAllowBindings(int enabled_bindings_flags) {
2078 if ((enabled_bindings_flags & BINDINGS_POLICY_WEB_UI) &&
2079 !(enabled_bindings_ & BINDINGS_POLICY_WEB_UI)) {
2080 // WebUIExtensionData deletes itself when we're destroyed.
2081 new WebUIExtensionData(this);
2082 }
2083
2084 enabled_bindings_ |= enabled_bindings_flags;
2085
2086 // Keep track of the total bindings accumulated in this process.
2087 RenderProcess::current()->AddBindings(enabled_bindings_flags);
2088
2089 if (main_render_frame_)
2090 main_render_frame_->MaybeEnableMojoBindings();
2091 }
2092
2093 void RenderViewImpl::OnUpdateWebPreferences(const WebPreferences& prefs) { 2067 void RenderViewImpl::OnUpdateWebPreferences(const WebPreferences& prefs) {
2094 webkit_preferences_ = prefs; 2068 webkit_preferences_ = prefs;
2095 ApplyWebPreferencesInternal(webkit_preferences_, webview(), compositor_deps_); 2069 ApplyWebPreferencesInternal(webkit_preferences_, webview(), compositor_deps_);
2096 } 2070 }
2097 2071
2098 void RenderViewImpl::OnEnumerateDirectoryResponse( 2072 void RenderViewImpl::OnEnumerateDirectoryResponse(
2099 int id, 2073 int id,
2100 const std::vector<base::FilePath>& paths) { 2074 const std::vector<base::FilePath>& paths) {
2101 if (!enumeration_completions_[id]) 2075 if (!enumeration_completions_[id])
2102 return; 2076 return;
(...skipping 630 matching lines...) Expand 10 before | Expand all | Expand 10 after
2733 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); 2707 INPUT_EVENT_ACK_STATE_NOT_CONSUMED);
2734 } 2708 }
2735 2709
2736 std::unique_ptr<InputEventAck> ack( 2710 std::unique_ptr<InputEventAck> ack(
2737 new InputEventAck(InputEventAckSource::MAIN_THREAD, input_event->type(), 2711 new InputEventAck(InputEventAckSource::MAIN_THREAD, input_event->type(),
2738 INPUT_EVENT_ACK_STATE_NOT_CONSUMED)); 2712 INPUT_EVENT_ACK_STATE_NOT_CONSUMED));
2739 OnInputEventAck(std::move(ack)); 2713 OnInputEventAck(std::move(ack));
2740 } 2714 }
2741 2715
2742 } // namespace content 2716 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698