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

Side by Side Diff: chrome/renderer/extensions/bindings_utils.cc

Issue 265044: Eliminate WebView::GetDelegate and replace RenderViewSet with a linked list o... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 11 years, 2 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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/extensions/bindings_utils.h" 5 #include "chrome/renderer/extensions/bindings_utils.h"
6 6
7 #include "base/string_util.h" 7 #include "base/string_util.h"
8 #include "chrome/renderer/render_view.h" 8 #include "chrome/renderer/render_view.h"
9 #include "webkit/api/public/WebFrame.h" 9 #include "webkit/api/public/WebFrame.h"
10 10
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 RenderView* GetRenderViewForCurrentContext() { 99 RenderView* GetRenderViewForCurrentContext() {
100 WebFrame* webframe = WebFrame::frameForCurrentContext(); 100 WebFrame* webframe = WebFrame::frameForCurrentContext();
101 DCHECK(webframe) << "RetrieveCurrentFrame called when not in a V8 context."; 101 DCHECK(webframe) << "RetrieveCurrentFrame called when not in a V8 context.";
102 if (!webframe) 102 if (!webframe)
103 return NULL; 103 return NULL;
104 104
105 WebView* webview = webframe->view(); 105 WebView* webview = webframe->view();
106 if (!webview) 106 if (!webview)
107 return NULL; // can happen during closing 107 return NULL; // can happen during closing
108 108
109 RenderView* renderview = static_cast<RenderView*>(webview->GetDelegate()); 109 RenderView* renderview = RenderView::FromWebView(webview);
110 DCHECK(renderview) << "Encountered a WebView without a WebViewDelegate"; 110 DCHECK(renderview) << "Encountered a WebView without a WebViewDelegate";
111 return renderview; 111 return renderview;
112 } 112 }
113 113
114 v8::Handle<v8::Value> CallFunctionInContext(v8::Handle<v8::Context> context, 114 v8::Handle<v8::Value> CallFunctionInContext(v8::Handle<v8::Context> context,
115 const std::string& function_name, int argc, 115 const std::string& function_name, int argc,
116 v8::Handle<v8::Value>* argv) { 116 v8::Handle<v8::Value>* argv) {
117 v8::Context::Scope context_scope(context); 117 v8::Context::Scope context_scope(context);
118 118
119 // Look up the function name, which may be a sub-property like 119 // Look up the function name, which may be a sub-property like
(...skipping 12 matching lines...) Expand all
132 } 132 }
133 133
134 v8::Local<v8::Function> function = v8::Local<v8::Function>::Cast(value); 134 v8::Local<v8::Function> function = v8::Local<v8::Function>::Cast(value);
135 if (!function.IsEmpty()) 135 if (!function.IsEmpty())
136 return function->Call(v8::Object::New(), argc, argv); 136 return function->Call(v8::Object::New(), argc, argv);
137 137
138 return v8::Undefined(); 138 return v8::Undefined();
139 } 139 }
140 140
141 } // namespace bindings_utils 141 } // namespace bindings_utils
OLDNEW
« no previous file with comments | « no previous file | chrome/renderer/extensions/event_bindings.cc » ('j') | chrome/renderer/render_view.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698