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/metrics/field_trial.h" | |
10 #include "base/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
11 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
12 #include "base/strings/stringprintf.h" | 11 #include "base/strings/stringprintf.h" |
13 #include "base/strings/utf_string_conversions.h" | 12 #include "base/strings/utf_string_conversions.h" |
14 #include "chrome/common/instant_types.h" | 13 #include "chrome/common/instant_types.h" |
15 #include "chrome/common/ntp_logging_events.h" | 14 #include "chrome/common/ntp_logging_events.h" |
16 #include "chrome/common/url_constants.h" | 15 #include "chrome/common/url_constants.h" |
17 #include "chrome/grit/renderer_resources.h" | 16 #include "chrome/grit/renderer_resources.h" |
18 #include "chrome/renderer/searchbox/searchbox.h" | 17 #include "chrome/renderer/searchbox/searchbox.h" |
19 #include "components/crx_file/id_util.h" | 18 #include "components/crx_file/id_util.h" |
| 19 #include "components/variations/variations_associated_data.h" |
20 #include "content/public/renderer/render_view.h" | 20 #include "content/public/renderer/render_view.h" |
21 #include "third_party/WebKit/public/platform/WebURLRequest.h" | 21 #include "third_party/WebKit/public/platform/WebURLRequest.h" |
22 #include "third_party/WebKit/public/web/WebDocument.h" | 22 #include "third_party/WebKit/public/web/WebDocument.h" |
23 #include "third_party/WebKit/public/web/WebLocalFrame.h" | 23 #include "third_party/WebKit/public/web/WebLocalFrame.h" |
24 #include "third_party/WebKit/public/web/WebScriptSource.h" | 24 #include "third_party/WebKit/public/web/WebScriptSource.h" |
25 #include "third_party/WebKit/public/web/WebView.h" | 25 #include "third_party/WebKit/public/web/WebView.h" |
26 #include "ui/base/resource/resource_bundle.h" | 26 #include "ui/base/resource/resource_bundle.h" |
27 #include "ui/base/window_open_disposition.h" | 27 #include "ui/base/window_open_disposition.h" |
28 #include "ui/events/keycodes/keyboard_codes.h" | 28 #include "ui/events/keycodes/keyboard_codes.h" |
29 #include "url/gurl.h" | 29 #include "url/gurl.h" |
(...skipping 27 matching lines...) Expand all Loading... |
57 const char kRTLHtmlTextDirection[] = "rtl"; | 57 const char kRTLHtmlTextDirection[] = "rtl"; |
58 | 58 |
59 // Converts a V8 value to a string16. | 59 // Converts a V8 value to a string16. |
60 base::string16 V8ValueToUTF16(v8::Handle<v8::Value> v) { | 60 base::string16 V8ValueToUTF16(v8::Handle<v8::Value> v) { |
61 v8::String::Value s(v); | 61 v8::String::Value s(v); |
62 return base::string16(reinterpret_cast<const base::char16*>(*s), s.length()); | 62 return base::string16(reinterpret_cast<const base::char16*>(*s), s.length()); |
63 } | 63 } |
64 | 64 |
65 // Returns whether we should use large icons on NTP. | 65 // Returns whether we should use large icons on NTP. |
66 bool IsIconNTPEnabled() { | 66 bool IsIconNTPEnabled() { |
67 return StartsWithASCII(base::FieldTrialList::FindFullName("IconNTP"), | 67 return variations::GetVariationParamValue("IconNTP", "state") == "enabled"; |
68 "Enabled", true); | |
69 } | 68 } |
70 | 69 |
71 // Converts string16 to V8 String. | 70 // Converts string16 to V8 String. |
72 v8::Handle<v8::String> UTF16ToV8String(v8::Isolate* isolate, | 71 v8::Handle<v8::String> UTF16ToV8String(v8::Isolate* isolate, |
73 const base::string16& s) { | 72 const base::string16& s) { |
74 return v8::String::NewFromTwoByte(isolate, | 73 return v8::String::NewFromTwoByte(isolate, |
75 reinterpret_cast<const uint16_t*>(s.data()), | 74 reinterpret_cast<const uint16_t*>(s.data()), |
76 v8::String::kNormalString, | 75 v8::String::kNormalString, |
77 s.size()); | 76 s.size()); |
78 } | 77 } |
(...skipping 1201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1280 if (!render_view) return; | 1279 if (!render_view) return; |
1281 | 1280 |
1282 bool display_instant_results = | 1281 bool display_instant_results = |
1283 SearchBox::Get(render_view)->display_instant_results(); | 1282 SearchBox::Get(render_view)->display_instant_results(); |
1284 DVLOG(1) << render_view << " GetDisplayInstantResults" << | 1283 DVLOG(1) << render_view << " GetDisplayInstantResults" << |
1285 display_instant_results; | 1284 display_instant_results; |
1286 args.GetReturnValue().Set(display_instant_results); | 1285 args.GetReturnValue().Set(display_instant_results); |
1287 } | 1286 } |
1288 | 1287 |
1289 } // namespace extensions_v8 | 1288 } // namespace extensions_v8 |
OLD | NEW |