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

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

Issue 11111004: Remove all callers of WebFrame::frameForEnteredContext (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 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
« no previous file with comments | « no previous file | chrome/renderer/searchbox/searchbox_extension.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/external_extension.h" 5 #include "chrome/renderer/external_extension.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "chrome/common/chrome_switches.h" 8 #include "chrome/common/chrome_switches.h"
9 #include "chrome/common/render_messages.h" 9 #include "chrome/common/render_messages.h"
10 #include "chrome/common/search_provider.h" 10 #include "chrome/common/search_provider.h"
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 return v8::FunctionTemplate::New(AddSearchProvider); 70 return v8::FunctionTemplate::New(AddSearchProvider);
71 71
72 if (name->Equals(v8::String::New("NativeIsSearchProviderInstalled"))) 72 if (name->Equals(v8::String::New("NativeIsSearchProviderInstalled")))
73 return v8::FunctionTemplate::New(IsSearchProviderInstalled); 73 return v8::FunctionTemplate::New(IsSearchProviderInstalled);
74 74
75 return v8::Handle<v8::FunctionTemplate>(); 75 return v8::Handle<v8::FunctionTemplate>();
76 } 76 }
77 77
78 // static 78 // static
79 RenderView* ExternalExtensionWrapper::GetRenderView() { 79 RenderView* ExternalExtensionWrapper::GetRenderView() {
80 WebFrame* webframe = WebFrame::frameForEnteredContext(); 80 WebFrame* webframe = WebFrame::frameForCurrentContext();
81 DCHECK(webframe) << "There should be an active frame since we just got " 81 DCHECK(webframe) << "There should be an active frame since we just got "
82 "a native function called."; 82 "a native function called.";
83 if (!webframe) return NULL; 83 if (!webframe) return NULL;
84 84
85 WebView* webview = webframe->view(); 85 WebView* webview = webframe->view();
86 if (!webview) return NULL; // can happen during closing 86 if (!webview) return NULL; // can happen during closing
87 87
88 return RenderView::FromWebView(webview); 88 return RenderView::FromWebView(webview);
89 } 89 }
90 90
(...skipping 22 matching lines...) Expand all
113 v8::Handle<v8::Value> ExternalExtensionWrapper::IsSearchProviderInstalled( 113 v8::Handle<v8::Value> ExternalExtensionWrapper::IsSearchProviderInstalled(
114 const v8::Arguments& args) { 114 const v8::Arguments& args) {
115 if (!args.Length()) return v8::Undefined(); 115 if (!args.Length()) return v8::Undefined();
116 v8::String::Utf8Value utf8name(args[0]); 116 v8::String::Utf8Value utf8name(args[0]);
117 if (!utf8name.length()) return v8::Undefined(); 117 if (!utf8name.length()) return v8::Undefined();
118 118
119 std::string name = std::string(*utf8name); 119 std::string name = std::string(*utf8name);
120 RenderView* render_view = GetRenderView(); 120 RenderView* render_view = GetRenderView();
121 if (!render_view) return v8::Undefined(); 121 if (!render_view) return v8::Undefined();
122 122
123 WebFrame* webframe = WebFrame::frameForEnteredContext(); 123 WebFrame* webframe = WebFrame::frameForCurrentContext();
124 if (!webframe) return v8::Undefined(); 124 if (!webframe) return v8::Undefined();
125 125
126 search_provider::InstallState install = search_provider::DENIED; 126 search_provider::InstallState install = search_provider::DENIED;
127 GURL inquiry_url = GURL(name); 127 GURL inquiry_url = GURL(name);
128 if (!inquiry_url.is_empty()) { 128 if (!inquiry_url.is_empty()) {
129 render_view->Send(new ChromeViewHostMsg_GetSearchProviderInstallState( 129 render_view->Send(new ChromeViewHostMsg_GetSearchProviderInstallState(
130 render_view->GetRoutingID(), 130 render_view->GetRoutingID(),
131 webframe->document().url(), 131 webframe->document().url(),
132 inquiry_url, 132 inquiry_url,
133 &install)); 133 &install));
134 } 134 }
135 135
136 if (install == search_provider::DENIED) { 136 if (install == search_provider::DENIED) {
137 // FIXME: throw access denied exception. 137 // FIXME: throw access denied exception.
138 return v8::ThrowException(v8::Exception::Error(v8::String::Empty())); 138 return v8::ThrowException(v8::Exception::Error(v8::String::Empty()));
139 } 139 }
140 return v8::Integer::New(install); 140 return v8::Integer::New(install);
141 } 141 }
142 142
143 v8::Extension* ExternalExtension::Get() { 143 v8::Extension* ExternalExtension::Get() {
144 return new ExternalExtensionWrapper(); 144 return new ExternalExtensionWrapper();
145 } 145 }
146 146
147 } // namespace extensions_v8 147 } // namespace extensions_v8
OLDNEW
« no previous file with comments | « no previous file | chrome/renderer/searchbox/searchbox_extension.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698