summaryrefslogtreecommitdiffstats
path: root/chrome/browser/resources
diff options
context:
space:
mode:
authormirandac@chromium.org <mirandac@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-12-02 01:29:44 +0000
committermirandac@chromium.org <mirandac@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-12-02 01:29:44 +0000
commit44d5d23bd0cd3d7fa0a688c444e3115088f9d2c3 (patch)
treeb52c06d9dd1ae7d2cfdc92045be2d3c2b52bc842 /chrome/browser/resources
parenta513bce52e152a45fb78c671612c57c23a2efa28 (diff)
downloadchromium_src-44d5d23bd0cd3d7fa0a688c444e3115088f9d2c3.zip
chromium_src-44d5d23bd0cd3d7fa0a688c444e3115088f9d2c3.tar.gz
chromium_src-44d5d23bd0cd3d7fa0a688c444e3115088f9d2c3.tar.bz2
Put "make this my home page" link into the tip section.
BUG= 28196 TEST= "make this my home page" should show up as a tip. Review URL: http://codereview.chromium.org/449073 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@33527 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/resources')
-rw-r--r--chrome/browser/resources/new_new_tab.html9
-rw-r--r--chrome/browser/resources/new_new_tab.js44
2 files changed, 22 insertions, 31 deletions
diff --git a/chrome/browser/resources/new_new_tab.html b/chrome/browser/resources/new_new_tab.html
index a3ff823..831d3b1 100644
--- a/chrome/browser/resources/new_new_tab.html
+++ b/chrome/browser/resources/new_new_tab.html
@@ -4,8 +4,7 @@
bookmarkbarattached:bookmarkbarattached;
hasattribution:hasattribution;
anim:anim;
- syncispresent:syncispresent;
- showsetashomepage:showsetashomepage">
+ syncispresent:syncispresent">
<meta charset="utf-8">
<title i18n-content="title"></title>
@@ -255,12 +254,6 @@ function updateSimpleSection(id, section) {
</div>
<script>updateSimpleSection('sync-status', Section.SYNC);</script>
- <div id="set-as-home-page">
- <button class="link">
- <span class="link-color" i18n-content="makethishomepage"></span>
- </button>
- </div>
-
<div id="tip-line"></div>
<script>updateSimpleSection('tip-line', Section.TIPS);</script>
diff --git a/chrome/browser/resources/new_new_tab.js b/chrome/browser/resources/new_new_tab.js
index aecc89a..7b60721 100644
--- a/chrome/browser/resources/new_new_tab.js
+++ b/chrome/browser/resources/new_new_tab.js
@@ -102,20 +102,34 @@ function tips(data) {
function createTip(data) {
if (data.length) {
- try {
- return parseHtmlSubset(data[0].tip_html_text);
- } catch (parseErr) {
- console.error('Error parsing tips: ' + parseErr.message);
+ if (data[0].set_homepage_tip) {
+ var homepageButton = document.createElement('button');
+ homepageButton.className = 'link';
+ homepageButton.textContent = data[0].set_homepage_tip;
+ homepageButton.addEventListener('click', setAsHomePageLinkClicked);
+ return homepageButton;
+ } else {
+ try {
+ return parseHtmlSubset(data[0].tip_html_text);
+ } catch (parseErr) {
+ console.error('Error parsing tips: ' + parseErr.message);
+ }
}
}
// Return an empty DF in case of failure.
return document.createDocumentFragment();
}
-function renderTip() {
+function clearTipLine() {
var tipElement = $('tip-line');
// There should always be only one tip.
tipElement.textContent = '';
+ tipElement.removeEventListener('click', setAsHomePageLinkClicked);
+}
+
+function renderTip() {
+ clearTipLine();
+ var tipElement = $('tip-line');
tipElement.appendChild(createTip(tipCache));
fixLinkUnderlines(tipElement);
}
@@ -1257,10 +1271,6 @@ document.addEventListener('DOMContentLoaded',
document.addEventListener('DOMContentLoaded',
callGetSyncMessageIfSyncIsPresent);
-// This link allows user to make new tab page as homepage from the new tab
-// page itself (without going to Options dialog box).
-document.addEventListener('DOMContentLoaded', showSetAsHomePageLink);
-
// Set up links and text-decoration for promotional message.
document.addEventListener('DOMContentLoaded', setUpPromoMessage);
@@ -1280,22 +1290,10 @@ function setAsHomePageLinkClicked(e) {
e.preventDefault();
}
-function showSetAsHomePageLink() {
- var setAsHomePageElement = $('set-as-home-page');
- var style = setAsHomePageElement.style;
- if (document.documentElement.getAttribute('showsetashomepage') != 'true') {
- // Hide the section (if new tab page is already homepage).
- return;
- }
-
- style.display = 'block';
- var buttonElement = setAsHomePageElement.firstElementChild;
- buttonElement.addEventListener('click', setAsHomePageLinkClicked);
-}
-
function onHomePageSet(data) {
- $('set-as-home-page').style.display = 'none';
showNotification(data[0], data[1]);
+ // Removes the "make this my home page" tip.
+ clearTipLine();
}
function hideAllMenus() {