| 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/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/i18n/rtl.h" | 8 #include "base/i18n/rtl.h" |
| 9 #include "base/json/string_escape.h" | 9 #include "base/json/string_escape.h" |
| 10 #include "base/metrics/field_trial.h" | 10 #include "base/metrics/field_trial.h" |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 bool IsIconNTPEnabled() { | 69 bool IsIconNTPEnabled() { |
| 70 // Note: It's important to query the field trial state first, to ensure that | 70 // Note: It's important to query the field trial state first, to ensure that |
| 71 // UMA reports the correct group. | 71 // UMA reports the correct group. |
| 72 const std::string group_name = base::FieldTrialList::FindFullName("IconNTP"); | 72 const std::string group_name = base::FieldTrialList::FindFullName("IconNTP"); |
| 73 using base::CommandLine; | 73 using base::CommandLine; |
| 74 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kDisableIconNtp)) | 74 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kDisableIconNtp)) |
| 75 return false; | 75 return false; |
| 76 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kEnableIconNtp)) | 76 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kEnableIconNtp)) |
| 77 return true; | 77 return true; |
| 78 | 78 |
| 79 return StartsWithASCII(group_name, "Enabled", true); | 79 return base::StartsWithASCII(group_name, "Enabled", true); |
| 80 } | 80 } |
| 81 | 81 |
| 82 // Converts string16 to V8 String. | 82 // Converts string16 to V8 String. |
| 83 v8::Local<v8::String> UTF16ToV8String(v8::Isolate* isolate, | 83 v8::Local<v8::String> UTF16ToV8String(v8::Isolate* isolate, |
| 84 const base::string16& s) { | 84 const base::string16& s) { |
| 85 return v8::String::NewFromTwoByte(isolate, | 85 return v8::String::NewFromTwoByte(isolate, |
| 86 reinterpret_cast<const uint16_t*>(s.data()), | 86 reinterpret_cast<const uint16_t*>(s.data()), |
| 87 v8::String::kNormalString, | 87 v8::String::kNormalString, |
| 88 s.size()); | 88 s.size()); |
| 89 } | 89 } |
| (...skipping 1183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1273 if (!render_view) return; | 1273 if (!render_view) return; |
| 1274 | 1274 |
| 1275 bool display_instant_results = | 1275 bool display_instant_results = |
| 1276 SearchBox::Get(render_view)->display_instant_results(); | 1276 SearchBox::Get(render_view)->display_instant_results(); |
| 1277 DVLOG(1) << render_view << " GetDisplayInstantResults" << | 1277 DVLOG(1) << render_view << " GetDisplayInstantResults" << |
| 1278 display_instant_results; | 1278 display_instant_results; |
| 1279 args.GetReturnValue().Set(display_instant_results); | 1279 args.GetReturnValue().Set(display_instant_results); |
| 1280 } | 1280 } |
| 1281 | 1281 |
| 1282 } // namespace extensions_v8 | 1282 } // namespace extensions_v8 |
| OLD | NEW |