summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorglen@chromium.org <glen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-03-24 18:21:03 +0000
committerglen@chromium.org <glen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-03-24 18:21:03 +0000
commita8ad78109b8332225248a382ee750f94536daa6c (patch)
tree7358152a500f2e2d6268cbbfdc30cbe4b38ca2fe
parent96bac982eb0d93f254c9f14e918fd0ed8199cd0c (diff)
downloadchromium_src-a8ad78109b8332225248a382ee750f94536daa6c.zip
chromium_src-a8ad78109b8332225248a382ee750f94536daa6c.tar.gz
chromium_src-a8ad78109b8332225248a382ee750f94536daa6c.tar.bz2
New tab page was linking to the wrong URL for the history page. We don't need the message and can just put an actual URL in the page.
BUG=8961 Review URL: http://codereview.chromium.org/49014 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@12375 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/dom_ui/new_tab_ui.cc17
-rw-r--r--chrome/browser/resources/new_tab.html32
2 files changed, 18 insertions, 31 deletions
diff --git a/chrome/browser/dom_ui/new_tab_ui.cc b/chrome/browser/dom_ui/new_tab_ui.cc
index 3dd58fc..199e5db 100644
--- a/chrome/browser/dom_ui/new_tab_ui.cc
+++ b/chrome/browser/dom_ui/new_tab_ui.cc
@@ -243,6 +243,8 @@ void NewTabHTMLSource::StartDataRequest(const std::string& path,
l10n_util::GetString(IDS_NEW_TAB_BOOKMARKS));
localized_strings.SetString(L"showhistory",
l10n_util::GetString(IDS_NEW_TAB_HISTORY_SHOW));
+ localized_strings.SetString(L"showhistoryurl",
+ chrome::kChromeUIHistoryURL);
localized_strings.SetString(L"searchhistory",
l10n_util::GetString(IDS_NEW_TAB_HISTORY_SEARCH));
localized_strings.SetString(L"recentlyclosed",
@@ -907,9 +909,6 @@ class HistoryHandler : public DOMMessageHandler {
public:
explicit HistoryHandler(DOMUI* dom_ui);
- // Callback which navigates to the history page.
- void HandleShowHistoryPage(const Value*);
-
// Callback which navigates to the history page and performs a search.
void HandleSearchHistoryPage(const Value* content);
@@ -922,22 +921,10 @@ class HistoryHandler : public DOMMessageHandler {
HistoryHandler::HistoryHandler(DOMUI* dom_ui)
: DOMMessageHandler(dom_ui),
dom_ui_(dom_ui) {
- dom_ui->RegisterMessageCallback("showHistoryPage",
- NewCallback(this, &HistoryHandler::HandleShowHistoryPage));
dom_ui->RegisterMessageCallback("searchHistoryPage",
NewCallback(this, &HistoryHandler::HandleSearchHistoryPage));
}
-void HistoryHandler::HandleShowHistoryPage(const Value*) {
- NavigationController* controller = dom_ui_->web_contents()->controller();
- if (controller) {
- UserMetrics::RecordAction(L"NTP_ShowHistory", dom_ui_->GetProfile());
- controller->LoadURL(GURL(chrome::kChromeUINewTabURL), GURL(),
- PageTransition::LINK);
- // We are deleted by LoadURL, so do not call anything else.
- }
-}
-
void HistoryHandler::HandleSearchHistoryPage(const Value* content) {
if (content && content->GetType() == Value::TYPE_LIST) {
const ListValue* list_value = static_cast<const ListValue*>(content);
diff --git a/chrome/browser/resources/new_tab.html b/chrome/browser/resources/new_tab.html
index b76b43d..fab905a 100644
--- a/chrome/browser/resources/new_tab.html
+++ b/chrome/browser/resources/new_tab.html
@@ -46,7 +46,7 @@ var localStrings;
*/
function LocalStrings(node) {
this.strings_ = {};
-
+
var children = node.childNodes;
for (var i = 0, child; child = children[i]; i++) {
var id = child.id;
@@ -66,7 +66,7 @@ LocalStrings.prototype.getString = function(s) {
}
/**
- * Returns a formatted localized string (where all %s contents are replaced
+ * Returns a formatted localized string (where all %s contents are replaced
* by the second argument).
* @param {string} s The id of the string we want
* @param {string} d The string to include in the formatted string
@@ -133,7 +133,7 @@ function resizeP13N(new_height) {
childf.style.display = "none";
return;
}
- childf.height = new_height;
+ childf.height = new_height;
childf.style.display = "block";
}
@@ -446,8 +446,8 @@ document.addEventListener('DOMContentLoaded', handleDOMContentLoaded);
</table>
</div>
<a href="#"
- class="manage"
- onclick="chrome.send('showHistoryPage'); return false">
+ jsvalues="href:showhistoryurl"
+ class="manage">
<span jscontent="showhistory"></span> &raquo;</a>
</div>
</td>
@@ -512,7 +512,7 @@ function DOM(elem, attrs) {
* applied to the function.
*
* @return {!Function} A partially-applied form of the function bind() was
- * invoked as a method of.
+ * invoked as a method of.
*/
function bind(fn, selfObj, var_args) {
var boundArgs = Array.prototype.slice.call(arguments, 2);
@@ -528,14 +528,14 @@ function bind(fn, selfObj, var_args) {
function makeMostVisitedDOM(page, number) {
/* The HTML we want looks like this:
<a class="most-visited-item" href="URL" title="gmail.com">
- <div class="thumbnail-title"
+ <div class="thumbnail-title"
style="background-image:url(faviconurl);direction:ltr">gmail.com</div>
<img class="thumbnail" style="background-image:url(thumbnailurl);" />
</a>
*/
var root;
if (page.url) {
- root = DOM('a', {href:page.url,
+ root = DOM('a', {href:page.url,
title:page.title});
root.addEventListener("mousedown", function(event) {
chrome.send("metrics", ["NTP_MostVisited" + number])
@@ -688,8 +688,8 @@ function renderRecentlyBookmarked(entries) {
if (entries.length > 0) {
section.style.display = 'block';
for (var i = 0, entry = entries[0]; entry = entries[i]; ++i) {
- var link = DOM('a', {href: entry.url,
- className:'recent-bookmark',
+ var link = DOM('a', {href: entry.url,
+ className:'recent-bookmark',
title:entry.title});
link.addEventListener("mousedown", function(event) {
chrome.send("metrics", ["NTP_Bookmark" + i])
@@ -726,7 +726,7 @@ function renderRecentlyClosedTabs(entries) {
for (var i = 0; entry = entries[i]; ++i) {
var link;
-
+
if (entry.type == "tab") {
// Closed tab.
link = createRecentBookmark('a', entry);
@@ -740,8 +740,8 @@ function renderRecentlyClosedTabs(entries) {
for (var windowIndex = 0; windowIndex < entry.tabs.length; windowIndex++) {
var tab = entry.tabs[windowIndex];
var tabImg = DOM('img', {
- src:'url("chrome-ui://favicon/' + tab.url + '")',
- width:16,
+ src:'url("chrome-ui://favicon/' + tab.url + '")',
+ width:16,
height:16});
tabImg.onmousedown = function() { return false; }
linkSpan.appendChild(tabImg);
@@ -756,7 +756,7 @@ function renderRecentlyClosedTabs(entries) {
link.appendChild(linkSpan);
linkSpanContainer.appendChild(link);
container.appendChild(linkSpanContainer);
-
+
// The card takes care of appending itself to the DOM, so no need to
// keep a reference to it.
new RecentlyClosedHoverCard(linkSpanContainer, entry);
@@ -871,7 +871,7 @@ RecentlyClosedHoverCard.prototype.setShowTimeout_ = function() {
}
RecentlyClosedHoverCard.clearOpenTimeout_();
- RecentlyClosedHoverCard.openTimeout_ =
+ RecentlyClosedHoverCard.openTimeout_ =
setTimeout(bind(this.show_, this), 200);
};
@@ -880,7 +880,7 @@ RecentlyClosedHoverCard.prototype.setShowTimeout_ = function() {
*/
RecentlyClosedHoverCard.prototype.setHideTimeout_ = function() {
RecentlyClosedHoverCard.clearOpenTimeout_();
- RecentlyClosedHoverCard.closeTimeout_ =
+ RecentlyClosedHoverCard.closeTimeout_ =
setTimeout(bind(this.hide_, this), 200);
};