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

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

Issue 1910693002: Avoid the long merge session throttle interstitial page for NTP on Chrome OS (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: piman's nit Created 4 years, 8 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/chromeos/login/signin/merge_session_throttling_utils.cc ('k') | no next file » | 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 645fecb9a52e535b344cc9554331c891695ddc61..c3efbe794a8450d2204a1e313f189c70a15df967 100644
--- a/chrome/browser/search/search.cc
+++ b/chrome/browser/search/search.cc
@@ -42,6 +42,10 @@
#include "chrome/browser/supervised_user/supervised_user_url_filter.h"
#endif
+#if defined(OS_CHROMEOS)
+#include "chrome/browser/chromeos/login/signin/merge_session_throttling_utils.h"
+#endif // defined(OS_CHROMEOS)
+
namespace search {
namespace {
@@ -239,6 +243,19 @@ NewTabURLState IsValidNewTabURL(Profile* profile, const GURL& new_tab_url) {
return NEW_TAB_URL_VALID;
}
+// On Chrome OS, if the session hasn't merged yet, we need to avoid loading the
+// remote NTP because that will trigger showing the merge session throttle
+// interstitial page, which can show for 5+ seconds. crbug.com/591530.
+bool ShouldShowLocalNewTab(const GURL& url, Profile* profile) {
+#if defined(OS_CHROMEOS)
+ if (merge_session_throttling_utils::ShouldDelayRequestForProfile(profile) &&
+ merge_session_throttling_utils::ShouldDelayUrl(url)) {
+ return true;
+ }
+#endif // defined(OS_CHROMEOS)
+ return false;
+}
+
// Used to look up the URL to use for the New Tab page. Also tracks how we
// arrived at that URL so it can be logged with UMA.
struct NewTabURLDetails {
@@ -259,6 +276,10 @@ struct NewTabURLDetails {
GURL search_provider_url = TemplateURLRefToGURL(
template_url->new_tab_url_ref(), UIThreadSearchTermsData(profile),
false, false);
+
+ if (ShouldShowLocalNewTab(search_provider_url, profile))
+ return NewTabURLDetails(local_url, NEW_TAB_URL_VALID);
+
NewTabURLState state = IsValidNewTabURL(profile, search_provider_url);
switch (state) {
case NEW_TAB_URL_VALID:
« no previous file with comments | « chrome/browser/chromeos/login/signin/merge_session_throttling_utils.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698