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 02:21:36 +0000
committermirandac@chromium.org <mirandac@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-12-02 02:21:36 +0000
commitc4712105103f7132e4e97eaf9377c728565dc345 (patch)
tree64f83446693eae1118367981cfa97592ad8eee42 /chrome/browser/resources
parent62f1c6e07577f962fbeaf38e54535d3e5904308b (diff)
downloadchromium_src-c4712105103f7132e4e97eaf9377c728565dc345.zip
chromium_src-c4712105103f7132e4e97eaf9377c728565dc345.tar.gz
chromium_src-c4712105103f7132e4e97eaf9377c728565dc345.tar.bz2
Revert 33527 - 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 TBR=mirandac@chromium.org Review URL: http://codereview.chromium.org/460007 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@33538 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, 31 insertions, 22 deletions
diff --git a/chrome/browser/resources/new_new_tab.html b/chrome/browser/resources/new_new_tab.html
index 831d3b1..a3ff823 100644
--- a/chrome/browser/resources/new_new_tab.html
+++ b/chrome/browser/resources/new_new_tab.html
@@ -4,7 +4,8 @@
bookmarkbarattached:bookmarkbarattached;
hasattribution:hasattribution;
anim:anim;
- syncispresent:syncispresent">
+ syncispresent:syncispresent;
+ showsetashomepage:showsetashomepage">
<meta charset="utf-8">
<title i18n-content="title"></title>
@@ -254,6 +255,12 @@ 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 7b60721..aecc89a 100644
--- a/chrome/browser/resources/new_new_tab.js
+++ b/chrome/browser/resources/new_new_tab.js
@@ -102,34 +102,20 @@ function tips(data) {
function createTip(data) {
if (data.length) {
- 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);
- }
+ 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 clearTipLine() {
+function renderTip() {
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);
}
@@ -1271,6 +1257,10 @@ 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);
@@ -1290,10 +1280,22 @@ 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() {