OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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/browser/ui/search/search.h" | 5 #include "chrome/browser/ui/search/search.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/metrics/field_trial.h" | 8 #include "base/metrics/field_trial.h" |
9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
272 const TemplateURLRef& instant_url_ref = template_url->instant_url_ref(); | 272 const TemplateURLRef& instant_url_ref = template_url->instant_url_ref(); |
273 effective_url = CoerceCommandLineURLToTemplateURL(url, instant_url_ref); | 273 effective_url = CoerceCommandLineURLToTemplateURL(url, instant_url_ref); |
274 } | 274 } |
275 | 275 |
276 return ShouldAssignURLToInstantRendererImpl( | 276 return ShouldAssignURLToInstantRendererImpl( |
277 effective_url, | 277 effective_url, |
278 IsInstantExtendedAPIEnabled(profile), | 278 IsInstantExtendedAPIEnabled(profile), |
279 template_url); | 279 template_url); |
280 } | 280 } |
281 | 281 |
282 void RecordInstantExtendedPrefValue(bool pref_value) { | |
283 static bool recorded = false; | |
sreeram
2013/03/01 16:42:07
This bool is static across the whole browser proce
Alexei Svitkine (slow)
2013/03/01 17:57:56
I agree that's kind of weird. From the bug:
"It's
| |
284 if (!recorded) { | |
285 UMA_HISTOGRAM_BOOLEAN("InstantExtended.PrefValue", pref_value); | |
286 recorded = true; | |
287 } | |
288 } | |
289 | |
282 void EnableInstantExtendedAPIForTesting() { | 290 void EnableInstantExtendedAPIForTesting() { |
283 CommandLine* cl = CommandLine::ForCurrentProcess(); | 291 CommandLine* cl = CommandLine::ForCurrentProcess(); |
284 cl->AppendSwitch(switches::kEnableInstantExtendedAPI); | 292 cl->AppendSwitch(switches::kEnableInstantExtendedAPI); |
285 } | 293 } |
286 | 294 |
287 void EnableQueryExtractionForTesting() { | 295 void EnableQueryExtractionForTesting() { |
288 #if defined(OS_IOS) | 296 #if defined(OS_IOS) |
289 CommandLine* cl = CommandLine::ForCurrentProcess(); | 297 CommandLine* cl = CommandLine::ForCurrentProcess(); |
290 cl->AppendSwitch(switches::kEnableQueryExtraction); | 298 cl->AppendSwitch(switches::kEnableQueryExtraction); |
291 #else | 299 #else |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
409 GURL::Replacements replacements; | 417 GURL::Replacements replacements; |
410 replacements.SetSchemeStr(search_scheme); | 418 replacements.SetSchemeStr(search_scheme); |
411 replacements.SetHostStr(search_host); | 419 replacements.SetHostStr(search_host); |
412 replacements.SetPortStr(search_port); | 420 replacements.SetPortStr(search_port); |
413 replacements.SetPathStr(search_path); | 421 replacements.SetPathStr(search_path); |
414 return instant_url.ReplaceComponents(replacements); | 422 return instant_url.ReplaceComponents(replacements); |
415 } | 423 } |
416 | 424 |
417 } // namespace search | 425 } // namespace search |
418 } // namespace chrome | 426 } // namespace chrome |
OLD | NEW |