| OLD | NEW |
| 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/history2_ui.h" | 5 #include "chrome/browser/dom_ui/history2_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 Loading... |
| 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 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 414 const GURL HistoryUI2::GetHistoryURLWithSearchText(const string16& text) { | 413 const GURL HistoryUI2::GetHistoryURLWithSearchText(const string16& text) { |
| 415 return GURL(std::string(chrome::kChromeUIHistory2URL) + "#q=" + | 414 return GURL(std::string(chrome::kChromeUIHistory2URL) + "#q=" + |
| 416 EscapeQueryParamValue(UTF16ToUTF8(text), true)); | 415 EscapeQueryParamValue(UTF16ToUTF8(text), true)); |
| 417 } | 416 } |
| 418 | 417 |
| 419 // static | 418 // static |
| 420 RefCountedMemory* HistoryUI2::GetFaviconResourceBytes() { | 419 RefCountedMemory* HistoryUI2::GetFaviconResourceBytes() { |
| 421 return ResourceBundle::GetSharedInstance(). | 420 return ResourceBundle::GetSharedInstance(). |
| 422 LoadDataResourceBytes(IDR_HISTORY_FAVICON); | 421 LoadDataResourceBytes(IDR_HISTORY_FAVICON); |
| 423 } | 422 } |
| OLD | NEW |