summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormirandac@chromium.org <mirandac@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-11-15 19:19:30 +0000
committermirandac@chromium.org <mirandac@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-11-15 19:19:30 +0000
commita7a2b70880a149060184f7039fb0468d2dda7b4b (patch)
treeba2cf6af9903256bfad59e15f57bc93bcca1d0e1
parent50d7d721e63e1e1604b37b9361ec03a5affdfd0d (diff)
downloadchromium_src-a7a2b70880a149060184f7039fb0468d2dda7b4b.zip
chromium_src-a7a2b70880a149060184f7039fb0468d2dda7b4b.tar.gz
chromium_src-a7a2b70880a149060184f7039fb0468d2dda7b4b.tar.bz2
Add message and image to NTP to promote extensions and bookmark sync.
BUG= 27393, 26744 TEST= promotional messages should show up on NTP. Review URL: http://codereview.chromium.org/394005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@32027 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/app/resources/locale_settings.grd5
-rw-r--r--chrome/app/theme/theme_resources.grd1
-rw-r--r--chrome/browser/browser.cc2
-rw-r--r--chrome/browser/dom_ui/dom_ui_theme_source.cc7
-rw-r--r--chrome/browser/dom_ui/new_tab_ui.cc44
-rw-r--r--chrome/browser/resources/new_new_tab.css62
-rw-r--r--chrome/browser/resources/new_new_tab.html20
-rw-r--r--chrome/browser/resources/new_new_tab.js8
-rw-r--r--chrome/browser/resources/new_tab_theme.css8
-rw-r--r--chrome/common/pref_names.cc4
-rw-r--r--chrome/common/pref_names.h2
11 files changed, 141 insertions, 22 deletions
diff --git a/chrome/app/resources/locale_settings.grd b/chrome/app/resources/locale_settings.grd
index 09505266..7056f22 100644
--- a/chrome/app/resources/locale_settings.grd
+++ b/chrome/app/resources/locale_settings.grd
@@ -656,6 +656,11 @@
http://www.google.com/chrome/intl/[GRITLANGCODE]/welcome.html
</message>
+ <!-- Help for the bookmark sync service. -->
+ <message name="IDS_SYNC_SERVICE_HELP_URL" translateable="false">
+ http://www.google.com/support/chrome/bin/answer.py?hl=[GRITLANGCODE]&amp;answer=165139
+ </message>
+
<!-- The width of the sync setup wizard / login dialog in characters. -->
<message name="IDS_SYNC_SETUP_WIZARD_WIDTH_CHARS" use_name_for_id="true">
46
diff --git a/chrome/app/theme/theme_resources.grd b/chrome/app/theme/theme_resources.grd
index ec78c5a..77781ce 100644
--- a/chrome/app/theme/theme_resources.grd
+++ b/chrome/app/theme/theme_resources.grd
@@ -175,6 +175,7 @@
<include name="IDR_NEWTAB_THEMES_GALLERY_FAVICON" file="ntp_themes_gallery_favicon.png" type="BINDATA" />
<include name="IDR_NEWTAB_CHECKBOX_BLACK" file="checkbox_black.png" type="BINDATA" />
<include name="IDR_NEWTAB_CHECKBOX_WHITE" file="checkbox_white.png" type="BINDATA" />
+ <include name="IDR_NEWTAB_EXTENSIONS_PROMO" file="ntp_extensions_promo.png" type="BINDATA" />
<include name="IDR_ARROW_RIGHT" file="arrow_right.png" type="BINDATA" />
<include name="IDR_SAD_TAB" file="sadtab.png" type="BINDATA" />
<include name="IDR_OTR_ICON" file="otr_icon.png" type="BINDATA" />
diff --git a/chrome/browser/browser.cc b/chrome/browser/browser.cc
index ebca665..64966cd 100644
--- a/chrome/browser/browser.cc
+++ b/chrome/browser/browser.cc
@@ -1344,7 +1344,7 @@ void Browser::RegisterUserPrefs(PrefService* prefs) {
prefs->RegisterIntegerPref(prefs::kDeleteTimePeriod, 0);
prefs->RegisterBooleanPref(prefs::kCheckDefaultBrowser, true);
prefs->RegisterBooleanPref(prefs::kShowOmniboxSearchHint, true);
- prefs->RegisterIntegerPref(prefs::kNTPThemePromoRemaining, 5);
+ prefs->RegisterIntegerPref(prefs::kNTPPromoRemaining, 5);
prefs->RegisterBooleanPref(prefs::kShowExtensionShelf, true);
}
diff --git a/chrome/browser/dom_ui/dom_ui_theme_source.cc b/chrome/browser/dom_ui/dom_ui_theme_source.cc
index e447c3e..768c589 100644
--- a/chrome/browser/dom_ui/dom_ui_theme_source.cc
+++ b/chrome/browser/dom_ui/dom_ui_theme_source.cc
@@ -184,10 +184,13 @@ 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::kNTPThemePromoRemaining) > 0)
+ if (profile->GetPrefs()->GetInteger(prefs::kNTPPromoRemaining) > 0) {
subst2.push_back("block"); // $$8
- else
+ subst2.push_back("inline-block"); // $$9
+ } else {
subst2.push_back("none"); // $$8
+ subst2.push_back("none"); // $$9
+ }
// 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 8956c47..b319fb5 100644
--- a/chrome/browser/dom_ui/new_tab_ui.cc
+++ b/chrome/browser/dom_ui/new_tab_ui.cc
@@ -199,6 +199,36 @@ void IncognitoTabHTMLSource::InitFullHTML() {
}
///////////////////////////////////////////////////////////////////////////////
+// PromotionalMessageHandler
+
+class PromotionalMessageHandler : public DOMMessageHandler {
+ public:
+ PromotionalMessageHandler() {}
+ virtual ~PromotionalMessageHandler() {}
+
+ // DOMMessageHandler implementation.
+ virtual void RegisterMessages();
+
+ // Zero promotional message counter.
+ void HandleClosePromotionalMessage(const Value* content);
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(PromotionalMessageHandler);
+};
+
+void PromotionalMessageHandler::RegisterMessages() {
+ dom_ui_->RegisterMessageCallback("stopPromoMessages",
+ NewCallback(this,
+ &PromotionalMessageHandler::HandleClosePromotionalMessage));
+}
+
+void PromotionalMessageHandler::HandleClosePromotionalMessage(
+ const Value* content) {
+ dom_ui_->GetProfile()->GetPrefs()->SetInteger(prefs::kNTPPromoRemaining, 0);
+}
+
+
+///////////////////////////////////////////////////////////////////////////////
// RecentlyClosedTabsHandler
class RecentlyClosedTabsHandler : public DOMMessageHandler,
@@ -569,6 +599,7 @@ NewTabUI::NewTabUI(TabContents* contents)
}
AddMessageHandler((new NewTabPageSetHomePageHandler())->Attach(this));
+ AddMessageHandler((new PromotionalMessageHandler())->Attach(this));
NewTabHTMLSource* html_source = new NewTabHTMLSource(GetProfile());
bool posted = ChromeThread::PostTask(
@@ -883,6 +914,15 @@ void NewTabUI::NewTabHTMLSource::InitFullHTML(Profile* profile) {
l10n_util::GetString(IDS_NEW_TAB_TIPS));
localized_strings.SetString(L"sync",
l10n_util::GetString(IDS_NEW_TAB_SHOW_HIDE_BOOKMARK_SYNC));
+ localized_strings.SetString(L"promonew",
+ l10n_util::GetString(IDS_NTP_PROMOTION_NEW));
+ localized_strings.SetString(L"promomessage",
+ l10n_util::GetStringF(IDS_NTP_PROMOTION_MESSAGE,
+ l10n_util::GetString(IDS_PRODUCT_NAME),
+ ASCIIToWide(Extension::kGalleryBrowseUrl),
+ l10n_util::GetString(IDS_SYNC_SERVICE_HELP_URL)));
+ localized_strings.SetString(L"extensionslink",
+ ASCIIToWide(Extension::kGalleryBrowseUrl));
// Don't initiate the sync related message passing with the page if the sync
// code is not present.
@@ -902,8 +942,8 @@ void NewTabUI::NewTabHTMLSource::InitFullHTML(Profile* profile) {
// Decrement ntp promo counter; the default value is specified in
// Browser::RegisterUserPrefs.
- profile->GetPrefs()->SetInteger(prefs::kNTPThemePromoRemaining,
- profile->GetPrefs()->GetInteger(prefs::kNTPThemePromoRemaining) - 1);
+ profile->GetPrefs()->SetInteger(prefs::kNTPPromoRemaining,
+ profile->GetPrefs()->GetInteger(prefs::kNTPPromoRemaining) - 1);
first_view_ = false;
}
diff --git a/chrome/browser/resources/new_new_tab.css b/chrome/browser/resources/new_new_tab.css
index 5f14f90..79b135d 100644
--- a/chrome/browser/resources/new_new_tab.css
+++ b/chrome/browser/resources/new_new_tab.css
@@ -687,20 +687,70 @@ html[dir='rtl'] #option-menu > [command='hide']:before {
margin: 10px 0;
}
-#themes-promo {
+/* promotions line */
+#bottom-right-promo {
position: absolute;
+ display: block;
+ width: 180px;
+ height: 131px;
+ border: 0;
bottom: 0px;
right: 0px;
}
-#themes-promo * {
+#footer {
+ position: fixed;
+ bottom: 0px;
+ left: 0px;
+ text-align: center;
+ width: 100%;
display: block;
}
-#themes-promo img {
- width: 150px;
- height: 180px;
- border: 0;
+#promo-line {
+ background-color: hsl(52, 100%, 80%);
+ border: 1px solid rgb(211, 211, 211);
+ -webkit-border-radius: 6px;
+ padding: 7px 10px;
+ white-space: nowrap;
+ display: inline-block;
+ color: black;
+}
+
+#promo-line > * {
+ display: inline-block;
+ font-weight: bold;
+ text-overflow: ellipsis;
+}
+
+#promo-line a {
+ color: rgb(6, 45, 117);
+ text-decoration: underline;
+}
+
+#promo-new {
+ color: red;
+}
+
+#promo-close {
+ display: inline-block;
+ border: 0px;
+ margin-left: 10px;
+ margin-right: auto;
+ vertical-align: middle;
+ width: 16px;
+ height: 16px;
+ background: no-repeat;
+ background-image: url(chrome://theme/close_bar);
+}
+
+#promo-close:hover,
+#promo-close:focus {
+ background-image: url(chrome://theme/close_bar_h);
+}
+
+#promo-close:active {
+ background-image: url(chrome://theme/close_bar_p);
}
/* small */
diff --git a/chrome/browser/resources/new_new_tab.html b/chrome/browser/resources/new_new_tab.html
index 8767290..6b62355 100644
--- a/chrome/browser/resources/new_new_tab.html
+++ b/chrome/browser/resources/new_new_tab.html
@@ -172,6 +172,12 @@ function updateSimpleSection(id, section) {
<body class="loading"
i18n-values=".style.fontFamily:fontfamily;.style.fontSize:fontsize">
+<div id="bottom-right-promo">
+ <a i18n-values="href:extensionslink">
+ <img src="chrome://theme/newtab_extensions_promo">
+ </a>
+</div>
+
<div id="main">
<div id="view-toolbar"
@@ -269,13 +275,15 @@ function updateSimpleSection(id, section) {
<img id="attribution-img">
</div>
-</div> <!-- main -->
+ <div id="footer">
+ <div id="promo-line">
+ <span id="promo-new" i18n-content="promonew"></span>
+ <span i18n-values=".innerHTML:promomessage"></span>
+ <button id="promo-close">
+ </div>
+ </div>
-<div id="themes-promo">
- <a i18n-values="href:themelink">
- <img src="ntp_themes_promo.png">
- </a>
-</div>
+</div> <!-- main -->
<div class="window-menu" id="window-tooltip"></div>
diff --git a/chrome/browser/resources/new_new_tab.js b/chrome/browser/resources/new_new_tab.js
index 1602cdf..fd9ba96 100644
--- a/chrome/browser/resources/new_new_tab.js
+++ b/chrome/browser/resources/new_new_tab.js
@@ -1587,3 +1587,11 @@ function fixLinkUnderline(el) {
}
updateAttribution();
+
+/* Close the promo notices when close button on the promo-line is clicked. */
+$('promo-close').onclick = function (e) {
+ $('promo-line').style.display = 'none';
+ $('bottom-right-promo').style.display = 'none';
+ chrome.send('stopPromoMessages');
+ e.preventDefault();
+};
diff --git a/chrome/browser/resources/new_tab_theme.css b/chrome/browser/resources/new_tab_theme.css
index 94f5526..7272460 100644
--- a/chrome/browser/resources/new_tab_theme.css
+++ b/chrome/browser/resources/new_tab_theme.css
@@ -101,6 +101,10 @@ body {
color: $$6; /* COLOR_NTP_LINK_UNDERLINE */
}
-#themes-promo {
- display: $$8;
+#promo-line {
+ display: $$9;
}
+
+#bottom-right-promo {
+ display: $$8;
+} \ No newline at end of file
diff --git a/chrome/common/pref_names.cc b/chrome/common/pref_names.cc
index f417d63..db3ec5c 100644
--- a/chrome/common/pref_names.cc
+++ b/chrome/common/pref_names.cc
@@ -283,10 +283,10 @@ const wchar_t kUseCustomChromeFrame[] = L"browser.custom_chrome_frame";
// directly from the omnibox should be shown.
const wchar_t kShowOmniboxSearchHint[] = L"browser.show_omnibox_search_hint";
-// Integer that counts the number of times the theme promo has left to be
+// 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 kNTPThemePromoRemaining[] = L"browser.ntp.theme_promo_remaining";
+const wchar_t kNTPPromoRemaining[] = L"browser.ntp.promo_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 6ea8293..d809e5e 100644
--- a/chrome/common/pref_names.h
+++ b/chrome/common/pref_names.h
@@ -113,7 +113,7 @@ extern const wchar_t kExtensionsUIDeveloperMode[];
extern const wchar_t kCheckDefaultBrowser[];
extern const wchar_t kUseCustomChromeFrame[];
extern const wchar_t kShowOmniboxSearchHint[];
-extern const wchar_t kNTPThemePromoRemaining[];
+extern const wchar_t kNTPPromoRemaining[];
extern const wchar_t kDesktopNotificationAllowedOrigins[];
extern const wchar_t kDesktopNotificationDeniedOrigins[];