Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(368)

Side by Side Diff: chrome/browser/dom_ui/history_ui.cc

Issue 6064003: Update the time formatting APIs to use string16.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/dom_ui/history_ui.h" 5 #include "chrome/browser/dom_ui/history_ui.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <set> 8 #include <set>
9 9
10 #include "app/l10n_util.h" 10 #include "app/l10n_util.h"
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after
269 // pass the dates in as strings. This could use some 269 // pass the dates in as strings. This could use some
270 // optimization. 270 // optimization.
271 271
272 // Only pass in the strings we need (search results need a shortdate 272 // Only pass in the strings we need (search results need a shortdate
273 // and snippet, browse results need day and time information). 273 // and snippet, browse results need day and time information).
274 if (search_text_.empty()) { 274 if (search_text_.empty()) {
275 // Figure out the relative date string. 275 // Figure out the relative date string.
276 string16 date_str = TimeFormat::RelativeDate(page.visit_time(), 276 string16 date_str = TimeFormat::RelativeDate(page.visit_time(),
277 &midnight_today); 277 &midnight_today);
278 if (date_str.empty()) { 278 if (date_str.empty()) {
279 date_str = 279 date_str = base::TimeFormatFriendlyDate(page.visit_time());
280 WideToUTF16Hack(base::TimeFormatFriendlyDate(page.visit_time()));
281 } else { 280 } else {
282 date_str = l10n_util::GetStringFUTF16( 281 date_str = l10n_util::GetStringFUTF16(
283 IDS_HISTORY_DATE_WITH_RELATIVE_TIME, 282 IDS_HISTORY_DATE_WITH_RELATIVE_TIME,
284 date_str, 283 date_str,
285 WideToUTF16Hack(base::TimeFormatFriendlyDate(page.visit_time()))); 284 base::TimeFormatFriendlyDate(page.visit_time()));
286 } 285 }
287 page_value->SetString("dateRelativeDay", date_str); 286 page_value->SetString("dateRelativeDay", date_str);
288 page_value->SetString("dateTimeOfDay", 287 page_value->SetString("dateTimeOfDay",
289 WideToUTF16Hack(base::TimeFormatTimeOfDay(page.visit_time()))); 288 base::TimeFormatTimeOfDay(page.visit_time()));
290 } else { 289 } else {
291 page_value->SetString("dateShort", 290 page_value->SetString("dateShort",
292 WideToUTF16Hack(base::TimeFormatShortDate(page.visit_time()))); 291 base::TimeFormatShortDate(page.visit_time()));
293 page_value->SetString("snippet", page.snippet().text()); 292 page_value->SetString("snippet", page.snippet().text());
294 } 293 }
295 page_value->SetBoolean("starred", 294 page_value->SetBoolean("starred",
296 dom_ui_->GetProfile()->GetBookmarkModel()->IsBookmarked(page.url())); 295 dom_ui_->GetProfile()->GetBookmarkModel()->IsBookmarked(page.url()));
297 results_value.Append(page_value); 296 results_value.Append(page_value);
298 } 297 }
299 298
300 DictionaryValue info_value; 299 DictionaryValue info_value;
301 info_value.SetString("term", search_text_); 300 info_value.SetString("term", search_text_);
302 info_value.SetBoolean("finished", results->reached_beginning()); 301 info_value.SetBoolean("finished", results->reached_beginning());
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
402 const GURL HistoryUI::GetHistoryURLWithSearchText(const string16& text) { 401 const GURL HistoryUI::GetHistoryURLWithSearchText(const string16& text) {
403 return GURL(std::string(chrome::kChromeUIHistoryURL) + "#q=" + 402 return GURL(std::string(chrome::kChromeUIHistoryURL) + "#q=" +
404 EscapeQueryParamValue(UTF16ToUTF8(text), true)); 403 EscapeQueryParamValue(UTF16ToUTF8(text), true));
405 } 404 }
406 405
407 // static 406 // static
408 RefCountedMemory* HistoryUI::GetFaviconResourceBytes() { 407 RefCountedMemory* HistoryUI::GetFaviconResourceBytes() {
409 return ResourceBundle::GetSharedInstance(). 408 return ResourceBundle::GetSharedInstance().
410 LoadDataResourceBytes(IDR_HISTORY_FAVICON); 409 LoadDataResourceBytes(IDR_HISTORY_FAVICON);
411 } 410 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698