Chromium Code Reviews| 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: |