| 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/json/string_escape.h" | 8 #include "base/json/string_escape.h" |
| 9 #include "base/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
| 10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 const char kThemeAttributionFormat[] = "-webkit-image-set(" | 51 const char kThemeAttributionFormat[] = "-webkit-image-set(" |
| 52 "url(chrome-search://theme/IDR_THEME_NTP_ATTRIBUTION?%s) 1x, " | 52 "url(chrome-search://theme/IDR_THEME_NTP_ATTRIBUTION?%s) 1x, " |
| 53 "url(chrome-search://theme/IDR_THEME_NTP_ATTRIBUTION@2x?%s) 2x)"; | 53 "url(chrome-search://theme/IDR_THEME_NTP_ATTRIBUTION@2x?%s) 2x)"; |
| 54 | 54 |
| 55 const char kLTRHtmlTextDirection[] = "ltr"; | 55 const char kLTRHtmlTextDirection[] = "ltr"; |
| 56 const char kRTLHtmlTextDirection[] = "rtl"; | 56 const char kRTLHtmlTextDirection[] = "rtl"; |
| 57 | 57 |
| 58 // Converts a V8 value to a string16. | 58 // Converts a V8 value to a string16. |
| 59 base::string16 V8ValueToUTF16(v8::Handle<v8::Value> v) { | 59 base::string16 V8ValueToUTF16(v8::Handle<v8::Value> v) { |
| 60 v8::String::Value s(v); | 60 v8::String::Value s(v); |
| 61 return base::string16(reinterpret_cast<const char16*>(*s), s.length()); | 61 return base::string16(reinterpret_cast<const base::char16*>(*s), s.length()); |
| 62 } | 62 } |
| 63 | 63 |
| 64 // Converts string16 to V8 String. | 64 // Converts string16 to V8 String. |
| 65 v8::Handle<v8::String> UTF16ToV8String(v8::Isolate* isolate, | 65 v8::Handle<v8::String> UTF16ToV8String(v8::Isolate* isolate, |
| 66 const base::string16& s) { | 66 const base::string16& s) { |
| 67 return v8::String::NewFromTwoByte(isolate, | 67 return v8::String::NewFromTwoByte(isolate, |
| 68 reinterpret_cast<const uint16_t*>(s.data()), | 68 reinterpret_cast<const uint16_t*>(s.data()), |
| 69 v8::String::kNormalString, | 69 v8::String::kNormalString, |
| 70 s.size()); | 70 s.size()); |
| 71 } | 71 } |
| (...skipping 988 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1060 if (!render_view) return; | 1060 if (!render_view) return; |
| 1061 | 1061 |
| 1062 bool display_instant_results = | 1062 bool display_instant_results = |
| 1063 SearchBox::Get(render_view)->display_instant_results(); | 1063 SearchBox::Get(render_view)->display_instant_results(); |
| 1064 DVLOG(1) << render_view << " GetDisplayInstantResults" << | 1064 DVLOG(1) << render_view << " GetDisplayInstantResults" << |
| 1065 display_instant_results; | 1065 display_instant_results; |
| 1066 args.GetReturnValue().Set(display_instant_results); | 1066 args.GetReturnValue().Set(display_instant_results); |
| 1067 } | 1067 } |
| 1068 | 1068 |
| 1069 } // namespace extensions_v8 | 1069 } // namespace extensions_v8 |
| OLD | NEW |