summaryrefslogtreecommitdiffstats
path: root/chrome/browser/ui/webui/ntp
diff options
context:
space:
mode:
authormsw@chromium.org <msw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-02-04 01:53:07 +0000
committermsw@chromium.org <msw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-02-04 01:53:07 +0000
commitca87af8d86675f09d36d34c70ebbe2689ba8c183 (patch)
treed15dfd16e00e81c768b53f07512853ce9b90f41d /chrome/browser/ui/webui/ntp
parent37f20cf70515a6cdf930f0ed64a2aa16feb2df53 (diff)
downloadchromium_src-ca87af8d86675f09d36d34c70ebbe2689ba8c183.zip
chromium_src-ca87af8d86675f09d36d34c70ebbe2689ba8c183.tar.gz
chromium_src-ca87af8d86675f09d36d34c70ebbe2689ba8c183.tar.bz2
Merge 120450 - Revise logic to show the first-run bubble at the first appropriate opportunity.
Add static function FirstRunBubbleLauncher::ShowFirstRunBubbleSoon. A FirstRunBubbleLauncher instance acts as a NotificationObserver and manages its own lifetime. Show the bubble on the first NOTIFICATION_LOAD_COMPLETED_MAIN_FRAME when conditions permit. Also, make NTPLoginHandler::HandleLoginMessageSeen set the new NewTabUI::showing_sync_bubble_. The bubble will be delayed if: A) The First-Run Bubble has already been shown. B) The Sync Promo is being shown. C) The NTP Sync Promo Bubble will be shown. D) A Global Error Bubble is pending. Later attempts to show the bubble may succeed. The bubble shows as expected on Win/Mac/Gtk first runs: -When the sync promo is not shown. -On the first new tab/window/navigation ignoring the sync promo. -On clicking "Skip for now" from the sync promo. -On the first new tab/window/navigation after the "Sign in" NTP sync promo bubble. BUG=100299,107005 TEST=Ensure the first-run bubble shows when expected; but not with the sync promo, ntp sign-in sync promo bubble, with global errors, nor ever shown a second time (without the --first-run commandline argument). Review URL: https://chromiumcodereview.appspot.com/9288049 TBR=msw@chromium.org Review URL: https://chromiumcodereview.appspot.com/9317106 git-svn-id: svn://svn.chromium.org/chrome/branches/1025/src@120452 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/ui/webui/ntp')
-rw-r--r--chrome/browser/ui/webui/ntp/new_tab_ui.cc3
-rw-r--r--chrome/browser/ui/webui/ntp/new_tab_ui.h6
-rw-r--r--chrome/browser/ui/webui/ntp/ntp_login_handler.cc3
3 files changed, 11 insertions, 1 deletions
diff --git a/chrome/browser/ui/webui/ntp/new_tab_ui.cc b/chrome/browser/ui/webui/ntp/new_tab_ui.cc
index 1e32af4..452880e 100644
--- a/chrome/browser/ui/webui/ntp/new_tab_ui.cc
+++ b/chrome/browser/ui/webui/ntp/new_tab_ui.cc
@@ -81,7 +81,8 @@ const char kWebStoreLinkExperiment[] = "WebStoreLinkExperiment";
// NewTabUI
NewTabUI::NewTabUI(content::WebUI* web_ui)
- : WebUIController(web_ui) {
+ : WebUIController(web_ui),
+ showing_sync_bubble_(false) {
g_live_new_tabs.Pointer()->insert(this);
// Override some options on the Web UI.
web_ui->HideFavicon();
diff --git a/chrome/browser/ui/webui/ntp/new_tab_ui.h b/chrome/browser/ui/webui/ntp/new_tab_ui.h
index b940284..be6e847 100644
--- a/chrome/browser/ui/webui/ntp/new_tab_ui.h
+++ b/chrome/browser/ui/webui/ntp/new_tab_ui.h
@@ -58,6 +58,9 @@ class NewTabUI : public content::WebUIController,
// from the location bar.
bool CanShowBookmarkBar() const;
+ bool showing_sync_bubble() { return showing_sync_bubble_; }
+ void set_showing_sync_bubble(bool showing) { showing_sync_bubble_ = showing; }
+
class NewTabHTMLSource : public ChromeURLDataManager::DataSource {
public:
explicit NewTabHTMLSource(Profile* profile);
@@ -107,6 +110,9 @@ class NewTabUI : public content::WebUIController,
// The preference version. This used for migrating prefs of the NTP.
static const int current_pref_version_ = 3;
+ // If the sync promo NTP bubble is being shown.
+ bool showing_sync_bubble_;
+
DISALLOW_COPY_AND_ASSIGN(NewTabUI);
};
diff --git a/chrome/browser/ui/webui/ntp/ntp_login_handler.cc b/chrome/browser/ui/webui/ntp/ntp_login_handler.cc
index 76ff9ae..d432c3b 100644
--- a/chrome/browser/ui/webui/ntp/ntp_login_handler.cc
+++ b/chrome/browser/ui/webui/ntp/ntp_login_handler.cc
@@ -25,6 +25,7 @@
#include "chrome/browser/ui/browser_list.h"
#include "chrome/browser/ui/browser_window.h"
#include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
+#include "chrome/browser/ui/webui/ntp/new_tab_ui.h"
#include "chrome/browser/ui/webui/sync_promo/sync_promo_ui.h"
#include "chrome/browser/ui/webui/web_ui_util.h"
#include "chrome/browser/web_resource/promo_resource_service.h"
@@ -171,6 +172,8 @@ void NTPLoginHandler::RecordInHistogram(int type) {
void NTPLoginHandler::HandleLoginMessageSeen(const ListValue* args) {
Profile::FromWebUI(web_ui())->GetPrefs()->SetBoolean(
prefs::kSyncPromoShowNTPBubble, false);
+ NewTabUI* ntp_ui = NewTabUI::FromWebUIController(web_ui()->GetController());
+ ntp_ui->set_showing_sync_bubble(true);
}
void NTPLoginHandler::HandleShowAdvancedLoginUI(const ListValue* args) {