diff options
author | mirandac@chromium.org <mirandac@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-11-18 22:05:04 +0000 |
---|---|---|
committer | mirandac@chromium.org <mirandac@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-11-18 22:05:04 +0000 |
commit | deb958caa1a2d2390633e5b8194bc57c23fc4a7d (patch) | |
tree | b16386ad9e919a09a32e44c7fb0fa1a7cea248e1 | |
parent | 9d1cb4e7f4217761ceaf9aeaed7c4b18c2d99db6 (diff) | |
download | chromium_src-deb958caa1a2d2390633e5b8194bc57c23fc4a7d.zip chromium_src-deb958caa1a2d2390633e5b8194bc57c23fc4a7d.tar.gz chromium_src-deb958caa1a2d2390633e5b8194bc57c23fc4a7d.tar.bz2 |
Tweaks and fixes for NTP extension promo.
Don't show promo for extensions on Mac, as they're not available yet. Decrement promo counter even when NTP is not home page, and do not remove puzzle piece when promo line is closed. When message bar is closed, make it zip off bottom of screen instead of just disappearing.
BUG= 27814, 25258, 27815
TEST= see various bugs.
Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=32176
Review URL: http://codereview.chromium.org/385135
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@32413 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/browser.cc | 3 | ||||
-rw-r--r-- | chrome/browser/dom_ui/dom_ui_theme_source.cc | 13 | ||||
-rw-r--r-- | chrome/browser/dom_ui/new_tab_ui.cc | 21 | ||||
-rw-r--r-- | chrome/browser/resources/new_new_tab.css | 10 | ||||
-rw-r--r-- | chrome/browser/resources/new_new_tab.html | 1 | ||||
-rw-r--r-- | chrome/browser/resources/new_new_tab.js | 7 | ||||
-rw-r--r-- | chrome/common/pref_names.cc | 6 | ||||
-rw-r--r-- | chrome/common/pref_names.h | 3 |
8 files changed, 37 insertions, 27 deletions
diff --git a/chrome/browser/browser.cc b/chrome/browser/browser.cc index 6379b34..80fe2429 100644 --- a/chrome/browser/browser.cc +++ b/chrome/browser/browser.cc @@ -1363,7 +1363,8 @@ void Browser::RegisterUserPrefs(PrefService* prefs) { prefs->RegisterIntegerPref(prefs::kDeleteTimePeriod, 0); prefs->RegisterBooleanPref(prefs::kCheckDefaultBrowser, true); prefs->RegisterBooleanPref(prefs::kShowOmniboxSearchHint, true); - prefs->RegisterIntegerPref(prefs::kNTPPromoRemaining, 5); + prefs->RegisterIntegerPref(prefs::kNTPPromoLineRemaining, 5); + prefs->RegisterIntegerPref(prefs::kNTPPromoImageRemaining, 5); prefs->RegisterBooleanPref(prefs::kShowExtensionShelf, true); prefs->RegisterBooleanPref(prefs::kWebAppCreateOnDesktop, true); prefs->RegisterBooleanPref(prefs::kWebAppCreateInAppsMenu, true); diff --git a/chrome/browser/dom_ui/dom_ui_theme_source.cc b/chrome/browser/dom_ui/dom_ui_theme_source.cc index e5e473f..759033b 100644 --- a/chrome/browser/dom_ui/dom_ui_theme_source.cc +++ b/chrome/browser/dom_ui/dom_ui_theme_source.cc @@ -184,13 +184,22 @@ void DOMUIThemeSource::InitNewTabCSS(Profile* profile) { subst2.push_back(SkColorToRGBAString(color_link_underline)); // $$6 subst2.push_back(SkColorToRGBAString(color_section_link_underline)); // $$7 - if (profile->GetPrefs()->GetInteger(prefs::kNTPPromoRemaining) > 0) { +#if defined(OS_MACOSX) + // No extensions available on Mac yet. + subst2.push_back("none"); // $$8: display of lower right promo image + subst2.push_back("none"); // $$9: display of butterbar footer promo line +#else + if (profile->GetPrefs()->GetInteger(prefs::kNTPPromoImageRemaining) > 0) { subst2.push_back("block"); // $$8 - subst2.push_back("inline-block"); // $$9 } else { subst2.push_back("none"); // $$8 + } + if (profile->GetPrefs()->GetInteger(prefs::kNTPPromoLineRemaining) > 0) { + subst2.push_back("inline-block"); // $$9 + } else { subst2.push_back("none"); // $$9 } +#endif // Get our template. static const base::StringPiece new_tab_theme_css( diff --git a/chrome/browser/dom_ui/new_tab_ui.cc b/chrome/browser/dom_ui/new_tab_ui.cc index 02dc255a..7c8c507 100644 --- a/chrome/browser/dom_ui/new_tab_ui.cc +++ b/chrome/browser/dom_ui/new_tab_ui.cc @@ -219,14 +219,15 @@ class PromotionalMessageHandler : public DOMMessageHandler { }; void PromotionalMessageHandler::RegisterMessages() { - dom_ui_->RegisterMessageCallback("stopPromoMessages", + dom_ui_->RegisterMessageCallback("stopPromoLineMessage", NewCallback(this, &PromotionalMessageHandler::HandleClosePromotionalMessage)); } void PromotionalMessageHandler::HandleClosePromotionalMessage( const Value* content) { - dom_ui_->GetProfile()->GetPrefs()->SetInteger(prefs::kNTPPromoRemaining, 0); + dom_ui_->GetProfile()->GetPrefs()->SetInteger( + prefs::kNTPPromoLineRemaining, 0); } @@ -569,12 +570,6 @@ NewTabUI::NewTabUI(TabContents* contents) // thumbnails, but also clicks on recently bookmarked. link_transition_type_ = PageTransition::AUTO_BOOKMARK; - if (NewTabHTMLSource::first_view() && - (GetProfile()->GetPrefs()->GetInteger(prefs::kRestoreOnStartup) != 0 || - !GetProfile()->GetPrefs()->GetBoolean(prefs::kHomePageIsNewTabPage))) { - NewTabHTMLSource::set_first_view(false); - } - if (NewTabUI::FirstRunDisabled()) NewTabHTMLSource::set_first_run(false); @@ -941,12 +936,12 @@ void NewTabUI::NewTabHTMLSource::InitFullHTML(Profile* profile) { // Let the tab know whether it's the first tab being viewed. if (first_view_) { - localized_strings.SetString(L"firstview", L"true"); - - // Decrement ntp promo counter; the default value is specified in + // Decrement ntp promo counters; the default values are specified in // Browser::RegisterUserPrefs. - profile->GetPrefs()->SetInteger(prefs::kNTPPromoRemaining, - profile->GetPrefs()->GetInteger(prefs::kNTPPromoRemaining) - 1); + profile->GetPrefs()->SetInteger(prefs::kNTPPromoLineRemaining, + profile->GetPrefs()->GetInteger(prefs::kNTPPromoLineRemaining) - 1); + profile->GetPrefs()->SetInteger(prefs::kNTPPromoImageRemaining, + profile->GetPrefs()->GetInteger(prefs::kNTPPromoImageRemaining) - 1); first_view_ = false; } diff --git a/chrome/browser/resources/new_new_tab.css b/chrome/browser/resources/new_new_tab.css index 79b135d..ddf6ca2 100644 --- a/chrome/browser/resources/new_new_tab.css +++ b/chrome/browser/resources/new_new_tab.css @@ -690,21 +690,25 @@ html[dir='rtl'] #option-menu > [command='hide']:before { /* promotions line */ #bottom-right-promo { position: absolute; - display: block; width: 180px; height: 131px; border: 0; bottom: 0px; right: 0px; + z-index: -1; } #footer { position: fixed; - bottom: 0px; + bottom: 0; left: 0px; text-align: center; width: 100%; - display: block; + -webkit-transition: bottom .15s; +} + +#footer.hide-footer { + bottom: -40px; } #promo-line { diff --git a/chrome/browser/resources/new_new_tab.html b/chrome/browser/resources/new_new_tab.html index 6b62355..25ce5af 100644 --- a/chrome/browser/resources/new_new_tab.html +++ b/chrome/browser/resources/new_new_tab.html @@ -1,7 +1,6 @@ <!DOCTYPE html> <html i18n-values=" dir:textdirection; - firstview:firstview; bookmarkbarattached:bookmarkbarattached; hasattribution:hasattribution; anim:anim; diff --git a/chrome/browser/resources/new_new_tab.js b/chrome/browser/resources/new_new_tab.js index a27bf06..2e539e3 100644 --- a/chrome/browser/resources/new_new_tab.js +++ b/chrome/browser/resources/new_new_tab.js @@ -1593,10 +1593,9 @@ function fixLinkUnderline(el) { updateAttribution(); -/* Close the promo notices when close button on the promo-line is clicked. */ +// Closes the promo line when close button is clicked. $('promo-close').onclick = function (e) { - $('promo-line').style.display = 'none'; - $('bottom-right-promo').style.display = 'none'; - chrome.send('stopPromoMessages'); + $('footer').className = 'hide-footer'; + chrome.send('stopPromoLineMessage'); e.preventDefault(); }; diff --git a/chrome/common/pref_names.cc b/chrome/common/pref_names.cc index 7041d9b..a66aa9a 100644 --- a/chrome/common/pref_names.cc +++ b/chrome/common/pref_names.cc @@ -285,8 +285,10 @@ const wchar_t kShowOmniboxSearchHint[] = L"browser.show_omnibox_search_hint"; // Integer that counts the number of times the promo on the NTP has left to be // shown; this decrements each time the NTP is shown for the first time -// in a session. -const wchar_t kNTPPromoRemaining[] = L"browser.ntp.promo_remaining"; +// in a session. The message line can be closed separately from the promo +// image, so we store two separate values for number of remaining views. +const wchar_t kNTPPromoLineRemaining[] = L"browser.ntp.promo_line_remaining"; +const wchar_t kNTPPromoImageRemaining[] = L"browser.ntp.promo_image_remaining"; // The list of origins which are allowed|denied to show desktop notifications. const wchar_t kDesktopNotificationAllowedOrigins[] = diff --git a/chrome/common/pref_names.h b/chrome/common/pref_names.h index f821180..9271408 100644 --- a/chrome/common/pref_names.h +++ b/chrome/common/pref_names.h @@ -113,7 +113,8 @@ extern const wchar_t kExtensionsUIDeveloperMode[]; extern const wchar_t kCheckDefaultBrowser[]; extern const wchar_t kUseCustomChromeFrame[]; extern const wchar_t kShowOmniboxSearchHint[]; -extern const wchar_t kNTPPromoRemaining[]; +extern const wchar_t kNTPPromoLineRemaining[]; +extern const wchar_t kNTPPromoImageRemaining[]; extern const wchar_t kDesktopNotificationAllowedOrigins[]; extern const wchar_t kDesktopNotificationDeniedOrigins[]; |