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

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

Issue 10873038: Replacing WebUIBindings use of CPPBoundClass with v8::Extension. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 years, 3 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 <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 #include "content/renderer/render_widget_fullscreen_pepper.h" 90 #include "content/renderer/render_widget_fullscreen_pepper.h"
91 #include "content/renderer/renderer_accessibility.h" 91 #include "content/renderer/renderer_accessibility.h"
92 #include "content/renderer/renderer_accessibility_complete.h" 92 #include "content/renderer/renderer_accessibility_complete.h"
93 #include "content/renderer/renderer_accessibility_focus_only.h" 93 #include "content/renderer/renderer_accessibility_focus_only.h"
94 #include "content/renderer/renderer_webapplicationcachehost_impl.h" 94 #include "content/renderer/renderer_webapplicationcachehost_impl.h"
95 #include "content/renderer/renderer_webcolorchooser_impl.h" 95 #include "content/renderer/renderer_webcolorchooser_impl.h"
96 #include "content/renderer/speech_recognition_dispatcher.h" 96 #include "content/renderer/speech_recognition_dispatcher.h"
97 #include "content/renderer/text_input_client_observer.h" 97 #include "content/renderer/text_input_client_observer.h"
98 #include "content/renderer/v8_value_converter_impl.h" 98 #include "content/renderer/v8_value_converter_impl.h"
99 #include "content/renderer/web_intents_host.h" 99 #include "content/renderer/web_intents_host.h"
100 #include "content/renderer/web_ui_bindings.h"
101 #include "content/renderer/webplugin_delegate_proxy.h" 100 #include "content/renderer/webplugin_delegate_proxy.h"
102 #include "content/renderer/websharedworker_proxy.h" 101 #include "content/renderer/websharedworker_proxy.h"
103 #include "media/base/filter_collection.h" 102 #include "media/base/filter_collection.h"
104 #include "media/base/media_switches.h" 103 #include "media/base/media_switches.h"
105 #include "media/base/message_loop_factory.h" 104 #include "media/base/message_loop_factory.h"
106 #include "media/filters/audio_renderer_impl.h" 105 #include "media/filters/audio_renderer_impl.h"
107 #include "media/filters/gpu_video_decoder.h" 106 #include "media/filters/gpu_video_decoder.h"
108 #include "net/base/data_url.h" 107 #include "net/base/data_url.h"
109 #include "net/base/escape.h" 108 #include "net/base/escape.h"
110 #include "net/base/net_errors.h" 109 #include "net/base/net_errors.h"
(...skipping 3099 matching lines...) Expand 10 before | Expand all | Expand 10 after
3210 completed_client_redirect_src_ = Referrer(); 3209 completed_client_redirect_src_ = Referrer();
3211 3210
3212 // Check whether we have new encoding name. 3211 // Check whether we have new encoding name.
3213 UpdateEncoding(frame, frame->view()->pageEncoding().utf8()); 3212 UpdateEncoding(frame, frame->view()->pageEncoding().utf8());
3214 } 3213 }
3215 3214
3216 void RenderViewImpl::didClearWindowObject(WebFrame* frame) { 3215 void RenderViewImpl::didClearWindowObject(WebFrame* frame) {
3217 FOR_EACH_OBSERVER(RenderViewObserver, observers_, 3216 FOR_EACH_OBSERVER(RenderViewObserver, observers_,
3218 DidClearWindowObject(frame)); 3217 DidClearWindowObject(frame));
3219 3218
3220 GURL frame_url = frame->document().url();
3221 if ((enabled_bindings_ & content::BINDINGS_POLICY_WEB_UI) &&
3222 (frame_url.SchemeIs(chrome::kChromeUIScheme) ||
3223 frame_url.SchemeIs(chrome::kDataScheme))) {
3224 GetWebUIBindings()->BindToJavascript(frame, "chrome");
3225 }
3226
3227 if (enabled_bindings_ & content::BINDINGS_POLICY_DOM_AUTOMATION) { 3219 if (enabled_bindings_ & content::BINDINGS_POLICY_DOM_AUTOMATION) {
3228 if (!dom_automation_controller_.get()) 3220 if (!dom_automation_controller_.get())
3229 dom_automation_controller_.reset(new DomAutomationController()); 3221 dom_automation_controller_.reset(new DomAutomationController());
3230 dom_automation_controller_->set_message_sender( 3222 dom_automation_controller_->set_message_sender(
3231 static_cast<content::RenderView*>(this)); 3223 static_cast<content::RenderView*>(this));
3232 dom_automation_controller_->set_routing_id(routing_id()); 3224 dom_automation_controller_->set_routing_id(routing_id());
3233 dom_automation_controller_->BindToJavascript(frame, 3225 dom_automation_controller_->BindToJavascript(frame,
3234 "domAutomationController"); 3226 "domAutomationController");
3235 } 3227 }
3236 } 3228 }
(...skipping 1086 matching lines...) Expand 10 before | Expand all | Expand 10 after
4323 4315
4324 GURL RenderViewImpl::GetLoadingUrl(WebKit::WebFrame* frame) const { 4316 GURL RenderViewImpl::GetLoadingUrl(WebKit::WebFrame* frame) const {
4325 WebDataSource* ds = frame->dataSource(); 4317 WebDataSource* ds = frame->dataSource();
4326 if (ds->hasUnreachableURL()) 4318 if (ds->hasUnreachableURL())
4327 return ds->unreachableURL(); 4319 return ds->unreachableURL();
4328 4320
4329 const WebURLRequest& request = ds->request(); 4321 const WebURLRequest& request = ds->request();
4330 return request.url(); 4322 return request.url();
4331 } 4323 }
4332 4324
4333 WebUIBindings* RenderViewImpl::GetWebUIBindings() {
4334 if (!web_ui_bindings_.get()) {
4335 web_ui_bindings_.reset(new WebUIBindings(
4336 static_cast<content::RenderView*>(this), routing_id_));
4337 }
4338 return web_ui_bindings_.get();
4339 }
4340
4341 WebKit::WebPlugin* RenderViewImpl::GetWebPluginFromPluginDocument() { 4325 WebKit::WebPlugin* RenderViewImpl::GetWebPluginFromPluginDocument() {
4342 return webview()->mainFrame()->document().to<WebPluginDocument>().plugin(); 4326 return webview()->mainFrame()->document().to<WebPluginDocument>().plugin();
4343 } 4327 }
4344 4328
4345 void RenderViewImpl::OnFind(int request_id, const string16& search_text, 4329 void RenderViewImpl::OnFind(int request_id, const string16& search_text,
4346 const WebFindOptions& options) { 4330 const WebFindOptions& options) {
4347 WebFrame* main_frame = webview()->mainFrame(); 4331 WebFrame* main_frame = webview()->mainFrame();
4348 4332
4349 // Check if the plugin still exists in the document. 4333 // Check if the plugin still exists in the document.
4350 if (main_frame->document().isPluginDocument() && 4334 if (main_frame->document().isPluginDocument() &&
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after
4656 4640
4657 void RenderViewImpl::OnAllowBindings(int enabled_bindings_flags) { 4641 void RenderViewImpl::OnAllowBindings(int enabled_bindings_flags) {
4658 enabled_bindings_ |= enabled_bindings_flags; 4642 enabled_bindings_ |= enabled_bindings_flags;
4659 4643
4660 // Keep track of the total bindings accumulated in this process. 4644 // Keep track of the total bindings accumulated in this process.
4661 RenderProcess::current()->AddBindings(enabled_bindings_flags); 4645 RenderProcess::current()->AddBindings(enabled_bindings_flags);
4662 } 4646 }
4663 4647
4664 void RenderViewImpl::OnSetWebUIProperty(const std::string& name, 4648 void RenderViewImpl::OnSetWebUIProperty(const std::string& name,
4665 const std::string& value) { 4649 const std::string& value) {
4666 if (enabled_bindings_ & content::BINDINGS_POLICY_WEB_UI) 4650 if (enabled_bindings_ & content::BINDINGS_POLICY_WEB_UI) {
abarth-chromium 2012/08/23 20:13:24 What happened to the check for chrome::kChromeUISc
Shishir 2012/11/06 20:08:38 Checks are now in the extension during the chrome.
4667 GetWebUIBindings()->SetProperty(name, value); 4651 if (webview() && webview()->mainFrame()) {
4668 else 4652 std::string script = "chrome." + name + " = \"" + value + "\";";
4653 webview()->mainFrame()->executeScript(
4654 WebKit::WebScriptSource(WebKit::WebString::fromUTF8(script.c_str())));
4655 }
4656 } else {
4669 NOTREACHED() << "WebUI bindings not enabled."; 4657 NOTREACHED() << "WebUI bindings not enabled.";
4658 }
4659
4670 } 4660 }
4671 4661
4672 void RenderViewImpl::OnDragTargetDragEnter(const WebDropData& drop_data, 4662 void RenderViewImpl::OnDragTargetDragEnter(const WebDropData& drop_data,
4673 const gfx::Point& client_point, 4663 const gfx::Point& client_point,
4674 const gfx::Point& screen_point, 4664 const gfx::Point& screen_point,
4675 WebDragOperationsMask ops, 4665 WebDragOperationsMask ops,
4676 int key_modifiers) { 4666 int key_modifiers) {
4677 WebDragOperation operation = webview()->dragTargetDragEnter( 4667 WebDragOperation operation = webview()->dragTargetDragEnter(
4678 drop_data.ToDragData(), 4668 drop_data.ToDragData(),
4679 client_point, 4669 client_point,
(...skipping 1212 matching lines...) Expand 10 before | Expand all | Expand 10 after
5892 bool RenderViewImpl::WebWidgetHandlesCompositorScheduling() const { 5882 bool RenderViewImpl::WebWidgetHandlesCompositorScheduling() const {
5893 return !!RenderThreadImpl::current()->compositor_thread(); 5883 return !!RenderThreadImpl::current()->compositor_thread();
5894 } 5884 }
5895 5885
5896 void RenderViewImpl::OnJavaBridgeInit() { 5886 void RenderViewImpl::OnJavaBridgeInit() {
5897 DCHECK(!java_bridge_dispatcher_); 5887 DCHECK(!java_bridge_dispatcher_);
5898 #if defined(ENABLE_JAVA_BRIDGE) 5888 #if defined(ENABLE_JAVA_BRIDGE)
5899 java_bridge_dispatcher_ = new JavaBridgeDispatcher(this); 5889 java_bridge_dispatcher_ = new JavaBridgeDispatcher(this);
5900 #endif 5890 #endif
5901 } 5891 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698