summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authormirandac@chromium.org <mirandac@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-01 16:55:15 +0000
committermirandac@chromium.org <mirandac@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-01 16:55:15 +0000
commitcf4e8bf9d049611d5fdb349cb669042cc94af23c (patch)
tree7bf1df56015ff8948a78407bfa4d207afecc3ad4 /chrome
parent717b292296c56cd83a438d32ab24859b2d8999a5 (diff)
downloadchromium_src-cf4e8bf9d049611d5fdb349cb669042cc94af23c.zip
chromium_src-cf4e8bf9d049611d5fdb349cb669042cc94af23c.tar.gz
chromium_src-cf4e8bf9d049611d5fdb349cb669042cc94af23c.tar.bz2
Remove null link from "welcome to tips" default suggestion. Also make some hard-coded strings in new tab page into localizable .grd strings, and fix bug introduced in r19556.
BUG= http://crbug.com/15467 TEST= Run with new new tab page for the first time, with no tips stored in preferences. Note that welcome tip is not a link. Review URL: http://codereview.chromium.org/147247 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@19740 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/app/generated_resources.grd8
-rw-r--r--chrome/browser/dom_ui/new_tab_ui.cc5
-rw-r--r--chrome/browser/dom_ui/tips_handler.cc3
-rw-r--r--chrome/browser/dom_ui/tips_handler.h7
-rw-r--r--chrome/browser/resources/new_new_tab.css11
-rw-r--r--chrome/browser/resources/new_new_tab.html11
6 files changed, 39 insertions, 6 deletions
diff --git a/chrome/app/generated_resources.grd b/chrome/app/generated_resources.grd
index 04cd054..3e62a36 100644
--- a/chrome/app/generated_resources.grd
+++ b/chrome/app/generated_resources.grd
@@ -3440,6 +3440,14 @@ each locale. -->
desc="Heading text for the section containing recent activities. Recent activies includes closed windows and tabs as well as downloads.">
Recent activities
</message>
+ <message name="IDS_NEW_TAB_TIPS"
+ desc="Heading text for the section containing tips and suggestions.">
+ Tips and Suggestions
+ </message>
+ <message name="IDS_NEW_TAB_DEFAULT_TIPS_TITLE"
+ desc="Default content of tip box when no tips are available. This is a short advertisement and explanation for the tips and suggestions to come.">
+ Watch this space for tips and suggestions for better browsing!
+ </message>
<message name="IDS_NEW_TAB_DOWNLOADS"
desc="The header text of the recent downloads section.">
Downloads
diff --git a/chrome/browser/dom_ui/new_tab_ui.cc b/chrome/browser/dom_ui/new_tab_ui.cc
index 5c1f704..2f6d724 100644
--- a/chrome/browser/dom_ui/new_tab_ui.cc
+++ b/chrome/browser/dom_ui/new_tab_ui.cc
@@ -297,6 +297,10 @@ void NewTabHTMLSource::StartDataRequest(const std::string& path,
l10n_util::GetString(IDS_NEW_TAB_WEB_RESOURCE_CACHE));
localized_strings.SetString(L"recentactivities",
l10n_util::GetString(IDS_NEW_TAB_RECENT_ACTIVITIES));
+ localized_strings.SetString(L"tipsandsuggestions",
+ l10n_util::GetString(IDS_NEW_TAB_TIPS));
+ localized_strings.SetString(L"defaulttipstitle",
+ l10n_util::GetString(IDS_NEW_TAB_DEFAULT_TIPS_TITLE));
localized_strings.SetString(L"downloads",
l10n_util::GetString(IDS_NEW_TAB_DOWNLOADS));
localized_strings.SetString(L"viewfullhistory",
@@ -1490,6 +1494,7 @@ bool NewTabUI::UseOldNewTabPage() {
return command_line->HasSwitch(switches::kOldNewTabPage);
}
+// static
bool NewTabUI::EnableWebResources() {
const CommandLine* command_line = CommandLine::ForCurrentProcess();
return command_line->HasSwitch(switches::kWebResources);
diff --git a/chrome/browser/dom_ui/tips_handler.cc b/chrome/browser/dom_ui/tips_handler.cc
index f935abd..c495a0d 100644
--- a/chrome/browser/dom_ui/tips_handler.cc
+++ b/chrome/browser/dom_ui/tips_handler.cc
@@ -22,9 +22,10 @@ namespace {
}
DOMMessageHandler* TipsHandler::Attach(DOMUI* dom_ui) {
+ dom_ui_ = dom_ui;
tips_cache_ = dom_ui_->GetProfile()->GetPrefs()->
GetDictionary(prefs::kNTPTipsCache);
- return DOMMessageHandler::Attach(dom_ui);
+ return DOMMessageHandler::Attach(dom_ui);
}
void TipsHandler::RegisterMessages() {
diff --git a/chrome/browser/dom_ui/tips_handler.h b/chrome/browser/dom_ui/tips_handler.h
index b6d5ccc..e5afe38 100644
--- a/chrome/browser/dom_ui/tips_handler.h
+++ b/chrome/browser/dom_ui/tips_handler.h
@@ -31,8 +31,8 @@ class TipsHandler : public DOMMessageHandler {
TipsHandler() : tips_cache_(NULL) {}
virtual ~TipsHandler() {}
- // DOMMessageHandler implementation and overrides.
- virtual DOMMessageHandler* Attach(DOMUI* dom_ui);
+ // DOMMessageHandler implementation and overrides.
+ virtual DOMMessageHandler* Attach(DOMUI* dom_ui);
virtual void RegisterMessages();
// Callback which pulls tips data from the preferences.
@@ -45,6 +45,9 @@ class TipsHandler : public DOMMessageHandler {
// Make sure the string we are pushing to the NTP is a valid URL.
bool IsValidURL(const std::wstring& url_string);
+ // So we can push data out to the page that has called this handler.
+ DOMUI* dom_ui_;
+
// Filled with data from cache in preferences.
const DictionaryValue* tips_cache_;
diff --git a/chrome/browser/resources/new_new_tab.css b/chrome/browser/resources/new_new_tab.css
index 352417d..315f3e6 100644
--- a/chrome/browser/resources/new_new_tab.css
+++ b/chrome/browser/resources/new_new_tab.css
@@ -439,6 +439,17 @@ html[dir='rtl'] .item {
text-align: right;
}
+.tips-title {
+ color: black;
+ text-decoration: none;
+ padding-top: 6px;
+ white-space: normal;
+}
+
+.tips-container {
+ padding-top: 4px;
+}
+
.window {
position: relative;
overflow: visible; /* We use visible so that the menu can be a child and shown
diff --git a/chrome/browser/resources/new_new_tab.html b/chrome/browser/resources/new_new_tab.html
index d3a2d22..34404e2 100644
--- a/chrome/browser/resources/new_new_tab.html
+++ b/chrome/browser/resources/new_new_tab.html
@@ -164,10 +164,15 @@ logEvent('log start');
</div><div class="spacer">
</div><div id="tips" class="section">
- <h2>Tips and Suggestions</h2>
- <div class="item-container">
- <div id="tip-items" jsskip="!processing">
+ <h2 jscontent="tipsandsuggestions"></h2>
+ <div id="tip-items" jsskip="!processing">
+ <div class="tips-title item" jsselect="$this"
+ jsdisplay="!url"
+ jscontent="localStrings.getString('defaulttipstitle')">
+ </div>
+ <div class="tips-container item-container">
<a class="item" jsselect="$this"
+ jsdisplay="url.length"
jsvalues="href:url;title:title"
jscontent="title"></a>
</div>