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

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

Issue 164225: Switch to WebFrame from the WebKit API.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 11 years, 4 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/glue/webframe.h" 9 #include "webkit/api/public/WebFrame.h"
10
11 using WebKit::WebFrame;
10 12
11 namespace bindings_utils { 13 namespace bindings_utils {
12 14
13 const char* kChromeHidden = "chromeHidden"; 15 const char* kChromeHidden = "chromeHidden";
14 16
15 struct SingletonData { 17 struct SingletonData {
16 ContextList contexts; 18 ContextList contexts;
17 PendingRequestMap pending_requests; 19 PendingRequestMap pending_requests;
18 }; 20 };
19 21
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 } 73 }
72 74
73 return it; 75 return it;
74 } 76 }
75 77
76 PendingRequestMap& GetPendingRequestMap() { 78 PendingRequestMap& GetPendingRequestMap() {
77 return Singleton<SingletonData>::get()->pending_requests; 79 return Singleton<SingletonData>::get()->pending_requests;
78 } 80 }
79 81
80 RenderView* GetRenderViewForCurrentContext() { 82 RenderView* GetRenderViewForCurrentContext() {
81 WebFrame* webframe = WebFrame::RetrieveFrameForCurrentContext(); 83 WebFrame* webframe = WebFrame::frameForCurrentContext();
82 DCHECK(webframe) << "RetrieveCurrentFrame called when not in a V8 context."; 84 DCHECK(webframe) << "RetrieveCurrentFrame called when not in a V8 context.";
83 if (!webframe) 85 if (!webframe)
84 return NULL; 86 return NULL;
85 87
86 WebView* webview = webframe->GetView(); 88 WebView* webview = webframe->view();
87 if (!webview) 89 if (!webview)
88 return NULL; // can happen during closing 90 return NULL; // can happen during closing
89 91
90 RenderView* renderview = static_cast<RenderView*>(webview->GetDelegate()); 92 RenderView* renderview = static_cast<RenderView*>(webview->GetDelegate());
91 DCHECK(renderview) << "Encountered a WebView without a WebViewDelegate"; 93 DCHECK(renderview) << "Encountered a WebView without a WebViewDelegate";
92 return renderview; 94 return renderview;
93 } 95 }
94 96
95 void CallFunctionInContext(v8::Handle<v8::Context> context, 97 void CallFunctionInContext(v8::Handle<v8::Context> context,
96 const std::string& function_name, int argc, 98 const std::string& function_name, int argc,
(...skipping 14 matching lines...) Expand all
111 NOTREACHED(); 113 NOTREACHED();
112 return; 114 return;
113 } 115 }
114 116
115 v8::Local<v8::Function> function = v8::Local<v8::Function>::Cast(value); 117 v8::Local<v8::Function> function = v8::Local<v8::Function>::Cast(value);
116 if (!function.IsEmpty()) 118 if (!function.IsEmpty())
117 function->Call(v8::Object::New(), argc, argv); 119 function->Call(v8::Object::New(), argc, argv);
118 } 120 }
119 121
120 } // namespace bindings_utils 122 } // namespace bindings_utils
OLDNEW
« no previous file with comments | « chrome/renderer/extensions/bindings_utils.h ('k') | chrome/renderer/extensions/event_bindings.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698