OLD | NEW |
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/searchbox/searchbox_extension.h" | 5 #include "chrome/renderer/searchbox/searchbox_extension.h" |
6 | 6 |
7 #include <ctype.h> | 7 #include <ctype.h> |
8 | 8 |
9 #include "base/string_number_conversions.h" | 9 #include "base/string_number_conversions.h" |
10 #include "base/stringprintf.h" | 10 #include "base/stringprintf.h" |
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
269 } else if (name->Equals(v8::String::New("SetQueryFromAutocompleteResult"))) { | 269 } else if (name->Equals(v8::String::New("SetQueryFromAutocompleteResult"))) { |
270 return v8::FunctionTemplate::New(SetQueryFromAutocompleteResult); | 270 return v8::FunctionTemplate::New(SetQueryFromAutocompleteResult); |
271 } else if (name->Equals(v8::String::New("SetPreviewHeight"))) { | 271 } else if (name->Equals(v8::String::New("SetPreviewHeight"))) { |
272 return v8::FunctionTemplate::New(SetPreviewHeight); | 272 return v8::FunctionTemplate::New(SetPreviewHeight); |
273 } | 273 } |
274 return v8::Handle<v8::FunctionTemplate>(); | 274 return v8::Handle<v8::FunctionTemplate>(); |
275 } | 275 } |
276 | 276 |
277 // static | 277 // static |
278 content::RenderView* SearchBoxExtensionWrapper::GetRenderView() { | 278 content::RenderView* SearchBoxExtensionWrapper::GetRenderView() { |
279 WebKit::WebFrame* webframe = WebKit::WebFrame::frameForEnteredContext(); | 279 WebKit::WebFrame* webframe = WebKit::WebFrame::frameForCurrentContext(); |
280 if (!webframe) return NULL; | 280 if (!webframe) return NULL; |
281 | 281 |
282 WebKit::WebView* webview = webframe->view(); | 282 WebKit::WebView* webview = webframe->view(); |
283 if (!webview) return NULL; // can happen during closing | 283 if (!webview) return NULL; // can happen during closing |
284 | 284 |
285 return content::RenderView::FromWebView(webview); | 285 return content::RenderView::FromWebView(webview); |
286 } | 286 } |
287 | 287 |
288 // static | 288 // static |
289 v8::Handle<v8::Value> SearchBoxExtensionWrapper::GetQuery( | 289 v8::Handle<v8::Value> SearchBoxExtensionWrapper::GetQuery( |
(...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
685 | 685 |
686 // static | 686 // static |
687 v8::Extension* SearchBoxExtension::Get() { | 687 v8::Extension* SearchBoxExtension::Get() { |
688 const base::StringPiece code = | 688 const base::StringPiece code = |
689 ResourceBundle::GetSharedInstance().GetRawDataResource( | 689 ResourceBundle::GetSharedInstance().GetRawDataResource( |
690 IDR_SEARCHBOX_API, ui::SCALE_FACTOR_NONE); | 690 IDR_SEARCHBOX_API, ui::SCALE_FACTOR_NONE); |
691 return new SearchBoxExtensionWrapper(code); | 691 return new SearchBoxExtensionWrapper(code); |
692 } | 692 } |
693 | 693 |
694 } // namespace extensions_v8 | 694 } // namespace extensions_v8 |
OLD | NEW |