| 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 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 bool IsInstantURL(const GURL& url, Profile* profile) { | 153 bool IsInstantURL(const GURL& url, Profile* profile) { |
| 154 TemplateURL* template_url = GetDefaultSearchProviderTemplateURL(profile); | 154 TemplateURL* template_url = GetDefaultSearchProviderTemplateURL(profile); |
| 155 if (!template_url) | 155 if (!template_url) |
| 156 return false; | 156 return false; |
| 157 | 157 |
| 158 const TemplateURLRef& instant_url_ref = template_url->instant_url_ref(); | 158 const TemplateURLRef& instant_url_ref = template_url->instant_url_ref(); |
| 159 const bool extended_api_enabled = IsInstantExtendedAPIEnabled(); | 159 const bool extended_api_enabled = IsInstantExtendedAPIEnabled(); |
| 160 GURL effective_url = url; | 160 GURL effective_url = url; |
| 161 | 161 |
| 162 if (IsCommandLineInstantURL(url)) | 162 if (IsCommandLineInstantURL(url)) |
| 163 effective_url = CoerceCommandLineURLToTemplateURL(url, instant_url_ref, | 163 return true; |
| 164 kDisableStartMargin); | |
| 165 | 164 |
| 166 if (!effective_url.is_valid()) | 165 if (!effective_url.is_valid()) |
| 167 return false; | 166 return false; |
| 168 | 167 |
| 169 if (extended_api_enabled && !effective_url.SchemeIsSecure()) | 168 if (extended_api_enabled && !effective_url.SchemeIsSecure()) |
| 170 return false; | 169 return false; |
| 171 | 170 |
| 172 if (extended_api_enabled && | 171 if (extended_api_enabled && |
| 173 !template_url->HasSearchTermsReplacementKey(effective_url)) | 172 !template_url->HasSearchTermsReplacementKey(effective_url)) |
| 174 return false; | 173 return false; |
| (...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 600 | 599 |
| 601 GURL instant_url = TemplateURLRefToGURL(template_url->instant_url_ref(), | 600 GURL instant_url = TemplateURLRefToGURL(template_url->instant_url_ref(), |
| 602 kDisableStartMargin); | 601 kDisableStartMargin); |
| 603 // Extended mode instant requires a search terms replacement key. | 602 // Extended mode instant requires a search terms replacement key. |
| 604 return instant_url.is_valid() && | 603 return instant_url.is_valid() && |
| 605 (!IsInstantExtendedAPIEnabled() || | 604 (!IsInstantExtendedAPIEnabled() || |
| 606 template_url->HasSearchTermsReplacementKey(instant_url)); | 605 template_url->HasSearchTermsReplacementKey(instant_url)); |
| 607 } | 606 } |
| 608 | 607 |
| 609 } // namespace chrome | 608 } // namespace chrome |
| OLD | NEW |