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/stringprintf.h" | 8 #include "base/stringprintf.h" |
9 #include "base/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
10 #include "chrome/common/extensions/extension.h" | 10 #include "chrome/common/extensions/extension.h" |
(...skipping 853 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
864 | 864 |
865 // static | 865 // static |
866 v8::Extension* SearchBoxExtension::Get() { | 866 v8::Extension* SearchBoxExtension::Get() { |
867 return new SearchBoxExtensionWrapper(ResourceBundle::GetSharedInstance(). | 867 return new SearchBoxExtensionWrapper(ResourceBundle::GetSharedInstance(). |
868 GetRawDataResource(IDR_SEARCHBOX_API)); | 868 GetRawDataResource(IDR_SEARCHBOX_API)); |
869 } | 869 } |
870 | 870 |
871 // static | 871 // static |
872 bool SearchBoxExtension::PageSupportsInstant(WebKit::WebFrame* frame) { | 872 bool SearchBoxExtension::PageSupportsInstant(WebKit::WebFrame* frame) { |
873 if (!frame) return false; | 873 if (!frame) return false; |
874 | 874 v8::HandleScope handle_scope; |
875 v8::Handle<v8::Value> v = frame->executeScriptAndReturnValue( | 875 v8::Handle<v8::Value> v = frame->executeScriptAndReturnValue( |
876 WebKit::WebScriptSource(kSupportsInstantScript)); | 876 WebKit::WebScriptSource(kSupportsInstantScript)); |
877 return !v.IsEmpty() && v->BooleanValue(); | 877 return !v.IsEmpty() && v->BooleanValue(); |
878 } | 878 } |
879 | 879 |
880 // static | 880 // static |
881 void SearchBoxExtension::DispatchChange(WebKit::WebFrame* frame) { | 881 void SearchBoxExtension::DispatchChange(WebKit::WebFrame* frame) { |
882 Dispatch(frame, kDispatchChangeEventScript); | 882 Dispatch(frame, kDispatchChangeEventScript); |
883 } | 883 } |
884 | 884 |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
930 void SearchBoxExtension::DispatchMarginChange(WebKit::WebFrame* frame) { | 930 void SearchBoxExtension::DispatchMarginChange(WebKit::WebFrame* frame) { |
931 Dispatch(frame, kDispatchMarginChangeEventScript); | 931 Dispatch(frame, kDispatchMarginChangeEventScript); |
932 } | 932 } |
933 | 933 |
934 // static | 934 // static |
935 void SearchBoxExtension::DispatchThemeChange(WebKit::WebFrame* frame) { | 935 void SearchBoxExtension::DispatchThemeChange(WebKit::WebFrame* frame) { |
936 Dispatch(frame, kDispatchThemeChangeEventScript); | 936 Dispatch(frame, kDispatchThemeChangeEventScript); |
937 } | 937 } |
938 | 938 |
939 } // namespace extensions_v8 | 939 } // namespace extensions_v8 |
OLD | NEW |