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

Unified Diff: chrome/browser/search/search.cc

Issue 137993020: (Try 2) InstantExtended: remove dead code related to the non-cacheable NTP. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Disable InstantPolicyTests Created 6 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/search/search.h ('k') | chrome/browser/search/search_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/search/search.cc
diff --git a/chrome/browser/search/search.cc b/chrome/browser/search/search.cc
index 0436353682e7b122cd6b2cdb554f9c5d77ad85a0..7fe3c5194da9adeb4f501c5714cae0943e595957 100644
--- a/chrome/browser/search/search.cc
+++ b/chrome/browser/search/search.cc
@@ -7,7 +7,6 @@
#include "base/command_line.h"
#include "base/metrics/field_trial.h"
#include "base/prefs/pref_service.h"
-#include "base/rand_util.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_split.h"
#include "base/strings/utf_string_conversions.h"
@@ -59,13 +58,7 @@ const uint64 kEmbeddedPageVersionDefault = 1;
const uint64 kEmbeddedPageVersionDefault = 2;
#endif
-// The staleness timeout can be set (in seconds) via this config.
-const char kStalePageTimeoutFlagName[] = "stale";
-const int kStalePageTimeoutDefault = 3 * 3600; // 3 hours.
-
const char kHideVerbatimFlagName[] = "hide_verbatim";
-const char kShowNtpFlagName[] = "show_ntp";
-const char kUseCacheableNTP[] = "use_cacheable_ntp";
const char kPrefetchSearchResultsFlagName[] = "prefetch_results";
const char kPrefetchSearchResultsOnSRP[] = "prefetch_results_srp";
const char kDisplaySearchButtonFlagName[] = "display_search_button";
@@ -395,14 +388,9 @@ bool NavEntryIsInstantNTP(const content::WebContents* contents,
if (entry->GetURL() == GetLocalInstantURL(profile))
return true;
- if (ShouldUseCacheableNTP()) {
- GURL new_tab_url(GetNewTabPageURL(profile));
- return new_tab_url.is_valid() &&
- search::MatchesOriginAndPath(entry->GetURL(), new_tab_url);
- }
-
- return IsInstantURL(entry->GetVirtualURL(), profile) &&
- GetSearchTermsImpl(contents, entry).empty();
+ GURL new_tab_url(GetNewTabPageURL(profile));
+ return new_tab_url.is_valid() &&
+ search::MatchesOriginAndPath(entry->GetURL(), new_tab_url);
}
bool IsSuggestPrefEnabled(Profile* profile) {
@@ -458,9 +446,6 @@ std::vector<GURL> GetSearchURLs(Profile* profile) {
}
GURL GetNewTabPageURL(Profile* profile) {
- if (!ShouldUseCacheableNTP())
- return GURL();
-
if (!profile || profile->IsOffTheRecord())
return GURL();
@@ -488,9 +473,6 @@ GURL GetSearchResultPrefetchBaseURL(Profile* profile) {
}
bool ShouldPrefetchSearchResults() {
- if (!ShouldUseCacheableNTP())
- return false;
-
FieldTrialFlags flags;
return GetFieldTrialInfo(&flags) && GetBoolValueForFlagWithDefault(
kPrefetchSearchResultsFlagName, false, flags);
@@ -506,23 +488,6 @@ bool ShouldHideTopVerbatimMatch() {
kHideVerbatimFlagName, false, flags);
}
-bool ShouldUseCacheableNTP() {
- FieldTrialFlags flags;
- return !GetFieldTrialInfo(&flags) || GetBoolValueForFlagWithDefault(
- kUseCacheableNTP, true, flags);
-}
-
-bool ShouldShowInstantNTP() {
- // If using the cacheable NTP, load the NTP directly instead of preloading its
- // contents using InstantNTP.
- if (ShouldUseCacheableNTP())
- return false;
-
- FieldTrialFlags flags;
- return !GetFieldTrialInfo(&flags) ||
- GetBoolValueForFlagWithDefault(kShowNtpFlagName, true, flags);
-}
-
DisplaySearchButtonConditions GetDisplaySearchButtonConditions() {
const CommandLine* cl = CommandLine::ForCurrentProcess();
if (cl->HasSwitch(switches::kDisableSearchButtonInOmnibox)) {
@@ -605,43 +570,6 @@ GURL GetEffectiveURLForInstant(const GURL& url, Profile* profile) {
return effective_url;
}
-int GetInstantLoaderStalenessTimeoutSec() {
- int timeout_sec = kStalePageTimeoutDefault;
- FieldTrialFlags flags;
- if (GetFieldTrialInfo(&flags)) {
- timeout_sec = GetUInt64ValueForFlagWithDefault(kStalePageTimeoutFlagName,
- kStalePageTimeoutDefault,
- flags);
- }
-
- // Require a minimum 5 minute timeout.
- if (timeout_sec < 0 || (timeout_sec > 0 && timeout_sec < 300))
- timeout_sec = kStalePageTimeoutDefault;
-
- // Randomize by upto 15% either side.
- timeout_sec = base::RandInt(timeout_sec * 0.85, timeout_sec * 1.15);
-
- return timeout_sec;
-}
-
-bool IsPreloadedInstantExtendedNTP(const content::WebContents* contents) {
- if (!IsInstantExtendedAPIEnabled())
- return false;
-
- ProfileManager* profile_manager = g_browser_process->profile_manager();
- if (!profile_manager)
- return false; // The profile manager can be NULL while testing.
-
- const std::vector<Profile*>& profiles = profile_manager->GetLoadedProfiles();
- for (size_t i = 0; i < profiles.size(); ++i) {
- const InstantService* instant_service =
- InstantServiceFactory::GetForProfile(profiles[i]);
- if (instant_service && instant_service->GetNTPContents() == contents)
- return true;
- }
- return false;
-}
-
bool HandleNewTabURLRewrite(GURL* url,
content::BrowserContext* browser_context) {
if (!IsInstantExtendedAPIEnabled())
« no previous file with comments | « chrome/browser/search/search.h ('k') | chrome/browser/search/search_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698