summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormirandac@chromium.org <mirandac@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-11-17 17:19:44 +0000
committermirandac@chromium.org <mirandac@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-11-17 17:19:44 +0000
commitf6d5bd81b2f74895ec9b6dae40373c860309702f (patch)
tree5257b936872f71a9e2a5e20f81186b25a9fa9f27
parent8b6d757916ca414520e3e1746669a818e43ff249 (diff)
downloadchromium_src-f6d5bd81b2f74895ec9b6dae40373c860309702f.zip
chromium_src-f6d5bd81b2f74895ec9b6dae40373c860309702f.tar.gz
chromium_src-f6d5bd81b2f74895ec9b6dae40373c860309702f.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. Review URL: http://codereview.chromium.org/385135 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@32176 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/browser.cc3
-rw-r--r--chrome/browser/dom_ui/dom_ui_theme_source.cc13
-rw-r--r--chrome/browser/dom_ui/new_tab_ui.cc19
-rw-r--r--chrome/browser/resources/new_new_tab.css10
-rw-r--r--chrome/browser/resources/new_new_tab.js7
-rw-r--r--chrome/common/pref_names.cc6
-rw-r--r--chrome/common/pref_names.h3
7 files changed, 37 insertions, 24 deletions
diff --git a/chrome/browser/browser.cc b/chrome/browser/browser.cc
index 900a121..452b127 100644
--- a/chrome/browser/browser.cc
+++ b/chrome/browser/browser.cc
@@ -1356,7 +1356,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 3cc1dd6..5b77214 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);
}
@@ -568,12 +569,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);
@@ -942,10 +937,12 @@ void NewTabUI::NewTabHTMLSource::InitFullHTML(Profile* profile) {
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.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[];