diff options
author | guohui@chromium.org <guohui@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-06-19 05:08:35 +0000 |
---|---|---|
committer | guohui@chromium.org <guohui@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-06-19 05:08:35 +0000 |
commit | 17c54c667208e277e3d3a109d282cc6f741b415a (patch) | |
tree | c1811d53bf70f3d1647e806f299dec1c937dddd2 | |
parent | 25ad64bd3d8585045e2b633922345cf466d2aaad (diff) | |
download | chromium_src-17c54c667208e277e3d3a109d282cc6f741b415a.zip chromium_src-17c54c667208e277e3d3a109d282cc6f741b415a.tar.gz chromium_src-17c54c667208e277e3d3a109d282cc6f741b415a.tar.bz2 |
Remove NTP4 intro bubble
BUG=132330
TEST=Launch chrome and open NTP page, verify that intro bubble is never shown.
Review URL: https://chromiumcodereview.appspot.com/10556048
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@142914 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/prefs/browser_prefs.cc | 2 | ||||
-rw-r--r-- | chrome/browser/resources/ntp4/new_tab.js | 21 | ||||
-rw-r--r-- | chrome/browser/ui/browser.cc | 5 | ||||
-rw-r--r-- | chrome/browser/ui/webui/ntp/new_tab_page_handler.cc | 59 | ||||
-rw-r--r-- | chrome/browser/ui/webui/ntp/new_tab_page_handler.h | 11 | ||||
-rw-r--r-- | chrome/browser/ui/webui/ntp/ntp_resource_cache.cc | 5 | ||||
-rw-r--r-- | chrome/common/chrome_notification_types.h | 4 | ||||
-rw-r--r-- | chrome/common/pref_names.cc | 3 | ||||
-rw-r--r-- | chrome/common/pref_names.h | 1 |
9 files changed, 1 insertions, 110 deletions
diff --git a/chrome/browser/prefs/browser_prefs.cc b/chrome/browser/prefs/browser_prefs.cc index 9b83d0f..5214ff6 100644 --- a/chrome/browser/prefs/browser_prefs.cc +++ b/chrome/browser/prefs/browser_prefs.cc @@ -64,7 +64,6 @@ #include "chrome/browser/ui/tabs/pinned_tab_codec.h" #include "chrome/browser/ui/webui/extensions/extension_settings_handler.h" #include "chrome/browser/ui/webui/flags_ui.h" -#include "chrome/browser/ui/webui/ntp/new_tab_page_handler.h" #include "chrome/browser/ui/webui/ntp/new_tab_ui.h" #include "chrome/browser/ui/webui/plugins_ui.h" #include "chrome/browser/ui/webui/sync_promo/sync_promo_ui.h" @@ -151,7 +150,6 @@ void RegisterLocalState(PrefService* local_state) { Browser::RegisterPrefs(local_state); FlagsUI::RegisterPrefs(local_state); ManagedMode::RegisterPrefs(local_state); - NewTabPageHandler::RegisterPrefs(local_state); PromoResourceService::RegisterPrefs(local_state); UpgradeDetector::RegisterPrefs(local_state); #endif diff --git a/chrome/browser/resources/ntp4/new_tab.js b/chrome/browser/resources/ntp4/new_tab.js index f51cc1c..57c2a68 100644 --- a/chrome/browser/resources/ntp4/new_tab.js +++ b/chrome/browser/resources/ntp4/new_tab.js @@ -181,27 +181,6 @@ cr.define('ntp', function() { // The anchor node won't be updated until updateLogin is called so don't // show the bubble yet. shouldShowLoginBubble = true; - } else if (loadTimeData.valueExists('ntp4_intro_message')) { - infoBubble = new cr.ui.Bubble; - infoBubble.anchorNode = newTabView.mostVisitedPage.navigationDot; - infoBubble.setArrowLocation(cr.ui.ArrowLocation.BOTTOM_START); - infoBubble.handleCloseEvent = function() { - this.hide(); - chrome.send('introMessageDismissed'); - }; - - var bubbleContent = $('ntp4-intro-bubble-contents'); - infoBubble.content = bubbleContent; - - bubbleContent.querySelector('div > div').innerHTML = - loadTimeData.getString('ntp4_intro_message'); - - var learnMoreLink = bubbleContent.querySelector('a'); - learnMoreLink.href = loadTimeData.getString('ntp4_intro_url'); - learnMoreLink.onclick = infoBubble.hide.bind(infoBubble); - - infoBubble.show(); - chrome.send('introMessageSeen'); } var loginContainer = getRequiredElement('login-container'); diff --git a/chrome/browser/ui/browser.cc b/chrome/browser/ui/browser.cc index 895b108..6782c0a 100644 --- a/chrome/browser/ui/browser.cc +++ b/chrome/browser/ui/browser.cc @@ -131,7 +131,6 @@ #include "chrome/browser/ui/web_applications/web_app_ui.h" #include "chrome/browser/ui/webui/feedback_ui.h" #include "chrome/browser/ui/webui/ntp/app_launcher_handler.h" -#include "chrome/browser/ui/webui/ntp/new_tab_page_handler.h" #include "chrome/browser/ui/webui/options2/content_settings_handler2.h" #include "chrome/browser/ui/webui/signin/login_ui_service.h" #include "chrome/browser/ui/webui/signin/login_ui_service_factory.h" @@ -565,10 +564,6 @@ void Browser::InitBrowserWindow() { // Reset the preference so we don't call it again for subsequent windows. local_state->ClearPref(prefs::kAutofillPersonalDataManagerFirstRun); } - - // Permanently dismiss ntp4 bubble for new users. - if (first_run::IsChromeFirstRun()) - NewTabPageHandler::DismissIntroMessage(local_state); } void Browser::SetWindowForTesting(BrowserWindow* window) { diff --git a/chrome/browser/ui/webui/ntp/new_tab_page_handler.cc b/chrome/browser/ui/webui/ntp/new_tab_page_handler.cc index 0b4846e..c3cc01a 100644 --- a/chrome/browser/ui/webui/ntp/new_tab_page_handler.cc +++ b/chrome/browser/ui/webui/ntp/new_tab_page_handler.cc @@ -23,12 +23,6 @@ #include "grit/generated_resources.h" #include "ui/base/l10n/l10n_util.h" -static const int kIntroDisplayMax = 10; - -// The URL of a knowledge-base article about the new NTP. -static const char kNtp4IntroURL[] = - "http://www.google.com/support/chrome/bin/answer.py?answer=95451"; - static const char kDefaultPageTypeHistogram[] = "NewTabPage.DefaultPageType"; @@ -66,12 +60,6 @@ void NewTabPageHandler::RegisterMessages() { web_ui()->RegisterMessageCallback("pageSelected", base::Bind(&NewTabPageHandler::HandlePageSelected, base::Unretained(this))); - web_ui()->RegisterMessageCallback("introMessageDismissed", - base::Bind(&NewTabPageHandler::HandleIntroMessageDismissed, - base::Unretained(this))); - web_ui()->RegisterMessageCallback("introMessageSeen", - base::Bind(&NewTabPageHandler::HandleIntroMessageSeen, - base::Unretained(this))); } void NewTabPageHandler::HandleCloseNotificationPromo(const ListValue* args) { @@ -119,19 +107,6 @@ void NewTabPageHandler::HandlePageSelected(const ListValue* args) { } } -void NewTabPageHandler::HandleIntroMessageDismissed(const ListValue* args) { - PrefService* prefs = g_browser_process->local_state(); - prefs->SetInteger(prefs::kNtp4IntroDisplayCount, kIntroDisplayMax + 1); - Notify(chrome::NTP4_INTRO_PREF_CHANGED); -} - -void NewTabPageHandler::HandleIntroMessageSeen(const ListValue* args) { - PrefService* prefs = g_browser_process->local_state(); - int intro_displays = prefs->GetInteger(prefs::kNtp4IntroDisplayCount); - prefs->SetInteger(prefs::kNtp4IntroDisplayCount, intro_displays + 1); - Notify(chrome::NTP4_INTRO_PREF_CHANGED); -} - // static void NewTabPageHandler::RegisterUserPrefs(PrefService* prefs) { // TODO(estade): should be syncable. @@ -140,12 +115,6 @@ void NewTabPageHandler::RegisterUserPrefs(PrefService* prefs) { } // static -void NewTabPageHandler::RegisterPrefs(PrefService* prefs) { - prefs->RegisterIntegerPref(prefs::kNtp4IntroDisplayCount, 0, - PrefService::UNSYNCABLE_PREF); -} - -// static void NewTabPageHandler::GetLocalizedValues(Profile* profile, DictionaryValue* values) { values->SetInteger("most_visited_page_id", MOST_VISITED_PAGE_ID); @@ -156,34 +125,6 @@ void NewTabPageHandler::GetLocalizedValues(Profile* profile, int shown_page = prefs->GetInteger(prefs::kNtpShownPage); values->SetInteger("shown_page_type", shown_page & ~INDEX_MASK); values->SetInteger("shown_page_index", shown_page & INDEX_MASK); - -#if !defined(USE_AURA) - // Only show intro bubble for non-aura build. - - PrefService* local_state = g_browser_process->local_state(); - int intro_displays = local_state->GetInteger(prefs::kNtp4IntroDisplayCount); - // This preference used to exist in profile, so check the profile if it has - // not been set in local state yet. - if (!intro_displays) { - prefs->RegisterIntegerPref(prefs::kNtp4IntroDisplayCount, 0, - PrefService::UNSYNCABLE_PREF); - intro_displays = prefs->GetInteger(prefs::kNtp4IntroDisplayCount); - if (intro_displays) - local_state->SetInteger(prefs::kNtp4IntroDisplayCount, intro_displays); - } - if (intro_displays <= kIntroDisplayMax) { - values->SetString("ntp4_intro_message", - l10n_util::GetStringUTF16(IDS_NTP4_INTRO_MESSAGE)); - values->SetString("ntp4_intro_url", kNtp4IntroURL); - } -#endif -} - -// static -void NewTabPageHandler::DismissIntroMessage(PrefService* prefs) { - prefs->SetInteger(prefs::kNtp4IntroDisplayCount, kIntroDisplayMax + 1); - // No need to send notification to update resource cache, because this method - // is only called during startup before the ntp resource cache is constructed. } void NewTabPageHandler::Notify(chrome::NotificationType notification_type) { diff --git a/chrome/browser/ui/webui/ntp/new_tab_page_handler.h b/chrome/browser/ui/webui/ntp/new_tab_page_handler.h index a18d7c0..0a28bf7 100644 --- a/chrome/browser/ui/webui/ntp/new_tab_page_handler.h +++ b/chrome/browser/ui/webui/ntp/new_tab_page_handler.h @@ -31,14 +31,6 @@ class NewTabPageHandler : public content::WebUIMessageHandler { // Callback for "pageSelected". void HandlePageSelected(const ListValue* args); - // Callback for "introMessageDismissed". This is called when the close button - // on the ntp4 bubble is clicked or when a NavDot is clicked. - void HandleIntroMessageDismissed(const ListValue* args); - - // Callback for "handleIntroMessageSeen". No arguments. Called when the intro - // message is displayed. - void HandleIntroMessageSeen(const ListValue* args); - // Register NTP per-profile preferences. static void RegisterUserPrefs(PrefService* prefs); @@ -48,9 +40,6 @@ class NewTabPageHandler : public content::WebUIMessageHandler { // Registers values (strings etc.) for the page. static void GetLocalizedValues(Profile* profile, DictionaryValue* values); - // Permanently dismiss the ntp4 bubble for new users. - static void DismissIntroMessage(PrefService* prefs); - private: // Tracks the number of times the user has switches pages (for UMA). size_t page_switch_count_; diff --git a/chrome/browser/ui/webui/ntp/ntp_resource_cache.cc b/chrome/browser/ui/webui/ntp/ntp_resource_cache.cc index ea201a5..da04a88 100644 --- a/chrome/browser/ui/webui/ntp/ntp_resource_cache.cc +++ b/chrome/browser/ui/webui/ntp/ntp_resource_cache.cc @@ -186,8 +186,6 @@ NTPResourceCache::NTPResourceCache(Profile* profile) ThemeServiceFactory::GetForProfile(profile))); registrar_.Add(this, chrome::NOTIFICATION_PROMO_RESOURCE_STATE_CHANGED, content::NotificationService::AllSources()); - registrar_.Add(this, chrome::NTP4_INTRO_PREF_CHANGED, - content::NotificationService::AllSources()); // Watch for pref changes that cause us to need to invalidate the HTML cache. pref_change_registrar_.Init(profile_->GetPrefs()); @@ -250,8 +248,7 @@ void NTPResourceCache::Observe(int type, new_tab_html_ = NULL; new_tab_incognito_css_ = NULL; new_tab_css_ = NULL; - } else if (chrome::NOTIFICATION_PREF_CHANGED == type || - chrome::NTP4_INTRO_PREF_CHANGED == type) { + } else if (chrome::NOTIFICATION_PREF_CHANGED == type) { // A change occurred to one of the preferences we care about, so flush the // cache. new_tab_incognito_html_ = NULL; diff --git a/chrome/common/chrome_notification_types.h b/chrome/common/chrome_notification_types.h index bf61354..0838e0a 100644 --- a/chrome/common/chrome_notification_types.h +++ b/chrome/common/chrome_notification_types.h @@ -383,10 +383,6 @@ enum NotificationType { // details are NoDetails. NOTIFICATION_PROMO_RESOURCE_STATE_CHANGED, - // The number of times that NTP4 bubble is shown has been changed. The NTP - // resource cache has to be refreshed to remove the NTP4 bubble. - NTP4_INTRO_PREF_CHANGED, - // Autocomplete ------------------------------------------------------------ // Sent by the autocomplete controller when done. The source is the diff --git a/chrome/common/pref_names.cc b/chrome/common/pref_names.cc index c8eb8f1..a7965b9 100644 --- a/chrome/common/pref_names.cc +++ b/chrome/common/pref_names.cc @@ -1405,9 +1405,6 @@ const char kExtensionBlacklistUpdateVersion[] = // Keeps track of which sessions are collapsed in the Other Devices menu. const char kNtpCollapsedForeignSessions[] = "ntp.collapsed_foreign_sessions"; -// Number of times the NTP4 informational bubble has been shown. -const char kNtp4IntroDisplayCount[] = "ntp.intro_display_count"; - // New Tab Page URLs that should not be shown as most visited thumbnails. const char kNtpMostVisitedURLsBlacklist[] = "ntp.most_visited_blacklist"; diff --git a/chrome/common/pref_names.h b/chrome/common/pref_names.h index 2f192d4..9d91ede 100644 --- a/chrome/common/pref_names.h +++ b/chrome/common/pref_names.h @@ -508,7 +508,6 @@ extern const char kExtensionBlacklistUpdateVersion[]; extern const char kNtpTipsResourceServer[]; -extern const char kNtp4IntroDisplayCount[]; extern const char kNtpCollapsedForeignSessions[]; extern const char kNtpMostVisitedURLsBlacklist[]; extern const char kNtpPromoResourceCache[]; |