summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorScott Graham <scottmg@chromium.org>2015-09-10 16:08:22 -0700
committerScott Graham <scottmg@chromium.org>2015-09-10 23:10:29 +0000
commit28378e9e8901cc67e95875a34bfcd7baedd0dd77 (patch)
tree0d2170c0f8c265b81d7fa1dceb2389eab576be25
parentdfb692cb2b957cf68a3c5acf6dc5fbf61373963c (diff)
downloadchromium_src-28378e9e8901cc67e95875a34bfcd7baedd0dd77.zip
chromium_src-28378e9e8901cc67e95875a34bfcd7baedd0dd77.tar.gz
chromium_src-28378e9e8901cc67e95875a34bfcd7baedd0dd77.tar.bz2
Don't show bubble over 'Getting started' page on Win10
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 dd9b9d3bc79c7a8c457160b6a723a4c44598afec) Review URL: https://codereview.chromium.org/1334033002 . Cr-Commit-Position: refs/branch-heads/2454@{#457} Cr-Branched-From: 12bfc3360892ec53cd00fc239a47e5298beb063b-refs/heads/master@{#338390}
-rw-r--r--chrome/browser/first_run/first_run.cc27
1 files changed, 21 insertions, 6 deletions
diff --git a/chrome/browser/first_run/first_run.cc b/chrome/browser/first_run/first_run.cc
index 9c739e9..a5838be 100644
--- a/chrome/browser/first_run/first_run.cc
+++ b/chrome/browser/first_run/first_run.cc
@@ -48,6 +48,7 @@
#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"
@@ -55,6 +56,7 @@
#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"
@@ -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;
@@ -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 {
@@ -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;
}