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

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: Fix failing unittest & address comments 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
« no previous file with comments | « chrome/browser/about_flags.cc ('k') | chrome/browser/ui/search/instant_controller.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 467 matching lines...) Expand 10 before | Expand all | Expand 10 after
478 478
479 bool IsInstantEnabled(Profile* profile) { 479 bool IsInstantEnabled(Profile* profile) {
480 return GetInstantURL(profile, kDisableStartMargin).is_valid(); 480 return GetInstantURL(profile, kDisableStartMargin).is_valid();
481 } 481 }
482 482
483 bool ShouldPreferRemoteNTPOnStartup() { 483 bool ShouldPreferRemoteNTPOnStartup() {
484 // Check the command-line/about:flags setting first, which should have 484 // Check the command-line/about:flags setting first, which should have
485 // precedence and allows the trial to not be reported (if it's never queried). 485 // precedence and allows the trial to not be reported (if it's never queried).
486 const CommandLine* command_line = CommandLine::ForCurrentProcess(); 486 const CommandLine* command_line = CommandLine::ForCurrentProcess();
487 if (command_line->HasSwitch(switches::kDisableInstantExtendedAPI) || 487 if (command_line->HasSwitch(switches::kDisableInstantExtendedAPI) ||
488 command_line->HasSwitch(switches::kEnableInstantExtendedAPI) ||
489 command_line->HasSwitch(switches::kEnableLocalOnlyInstantExtendedAPI) || 488 command_line->HasSwitch(switches::kEnableLocalOnlyInstantExtendedAPI) ||
490 command_line->HasSwitch(switches::kDisableLocalOnlyInstantExtendedAPI)) { 489 command_line->HasSwitch(switches::kEnableLocalFirstLoadNTP)) {
491 return false; 490 return false;
492 } 491 }
492 if (command_line->HasSwitch(switches::kDisableLocalFirstLoadNTP))
493 return true;
493 494
494 FieldTrialFlags flags; 495 FieldTrialFlags flags;
495 if (GetFieldTrialInfo( 496 if (GetFieldTrialInfo(
496 base::FieldTrialList::FindFullName(kInstantExtendedFieldTrialName), 497 base::FieldTrialList::FindFullName(kInstantExtendedFieldTrialName),
497 &flags, NULL)) { 498 &flags, NULL)) {
498 return GetBoolValueForFlagWithDefault(kUseRemoteNTPOnStartupFlagName, false, 499 return GetBoolValueForFlagWithDefault(kUseRemoteNTPOnStartupFlagName, false,
499 flags); 500 flags);
500 } 501 }
501 return false; 502 return false;
502 } 503 }
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
651 652
652 GURL instant_url = TemplateURLRefToGURL(template_url->instant_url_ref(), 653 GURL instant_url = TemplateURLRefToGURL(template_url->instant_url_ref(),
653 kDisableStartMargin); 654 kDisableStartMargin);
654 // Extended mode instant requires a search terms replacement key. 655 // Extended mode instant requires a search terms replacement key.
655 return instant_url.is_valid() && 656 return instant_url.is_valid() &&
656 (!IsInstantExtendedAPIEnabled() || 657 (!IsInstantExtendedAPIEnabled() ||
657 template_url->HasSearchTermsReplacementKey(instant_url)); 658 template_url->HasSearchTermsReplacementKey(instant_url));
658 } 659 }
659 660
660 } // namespace chrome 661 } // namespace chrome
OLDNEW
« no previous file with comments | « chrome/browser/about_flags.cc ('k') | chrome/browser/ui/search/instant_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698