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

Unified 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: Minor fix. Created 8 years, 1 month 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 side-by-side diff with in-line comments
Download patch
Index: content/renderer/render_view_impl.cc
diff --git a/content/renderer/render_view_impl.cc b/content/renderer/render_view_impl.cc
index a3c5cf06cdfb593c863ad1e65c982822e8a2a58d..475e51317be4f65dc465eb89abe87fbb9328ecbb 100644
--- a/content/renderer/render_view_impl.cc
+++ b/content/renderer/render_view_impl.cc
@@ -99,7 +99,8 @@
#include "content/renderer/text_input_client_observer.h"
#include "content/renderer/v8_value_converter_impl.h"
#include "content/renderer/web_intents_host.h"
-#include "content/renderer/web_ui_bindings.h"
+#include "content/renderer/web_ui_extension.h"
+#include "content/renderer/web_ui_extension_data.h"
#include "content/renderer/webplugin_delegate_proxy.h"
#include "content/renderer/websharedworker_proxy.h"
#include "media/base/filter_collection.h"
@@ -927,7 +928,6 @@ bool RenderViewImpl::OnMessageReceived(const IPC::Message& message) {
IPC_MESSAGE_HANDLER(DragMsg_SourceSystemDragEnded,
OnDragSourceSystemDragEnded)
IPC_MESSAGE_HANDLER(ViewMsg_AllowBindings, OnAllowBindings)
- IPC_MESSAGE_HANDLER(ViewMsg_SetWebUIProperty, OnSetWebUIProperty)
IPC_MESSAGE_HANDLER(ViewMsg_SetInitialFocus, OnSetInitialFocus)
IPC_MESSAGE_HANDLER(ViewMsg_ScrollFocusedEditableNodeIntoRect,
OnScrollFocusedEditableNodeIntoRect)
@@ -3389,13 +3389,6 @@ void RenderViewImpl::didClearWindowObject(WebFrame* frame) {
FOR_EACH_OBSERVER(RenderViewObserver, observers_,
DidClearWindowObject(frame));
- GURL frame_url = frame->document().url();
- if ((enabled_bindings_ & BINDINGS_POLICY_WEB_UI) &&
- (frame_url.SchemeIs(chrome::kChromeUIScheme) ||
- frame_url.SchemeIs(chrome::kDataScheme))) {
- GetWebUIBindings()->BindToJavascript(frame, "chrome");
- }
-
if (enabled_bindings_ & BINDINGS_POLICY_DOM_AUTOMATION) {
if (!dom_automation_controller_.get())
dom_automation_controller_.reset(new DomAutomationController());
@@ -4606,14 +4599,6 @@ GURL RenderViewImpl::GetLoadingUrl(WebKit::WebFrame* frame) const {
return request.url();
}
-WebUIBindings* RenderViewImpl::GetWebUIBindings() {
- if (!web_ui_bindings_.get()) {
- web_ui_bindings_.reset(new WebUIBindings(
- static_cast<RenderView*>(this), routing_id_));
- }
- return web_ui_bindings_.get();
-}
-
WebKit::WebPlugin* RenderViewImpl::GetWebPluginFromPluginDocument() {
return webview()->mainFrame()->document().to<WebPluginDocument>().plugin();
}
@@ -5017,20 +5002,18 @@ void RenderViewImpl::OnCSSInsertRequest(const string16& frame_xpath,
}
void RenderViewImpl::OnAllowBindings(int enabled_bindings_flags) {
abarth-chromium 2012/11/09 23:07:44 I take it there isn't a way to remove bindings.
Shishir 2012/11/09 23:47:47 Not that I could find. I think the way to unregist
+ if ((enabled_bindings_flags & BINDINGS_POLICY_WEB_UI) &&
+ !(enabled_bindings_ & BINDINGS_POLICY_WEB_UI)) {
+ RenderThread::Get()->RegisterExtension(content::WebUIExtension::Get());
+ new WebUIExtensionData(this);
+ }
+
enabled_bindings_ |= enabled_bindings_flags;
// Keep track of the total bindings accumulated in this process.
RenderProcess::current()->AddBindings(enabled_bindings_flags);
}
-void RenderViewImpl::OnSetWebUIProperty(const std::string& name,
- const std::string& value) {
- if (enabled_bindings_ & BINDINGS_POLICY_WEB_UI)
- GetWebUIBindings()->SetProperty(name, value);
- else
- NOTREACHED() << "WebUI bindings not enabled.";
-}
-
void RenderViewImpl::OnDragTargetDragEnter(const WebDropData& drop_data,
const gfx::Point& client_point,
const gfx::Point& screen_point,

Powered by Google App Engine
This is Rietveld 408576698