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

Side by Side Diff: chrome/renderer/chrome_render_view_observer.cc

Issue 2566583002: Change allowed bindings to be per RenderFrame instead of per RenderView. (Closed)
Patch Set: Created 4 years 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 "chrome/renderer/chrome_render_view_observer.h" 5 #include "chrome/renderer/chrome_render_view_observer.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 render_view()->GetWebView()->setPageOverlayColor(greyish); 156 render_view()->GetWebView()->setPageOverlayColor(greyish);
157 } else { 157 } else {
158 render_view()->GetWebView()->setPageOverlayColor(SK_ColorTRANSPARENT); 158 render_view()->GetWebView()->setPageOverlayColor(SK_ColorTRANSPARENT);
159 } 159 }
160 } 160 }
161 #endif 161 #endif
162 162
163 void ChromeRenderViewObserver::DidCommitProvisionalLoad( 163 void ChromeRenderViewObserver::DidCommitProvisionalLoad(
164 blink::WebLocalFrame* frame, 164 blink::WebLocalFrame* frame,
165 bool is_new_navigation) { 165 bool is_new_navigation) {
166 if ((render_view()->GetEnabledBindings() & content::BINDINGS_POLICY_WEB_UI) && 166 auto* render_frame = content::RenderFrame::FromWebFrame(frame);
167 if (render_frame->IsMainFrame() &&
168 (render_frame->GetEnabledBindings() & content::BINDINGS_POLICY_WEB_UI) &&
167 !webui_javascript_.empty()) { 169 !webui_javascript_.empty()) {
168 for (const auto& script : webui_javascript_) 170 for (const auto& script : webui_javascript_)
169 render_view()->GetMainRenderFrame()->ExecuteJavaScript(script); 171 render_view()->GetMainRenderFrame()->ExecuteJavaScript(script);
170 webui_javascript_.clear(); 172 webui_javascript_.clear();
171 } 173 }
172 } 174 }
173 175
174 void ChromeRenderViewObserver::OnDestruct() { 176 void ChromeRenderViewObserver::OnDestruct() {
175 delete this; 177 delete this;
176 } 178 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698