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/browser/search/search.h" | 5 #include "chrome/browser/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/prefs/pref_service.h" | 10 #include "base/prefs/pref_service.h" |
(...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
401 kEnableQueryExtractionFlagName, false, flags); | 401 kEnableQueryExtractionFlagName, false, flags); |
402 #endif // defined(OS_IOS) || defined(OS_ANDROID) | 402 #endif // defined(OS_IOS) || defined(OS_ANDROID) |
403 } | 403 } |
404 | 404 |
405 base::string16 ExtractSearchTermsFromURL(Profile* profile, const GURL& url) { | 405 base::string16 ExtractSearchTermsFromURL(Profile* profile, const GURL& url) { |
406 if (url.is_valid() && url == GetSearchResultPrefetchBaseURL(profile)) { | 406 if (url.is_valid() && url == GetSearchResultPrefetchBaseURL(profile)) { |
407 // InstantSearchPrerenderer has the search query for the Instant search base | 407 // InstantSearchPrerenderer has the search query for the Instant search base |
408 // page. | 408 // page. |
409 InstantSearchPrerenderer* prerenderer = | 409 InstantSearchPrerenderer* prerenderer = |
410 InstantSearchPrerenderer::GetForProfile(profile); | 410 InstantSearchPrerenderer::GetForProfile(profile); |
411 DCHECK(prerenderer); | 411 // TODO(kmadhusu): Remove this CHECK after the investigation of |
| 412 // crbug.com/367204. |
| 413 CHECK(prerenderer); |
412 return prerenderer->get_last_query(); | 414 return prerenderer->get_last_query(); |
413 } | 415 } |
414 | 416 |
415 TemplateURL* template_url = GetDefaultSearchProviderTemplateURL(profile); | 417 TemplateURL* template_url = GetDefaultSearchProviderTemplateURL(profile); |
416 base::string16 search_terms; | 418 base::string16 search_terms; |
417 if (template_url) | 419 if (template_url) |
418 template_url->ExtractSearchTermsFromURL(url, &search_terms); | 420 template_url->ExtractSearchTermsFromURL(url, &search_terms); |
419 return search_terms; | 421 return search_terms; |
420 } | 422 } |
421 | 423 |
(...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
839 | 841 |
840 // Given a FieldTrialFlags object, returns the boolean value of the provided | 842 // Given a FieldTrialFlags object, returns the boolean value of the provided |
841 // flag. | 843 // flag. |
842 bool GetBoolValueForFlagWithDefault(const std::string& flag, | 844 bool GetBoolValueForFlagWithDefault(const std::string& flag, |
843 bool default_value, | 845 bool default_value, |
844 const FieldTrialFlags& flags) { | 846 const FieldTrialFlags& flags) { |
845 return !!GetUInt64ValueForFlagWithDefault(flag, default_value ? 1 : 0, flags); | 847 return !!GetUInt64ValueForFlagWithDefault(flag, default_value ? 1 : 0, flags); |
846 } | 848 } |
847 | 849 |
848 } // namespace chrome | 850 } // namespace chrome |
OLD | NEW |