| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 "base/i18n/rtl.h" | 7 #include "base/i18n/rtl.h" |
| 8 #include "base/strings/string_number_conversions.h" | 8 #include "base/strings/string_number_conversions.h" |
| 9 #include "base/strings/string_util.h" | 9 #include "base/strings/string_util.h" |
| 10 #include "base/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
| (...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 414 | 414 |
| 415 // static | 415 // static |
| 416 v8::Extension* SearchBoxExtension::Get() { | 416 v8::Extension* SearchBoxExtension::Get() { |
| 417 return new SearchBoxExtensionWrapper(ResourceBundle::GetSharedInstance(). | 417 return new SearchBoxExtensionWrapper(ResourceBundle::GetSharedInstance(). |
| 418 GetRawDataResource(IDR_SEARCHBOX_API)); | 418 GetRawDataResource(IDR_SEARCHBOX_API)); |
| 419 } | 419 } |
| 420 | 420 |
| 421 // static | 421 // static |
| 422 bool SearchBoxExtension::PageSupportsInstant(WebKit::WebFrame* frame) { | 422 bool SearchBoxExtension::PageSupportsInstant(WebKit::WebFrame* frame) { |
| 423 if (!frame) return false; | 423 if (!frame) return false; |
| 424 v8::HandleScope handle_scope; | 424 v8::HandleScope handle_scope(v8::Isolate::GetCurrent()); |
| 425 v8::Handle<v8::Value> v = frame->executeScriptAndReturnValue( | 425 v8::Handle<v8::Value> v = frame->executeScriptAndReturnValue( |
| 426 WebKit::WebScriptSource(kSupportsInstantScript)); | 426 WebKit::WebScriptSource(kSupportsInstantScript)); |
| 427 return !v.IsEmpty() && v->BooleanValue(); | 427 return !v.IsEmpty() && v->BooleanValue(); |
| 428 } | 428 } |
| 429 | 429 |
| 430 // static | 430 // static |
| 431 void SearchBoxExtension::DispatchFocusChange(WebKit::WebFrame* frame) { | 431 void SearchBoxExtension::DispatchFocusChange(WebKit::WebFrame* frame) { |
| 432 Dispatch(frame, kDispatchFocusChangedScript); | 432 Dispatch(frame, kDispatchFocusChangedScript); |
| 433 } | 433 } |
| 434 | 434 |
| (...skipping 549 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 984 if (!render_view) return; | 984 if (!render_view) return; |
| 985 | 985 |
| 986 bool display_instant_results = | 986 bool display_instant_results = |
| 987 SearchBox::Get(render_view)->display_instant_results(); | 987 SearchBox::Get(render_view)->display_instant_results(); |
| 988 DVLOG(1) << render_view << " GetDisplayInstantResults" << | 988 DVLOG(1) << render_view << " GetDisplayInstantResults" << |
| 989 display_instant_results; | 989 display_instant_results; |
| 990 args.GetReturnValue().Set(display_instant_results); | 990 args.GetReturnValue().Set(display_instant_results); |
| 991 } | 991 } |
| 992 | 992 |
| 993 } // namespace extensions_v8 | 993 } // namespace extensions_v8 |
| OLD | NEW |