| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "ios/chrome/browser/ui/webui/history/browsing_history_handler.h" | 5 #include "ios/chrome/browser/ui/webui/history/browsing_history_handler.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <set> | 9 #include <set> |
| 10 | 10 |
| 11 #include "base/bind.h" | 11 #include "base/bind.h" |
| 12 #include "base/bind_helpers.h" | 12 #include "base/bind_helpers.h" |
| 13 #include "base/i18n/rtl.h" | 13 #include "base/i18n/rtl.h" |
| 14 #include "base/i18n/time_formatting.h" | 14 #include "base/i18n/time_formatting.h" |
| 15 #include "base/metrics/histogram.h" | 15 #include "base/metrics/histogram.h" |
| 16 #include "base/strings/string16.h" | 16 #include "base/strings/string16.h" |
| 17 #include "base/strings/string_number_conversions.h" | 17 #include "base/strings/string_number_conversions.h" |
| 18 #include "base/strings/utf_string_conversions.h" | 18 #include "base/strings/utf_string_conversions.h" |
| 19 #include "base/time/time.h" | 19 #include "base/time/time.h" |
| 20 #include "base/values.h" | 20 #include "base/values.h" |
| 21 #include "components/bookmarks/browser/bookmark_model.h" | 21 #include "components/bookmarks/browser/bookmark_model.h" |
| 22 #include "components/bookmarks/browser/bookmark_utils.h" | 22 #include "components/bookmarks/browser/bookmark_utils.h" |
| 23 #include "components/browser_sync/profile_sync_service.h" | 23 #include "components/browser_sync/profile_sync_service.h" |
| 24 #include "components/browsing_data_ui/history_notice_utils.h" | 24 #include "components/browsing_data/core/history_notice_utils.h" |
| 25 #include "components/history/core/browser/history_service.h" | 25 #include "components/history/core/browser/history_service.h" |
| 26 #include "components/history/core/browser/history_types.h" | 26 #include "components/history/core/browser/history_types.h" |
| 27 #include "components/history/core/browser/top_sites.h" | 27 #include "components/history/core/browser/top_sites.h" |
| 28 #include "components/history/core/browser/web_history_service.h" | 28 #include "components/history/core/browser/web_history_service.h" |
| 29 #include "components/keyed_service/core/service_access_type.h" | 29 #include "components/keyed_service/core/service_access_type.h" |
| 30 #include "components/strings/grit/components_strings.h" | 30 #include "components/strings/grit/components_strings.h" |
| 31 #include "components/sync/device_info/device_info.h" | 31 #include "components/sync/device_info/device_info.h" |
| 32 #include "components/sync/device_info/device_info_tracker.h" | 32 #include "components/sync/device_info/device_info_tracker.h" |
| 33 #include "components/sync/protocol/history_delete_directive_specifics.pb.h" | 33 #include "components/sync/protocol/history_delete_directive_specifics.pb.h" |
| 34 #include "components/sync/protocol/sync_enums.pb.h" | 34 #include "components/sync/protocol/sync_enums.pb.h" |
| (...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 367 base::TimeTicks::Now())); | 367 base::TimeTicks::Now())); |
| 368 // Start a timer so we know when to give up. | 368 // Start a timer so we know when to give up. |
| 369 web_history_timer_.Start( | 369 web_history_timer_.Start( |
| 370 FROM_HERE, base::TimeDelta::FromSeconds(kWebHistoryTimeoutSeconds), | 370 FROM_HERE, base::TimeDelta::FromSeconds(kWebHistoryTimeoutSeconds), |
| 371 this, &BrowsingHistoryHandler::WebHistoryTimeout); | 371 this, &BrowsingHistoryHandler::WebHistoryTimeout); |
| 372 | 372 |
| 373 ProfileSyncService* sync_service = | 373 ProfileSyncService* sync_service = |
| 374 IOSChromeProfileSyncServiceFactory::GetInstance()->GetForBrowserState( | 374 IOSChromeProfileSyncServiceFactory::GetInstance()->GetForBrowserState( |
| 375 browser_state); | 375 browser_state); |
| 376 // Test the existence of other forms of browsing history. | 376 // Test the existence of other forms of browsing history. |
| 377 browsing_data_ui::ShouldShowNoticeAboutOtherFormsOfBrowsingHistory( | 377 browsing_data::ShouldShowNoticeAboutOtherFormsOfBrowsingHistory( |
| 378 sync_service, web_history, | 378 sync_service, web_history, |
| 379 base::Bind( | 379 base::Bind( |
| 380 &BrowsingHistoryHandler::OtherFormsOfBrowsingHistoryQueryComplete, | 380 &BrowsingHistoryHandler::OtherFormsOfBrowsingHistoryQueryComplete, |
| 381 weak_factory_.GetWeakPtr())); | 381 weak_factory_.GetWeakPtr())); |
| 382 | 382 |
| 383 // Set this to false until the results actually arrive. | 383 // Set this to false until the results actually arrive. |
| 384 results_info_value_.SetBoolean("hasSyncedResults", false); | 384 results_info_value_.SetBoolean("hasSyncedResults", false); |
| 385 } else { | 385 } else { |
| 386 // The notice could not have been shown, because there is no web history. | 386 // The notice could not have been shown, because there is no web history. |
| 387 RecordMetricsForNoticeAboutOtherFormsOfBrowsingHistory(false); | 387 RecordMetricsForNoticeAboutOtherFormsOfBrowsingHistory(false); |
| (...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 851 | 851 |
| 852 void BrowsingHistoryHandler::OnURLsDeleted( | 852 void BrowsingHistoryHandler::OnURLsDeleted( |
| 853 history::HistoryService* history_service, | 853 history::HistoryService* history_service, |
| 854 bool all_history, | 854 bool all_history, |
| 855 bool expired, | 855 bool expired, |
| 856 const history::URLRows& deleted_rows, | 856 const history::URLRows& deleted_rows, |
| 857 const std::set<GURL>& favicon_urls) { | 857 const std::set<GURL>& favicon_urls) { |
| 858 if (all_history || DeletionsDiffer(deleted_rows, urls_to_be_deleted_)) | 858 if (all_history || DeletionsDiffer(deleted_rows, urls_to_be_deleted_)) |
| 859 web_ui()->CallJavascriptFunction("historyDeleted"); | 859 web_ui()->CallJavascriptFunction("historyDeleted"); |
| 860 } | 860 } |
| OLD | NEW |