Skip to content
This repository has been archived by the owner on Apr 3, 2020. It is now read-only.

Commit

Permalink
Don't show bubble over 'Getting started' page on Win10
Browse files Browse the repository at this point in the history
This works, in that it stops it from getting shown over the first page.

An additional problem on Win10 is that when the user switches to the
NTP (as that's the default setup on Win10: [Getting started, NTP]) the
bubble won't show because the Observer only watches navigations. Once
*another* new tab is created or the user navigates, then it'll show up.
This is at least an improvement.

TBR=grt@chromium.org
BUG=521572

Review URL: https://codereview.chromium.org/1330553003

Cr-Commit-Position: refs/heads/master@{#347515}
(cherry picked from commit dd9b9d3)

Review URL: https://codereview.chromium.org/1310883011 .

Cr-Commit-Position: refs/branch-heads/2490@{#195}
Cr-Branched-From: 7790a35-refs/heads/master@{#344925}
  • Loading branch information
sgraham committed Sep 9, 2015
1 parent f0ba9fd commit ccd2db1
Showing 1 changed file with 21 additions and 6 deletions.
27 changes: 21 additions & 6 deletions chrome/browser/first_run/first_run.cc
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,15 @@
#include "chrome/common/chrome_switches.h"
#include "chrome/common/pref_names.h"
#include "chrome/common/url_constants.h"
#include "chrome/grit/locale_settings.h"
#include "chrome/installer/util/master_preferences.h"
#include "chrome/installer/util/master_preferences_constants.h"
#include "chrome/installer/util/util_constants.h"
#include "components/pref_registry/pref_registry_syncable.h"
#include "components/search_engines/template_url_service.h"
#include "components/signin/core/browser/signin_manager.h"
#include "components/signin/core/browser/signin_tracker.h"
#include "content/public/browser/navigation_entry.h"
#include "content/public/browser/notification_observer.h"
#include "content/public/browser/notification_registrar.h"
#include "content/public/browser/notification_service.h"
Expand All @@ -63,6 +65,7 @@
#include "content/public/browser/web_contents.h"
#include "extensions/browser/extension_system.h"
#include "google_apis/gaia/gaia_auth_util.h"
#include "ui/base/l10n/l10n_util.h"
#include "url/gurl.h"

using base::UserMetricsAction;
Expand Down Expand Up @@ -300,6 +303,18 @@ void ConvertStringVectorToGURLVector(
std::transform(src.begin(), src.end(), ret->begin(), &UrlFromString);
}

bool IsOnWelcomePage(content::WebContents* contents) {
// We have to check both the GetURL() similar to the other checks below, but
// also the original request url because the welcome page we use is a
// redirect.
GURL welcome_page(l10n_util::GetStringUTF8(IDS_WELCOME_PAGE_URL));
return contents->GetURL() == welcome_page ||
(contents->GetController().GetVisibleEntry() &&
contents->GetController()
.GetVisibleEntry()
->GetOriginalRequestURL() == welcome_page);
}

// Show the first run search engine bubble at the first appropriate opportunity.
// This bubble may be delayed by other UI, like global errors and sync promos.
class FirstRunBubbleLauncher : public content::NotificationObserver {
Expand Down Expand Up @@ -366,12 +381,12 @@ void FirstRunBubbleLauncher::Observe(

// Suppress the first run bubble if a Gaia sign in page or the sync setup
// page is showing.
if (contents &&
(contents->GetURL().GetOrigin().spec() ==
chrome::kChromeUIChromeSigninURL ||
gaia::IsGaiaSignonRealm(contents->GetURL().GetOrigin()) ||
contents->GetURL() ==
chrome::GetSettingsUrl(chrome::kSyncSetupSubPage))) {
if (contents && (contents->GetURL().GetOrigin().spec() ==
chrome::kChromeUIChromeSigninURL ||
gaia::IsGaiaSignonRealm(contents->GetURL().GetOrigin()) ||
contents->GetURL() ==
chrome::GetSettingsUrl(chrome::kSyncSetupSubPage) ||
IsOnWelcomePage(contents))) {
return;
}

Expand Down

0 comments on commit ccd2db1

Please sign in to comment.