Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/ui/webui/browsing_history_handler.h" | 5 #include "chrome/browser/ui/webui/browsing_history_handler.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <set> | 9 #include <set> |
| 10 #include <utility> | 10 #include <utility> |
| 11 | 11 |
| 12 #include "base/bind.h" | 12 #include "base/bind.h" |
| 13 #include "base/bind_helpers.h" | 13 #include "base/bind_helpers.h" |
| 14 #include "base/i18n/rtl.h" | 14 #include "base/i18n/rtl.h" |
| 15 #include "base/i18n/time_formatting.h" | 15 #include "base/i18n/time_formatting.h" |
| 16 #include "base/logging.h" | 16 #include "base/logging.h" |
| 17 #include "base/memory/ptr_util.h" | |
| 18 #include "base/strings/string16.h" | 17 #include "base/strings/string16.h" |
| 19 #include "base/strings/string_number_conversions.h" | 18 #include "base/strings/string_number_conversions.h" |
| 20 #include "base/strings/utf_string_conversions.h" | 19 #include "base/strings/utf_string_conversions.h" |
| 21 #include "base/time/default_clock.h" | 20 #include "base/time/default_clock.h" |
| 22 #include "base/time/time.h" | 21 #include "base/time/time.h" |
| 23 #include "base/values.h" | 22 #include "base/values.h" |
| 24 #include "chrome/browser/bookmarks/bookmark_model_factory.h" | 23 #include "chrome/browser/bookmarks/bookmark_model_factory.h" |
| 25 #include "chrome/browser/favicon/fallback_icon_service_factory.h" | 24 #include "chrome/browser/favicon/fallback_icon_service_factory.h" |
| 26 #include "chrome/browser/favicon/large_icon_service_factory.h" | 25 #include "chrome/browser/favicon/large_icon_service_factory.h" |
| 27 #include "chrome/browser/profiles/profile.h" | 26 #include "chrome/browser/profiles/profile.h" |
| (...skipping 490 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 518 | 517 |
| 519 // Add the specific dates that were searched to display them. | 518 // Add the specific dates that were searched to display them. |
| 520 // TODO(sergiu): Put today if the start is in the future. | 519 // TODO(sergiu): Put today if the start is in the future. |
| 521 results_info.SetString( | 520 results_info.SetString( |
| 522 "queryStartTime", | 521 "queryStartTime", |
| 523 GetRelativeDateLocalized(clock_.get(), query_results_info->start_time)); | 522 GetRelativeDateLocalized(clock_.get(), query_results_info->start_time)); |
| 524 results_info.SetString( | 523 results_info.SetString( |
| 525 "queryEndTime", | 524 "queryEndTime", |
| 526 GetRelativeDateLocalized(clock_.get(), query_results_info->end_time)); | 525 GetRelativeDateLocalized(clock_.get(), query_results_info->end_time)); |
| 527 | 526 |
| 527 results_info.SetString( | |
| 528 "queryStartMonth", | |
| 529 TimeFormatMonthAndYear(query_results_info->start_time)); | |
| 530 results_info.SetString( | |
| 531 "queryInterval", DateIntervalFormat(query_results_info->start_time, | |
| 532 query_results_info->end_time, | |
| 533 base::DATE_FORMAT_MONTH_WEEKDAY_DAY)); | |
|
jungshik at Google
2017/01/10 01:12:29
Don't you 'base::' for DateIntervalFormat... and T
calamity
2017/01/16 02:49:25
Huh. surprisingly this worked without it. Probably
| |
| 534 | |
| 528 web_ui()->CallJavascriptFunctionUnsafe("historyResult", results_info, | 535 web_ui()->CallJavascriptFunctionUnsafe("historyResult", results_info, |
| 529 results_value); | 536 results_value); |
| 530 } | 537 } |
| 531 | 538 |
| 532 void BrowsingHistoryHandler::OnRemoveVisitsComplete() { | 539 void BrowsingHistoryHandler::OnRemoveVisitsComplete() { |
| 533 web_ui()->CallJavascriptFunctionUnsafe("deleteComplete"); | 540 web_ui()->CallJavascriptFunctionUnsafe("deleteComplete"); |
| 534 } | 541 } |
| 535 | 542 |
| 536 void BrowsingHistoryHandler::OnRemoveVisitsFailed() { | 543 void BrowsingHistoryHandler::OnRemoveVisitsFailed() { |
| 537 web_ui()->CallJavascriptFunctionUnsafe("deleteFailed"); | 544 web_ui()->CallJavascriptFunctionUnsafe("deleteFailed"); |
| 538 } | 545 } |
| 539 | 546 |
| 540 void BrowsingHistoryHandler::HistoryDeleted() { | 547 void BrowsingHistoryHandler::HistoryDeleted() { |
| 541 web_ui()->CallJavascriptFunctionUnsafe("historyDeleted"); | 548 web_ui()->CallJavascriptFunctionUnsafe("historyDeleted"); |
| 542 } | 549 } |
| 543 | 550 |
| 544 void BrowsingHistoryHandler::HasOtherFormsOfBrowsingHistory( | 551 void BrowsingHistoryHandler::HasOtherFormsOfBrowsingHistory( |
| 545 bool has_other_forms, | 552 bool has_other_forms, |
| 546 bool has_synced_results) { | 553 bool has_synced_results) { |
| 547 web_ui()->CallJavascriptFunctionUnsafe( | 554 web_ui()->CallJavascriptFunctionUnsafe( |
| 548 "showNotification", base::FundamentalValue(has_synced_results), | 555 "showNotification", base::FundamentalValue(has_synced_results), |
| 549 base::FundamentalValue(has_other_forms)); | 556 base::FundamentalValue(has_other_forms)); |
| 550 } | 557 } |
| OLD | NEW |