Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(826)

Side by Side Diff: chrome/browser/search/search.cc

Issue 14043009: Fall back to local page if online NTP fails to load. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Cleanup Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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;
samarth 2013/04/30 17:10:33 I assume this was for debugging. (Shouldn't be nec
David Black 2013/04/30 23:09:08 No, this is necessary, as that URL otherwise doesn
samarth 2013/05/01 06:26:47 In that case, you should change Coerce... to also
David Black 2013/05/02 00:49:45 Search term extraction still does work. It's only
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
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
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/search/instant_controller.h » ('j') | chrome/browser/ui/search/instant_controller.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698