summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
Diffstat (limited to 'chrome')
-rw-r--r--chrome/app/theme/ntp_themes_promo.pngbin0 -> 9355 bytes
-rw-r--r--chrome/app/theme/theme_resources.grd1
-rw-r--r--chrome/browser/browser.cc1
-rw-r--r--chrome/browser/dom_ui/dom_ui_theme_source.cc5
-rw-r--r--chrome/browser/dom_ui/new_tab_ui.cc15
-rw-r--r--chrome/browser/resources/new_new_tab.css16
-rw-r--r--chrome/browser/resources/new_new_tab.html6
-rw-r--r--chrome/browser/resources/new_tab_theme.css4
-rw-r--r--chrome/common/pref_names.cc5
-rw-r--r--chrome/common/pref_names.h1
10 files changed, 50 insertions, 4 deletions
diff --git a/chrome/app/theme/ntp_themes_promo.png b/chrome/app/theme/ntp_themes_promo.png
new file mode 100644
index 0000000..8d03387
--- /dev/null
+++ b/chrome/app/theme/ntp_themes_promo.png
Binary files differ
diff --git a/chrome/app/theme/theme_resources.grd b/chrome/app/theme/theme_resources.grd
index a01865b..de12ce5 100644
--- a/chrome/app/theme/theme_resources.grd
+++ b/chrome/app/theme/theme_resources.grd
@@ -199,6 +199,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_THEMES_PROMO" file="ntp_themes_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 4c36ab2..960badf 100644
--- a/chrome/browser/browser.cc
+++ b/chrome/browser/browser.cc
@@ -1323,6 +1323,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->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 bcdc813..b956c3e 100644
--- a/chrome/browser/dom_ui/dom_ui_theme_source.cc
+++ b/chrome/browser/dom_ui/dom_ui_theme_source.cc
@@ -180,6 +180,11 @@ void DOMUIThemeSource::InitNewTabCSS() {
subst2.push_back(SkColorToRGBAString(color_link_underline)); // $$6
subst2.push_back(SkColorToRGBAString(color_section_link_underline)); // $$7
+ if (profile_->GetPrefs()->GetInteger(prefs::kNTPThemePromoRemaining) > 0)
+ subst2.push_back(UTF8ToUTF16("block")); // $$8
+ else
+ subst2.push_back(UTF8ToUTF16("none")); // $$8
+
// Get our template.
static const base::StringPiece new_tab_theme_css(
ResourceBundle::GetSharedInstance().GetRawDataResource(
diff --git a/chrome/browser/dom_ui/new_tab_ui.cc b/chrome/browser/dom_ui/new_tab_ui.cc
index 93fc8cb..f59259f 100644
--- a/chrome/browser/dom_ui/new_tab_ui.cc
+++ b/chrome/browser/dom_ui/new_tab_ui.cc
@@ -395,7 +395,8 @@ void NewTabHTMLSource::InitFullHTML() {
l10n_util::GetString(IDS_NEW_TAB_CLOSE_FIRST_RUN_NOTIFICATION));
localized_strings.SetString(L"makethishomepage",
l10n_util::GetString(IDS_NEW_TAB_MAKE_THIS_HOMEPAGE));
-
+ localized_strings.SetString(L"themelink",
+ l10n_util::GetString(IDS_THEMES_GALLERY_URL));
// Don't initiate the sync related message passing with the page if the sync
// code is not present.
if (profile_->GetProfileSyncService())
@@ -409,9 +410,15 @@ void NewTabHTMLSource::InitFullHTML() {
SetFontAndTextDirection(&localized_strings);
// Let the tab know whether it's the first tab being viewed.
- localized_strings.SetString(L"firstview",
- first_view_ ? L"true" : std::wstring());
- first_view_ = false;
+ if (first_view_) {
+ localized_strings.SetString(L"firstview", L"true");
+
+ // Decrement ntp promo counter; the default value is specified in
+ // Browser::RegisterUserPrefs.
+ profile_->GetPrefs()->SetInteger(prefs::kNTPThemePromoRemaining,
+ profile_->GetPrefs()->GetInteger(prefs::kNTPThemePromoRemaining) - 1);
+ first_view_ = false;
+ }
// Control fade and resize animations.
std::wstring anim =
diff --git a/chrome/browser/resources/new_new_tab.css b/chrome/browser/resources/new_new_tab.css
index f1d71c2..1ad7d3b 100644
--- a/chrome/browser/resources/new_new_tab.css
+++ b/chrome/browser/resources/new_new_tab.css
@@ -701,6 +701,22 @@ html[dir='rtl'] #t4 {
text-align: center;
}
+#themes-promo {
+ position: absolute;
+ bottom: 0px;
+ right: 0px;
+}
+
+#themes-promo * {
+ display: block;
+}
+
+#themes-promo img {
+ width: 150px;
+ height: 180px;
+ border: 0;
+}
+
/* small */
@media (max-width: 920px) {
diff --git a/chrome/browser/resources/new_new_tab.html b/chrome/browser/resources/new_new_tab.html
index 24bfed0..f16df88 100644
--- a/chrome/browser/resources/new_new_tab.html
+++ b/chrome/browser/resources/new_new_tab.html
@@ -246,6 +246,12 @@ document.write('<link id="themecss" rel="stylesheet" ' +
</div> <!-- main -->
+<div id="themes-promo">
+ <a i18n-values="href:themelink">
+ <img src="chrome://theme/newtab_themes_promo">
+ </a>
+</div>
+
<div class="window-menu" id="window-tooltip"></div>
</body>
diff --git a/chrome/browser/resources/new_tab_theme.css b/chrome/browser/resources/new_tab_theme.css
index e5ba17d1..94f5526 100644
--- a/chrome/browser/resources/new_tab_theme.css
+++ b/chrome/browser/resources/new_tab_theme.css
@@ -100,3 +100,7 @@ body {
.list > .thumbnail-container {
color: $$6; /* COLOR_NTP_LINK_UNDERLINE */
}
+
+#themes-promo {
+ display: $$8;
+}
diff --git a/chrome/common/pref_names.cc b/chrome/common/pref_names.cc
index d6d75e8..a5210e8 100644
--- a/chrome/common/pref_names.cc
+++ b/chrome/common/pref_names.cc
@@ -273,6 +273,11 @@ 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
+// 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";
+
// *************** LOCAL STATE ***************
// These are attached to the machine/installation
diff --git a/chrome/common/pref_names.h b/chrome/common/pref_names.h
index 43b89e7..7ec556a 100644
--- a/chrome/common/pref_names.h
+++ b/chrome/common/pref_names.h
@@ -110,6 +110,7 @@ extern const wchar_t kCurrentThemeDisplayProperties[];
extern const wchar_t kCheckDefaultBrowser[];
extern const wchar_t kUseCustomChromeFrame[];
extern const wchar_t kShowOmniboxSearchHint[];
+extern const wchar_t kNTPThemePromoRemaining[];
// Local state
extern const wchar_t kMetricsClientID[];