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

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: 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..d137683d1ae1a6773ba69b227f3a0dcdd1eed2e0 100644
--- a/chrome/browser/search/search.cc
+++ b/chrome/browser/search/search.cc
@@ -13,6 +13,7 @@
#include "base/strings/string_split.h"
#include "base/strings/utf_string_conversions.h"
#include "chrome/browser/browser_process.h"
+#include "chrome/browser/chromeos/login/signin/merge_session_throttling_utils.h"
Marc Treib 2016/04/21 08:32:12 This should go into an #if defined(OS_CHROMEOS) bl
afakhry 2016/04/21 17:04:09 Done.
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/profiles/profile_manager.h"
#include "chrome/browser/search/instant_service.h"
@@ -239,6 +240,23 @@ NewTabURLState IsValidNewTabURL(Profile* profile, const GURL& new_tab_url) {
return NEW_TAB_URL_VALID;
}
+#if defined(OS_CHROMEOS)
+
+// 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 ShouldShowLocalNtpWhileMergeSessionInProgress(const GURL& url,
+ Profile* profile) {
+ if (!merge_session_throttling_utils::ShouldDelayUrl(url) ||
Marc Treib 2016/04/21 08:32:12 I'd move the "#if defined(OS_CHROMEOS)" here so th
afakhry 2016/04/21 17:04:09 Done.
+ !merge_session_throttling_utils::ShouldDelayRequest(profile)) {
+ return false;
+ }
+
+ return true;
+}
+
+#endif // defined(OS_CHROMEOS)
+
// 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 +277,15 @@ struct NewTabURLDetails {
GURL search_provider_url = TemplateURLRefToGURL(
template_url->new_tab_url_ref(), UIThreadSearchTermsData(profile),
false, false);
+
+#if defined(OS_CHROMEOS)
+ if (ShouldShowLocalNtpWhileMergeSessionInProgress(search_provider_url,
+ profile)) {
+ // Force load the local NTP if the merge session is not complete.
+ return NewTabURLDetails(local_url, NEW_TAB_URL_VALID);
+ }
+#endif // defined(OS_CHROMEOS)
+
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