| 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/strings/string16.h" | 17 #include "base/strings/string16.h" |
| 18 #include "base/strings/string_number_conversions.h" | 18 #include "base/strings/string_number_conversions.h" |
| 19 #include "base/strings/utf_string_conversions.h" | 19 #include "base/strings/utf_string_conversions.h" |
| 20 #include "base/time/default_clock.h" | 20 #include "base/time/default_clock.h" |
| 21 #include "base/time/time.h" | 21 #include "base/time/time.h" |
| 22 #include "base/values.h" | 22 #include "base/values.h" |
| 23 #include "chrome/browser/bookmarks/bookmark_model_factory.h" | 23 #include "chrome/browser/bookmarks/bookmark_model_factory.h" |
| 24 #include "chrome/browser/favicon/fallback_icon_service_factory.h" | |
| 25 #include "chrome/browser/favicon/large_icon_service_factory.h" | 24 #include "chrome/browser/favicon/large_icon_service_factory.h" |
| 26 #include "chrome/browser/profiles/profile.h" | 25 #include "chrome/browser/profiles/profile.h" |
| 27 #include "chrome/browser/sync/profile_sync_service_factory.h" | 26 #include "chrome/browser/sync/profile_sync_service_factory.h" |
| 28 #include "chrome/browser/ui/browser_finder.h" | 27 #include "chrome/browser/ui/browser_finder.h" |
| 29 #include "chrome/browser/ui/chrome_pages.h" | 28 #include "chrome/browser/ui/chrome_pages.h" |
| 30 #include "chrome/browser/ui/webui/favicon_source.h" | 29 #include "chrome/browser/ui/webui/favicon_source.h" |
| 31 #include "chrome/browser/ui/webui/large_icon_source.h" | 30 #include "chrome/browser/ui/webui/large_icon_source.h" |
| 32 #include "chrome/common/features.h" | 31 #include "chrome/common/features.h" |
| 33 #include "components/bookmarks/browser/bookmark_model.h" | 32 #include "components/bookmarks/browser/bookmark_model.h" |
| 34 #include "components/bookmarks/browser/bookmark_utils.h" | 33 #include "components/bookmarks/browser/bookmark_utils.h" |
| 35 #include "components/browser_sync/profile_sync_service.h" | 34 #include "components/browser_sync/profile_sync_service.h" |
| 36 #include "components/favicon/core/fallback_icon_service.h" | |
| 37 #include "components/favicon/core/fallback_url_util.h" | 35 #include "components/favicon/core/fallback_url_util.h" |
| 38 #include "components/favicon/core/large_icon_service.h" | 36 #include "components/favicon/core/large_icon_service.h" |
| 39 #include "components/query_parser/snippet.h" | 37 #include "components/query_parser/snippet.h" |
| 40 #include "components/strings/grit/components_strings.h" | 38 #include "components/strings/grit/components_strings.h" |
| 41 #include "components/sync/device_info/device_info.h" | 39 #include "components/sync/device_info/device_info.h" |
| 42 #include "components/sync/device_info/device_info_tracker.h" | 40 #include "components/sync/device_info/device_info_tracker.h" |
| 43 #include "components/url_formatter/url_formatter.h" | 41 #include "components/url_formatter/url_formatter.h" |
| 44 #include "content/public/browser/url_data_source.h" | 42 #include "content/public/browser/url_data_source.h" |
| 45 #include "content/public/browser/web_ui.h" | 43 #include "content/public/browser/web_ui.h" |
| 46 #include "extensions/features/features.h" | 44 #include "extensions/features/features.h" |
| (...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 266 } | 264 } |
| 267 | 265 |
| 268 void BrowsingHistoryHandler::RegisterMessages() { | 266 void BrowsingHistoryHandler::RegisterMessages() { |
| 269 browsing_history_service_ = base::MakeUnique<BrowsingHistoryService>( | 267 browsing_history_service_ = base::MakeUnique<BrowsingHistoryService>( |
| 270 Profile::FromWebUI(web_ui()), this); | 268 Profile::FromWebUI(web_ui()), this); |
| 271 | 269 |
| 272 // Create our favicon data source. | 270 // Create our favicon data source. |
| 273 Profile* profile = Profile::FromWebUI(web_ui()); | 271 Profile* profile = Profile::FromWebUI(web_ui()); |
| 274 | 272 |
| 275 #if defined(OS_ANDROID) | 273 #if defined(OS_ANDROID) |
| 276 favicon::FallbackIconService* fallback_icon_service = | |
| 277 FallbackIconServiceFactory::GetForBrowserContext(profile); | |
| 278 favicon::LargeIconService* large_icon_service = | 274 favicon::LargeIconService* large_icon_service = |
| 279 LargeIconServiceFactory::GetForBrowserContext(profile); | 275 LargeIconServiceFactory::GetForBrowserContext(profile); |
| 280 content::URLDataSource::Add( | 276 content::URLDataSource::Add(profile, new LargeIconSource(large_icon_service)); |
| 281 profile, new LargeIconSource(fallback_icon_service, large_icon_service)); | |
| 282 #else | 277 #else |
| 283 content::URLDataSource::Add(profile, new FaviconSource(profile)); | 278 content::URLDataSource::Add(profile, new FaviconSource(profile)); |
| 284 #endif | 279 #endif |
| 285 | 280 |
| 286 web_ui()->RegisterMessageCallback("queryHistory", | 281 web_ui()->RegisterMessageCallback("queryHistory", |
| 287 base::Bind(&BrowsingHistoryHandler::HandleQueryHistory, | 282 base::Bind(&BrowsingHistoryHandler::HandleQueryHistory, |
| 288 base::Unretained(this))); | 283 base::Unretained(this))); |
| 289 web_ui()->RegisterMessageCallback("removeVisits", | 284 web_ui()->RegisterMessageCallback("removeVisits", |
| 290 base::Bind(&BrowsingHistoryHandler::HandleRemoveVisits, | 285 base::Bind(&BrowsingHistoryHandler::HandleRemoveVisits, |
| 291 base::Unretained(this))); | 286 base::Unretained(this))); |
| (...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 545 web_ui()->CallJavascriptFunctionUnsafe("historyDeleted"); | 540 web_ui()->CallJavascriptFunctionUnsafe("historyDeleted"); |
| 546 } | 541 } |
| 547 | 542 |
| 548 void BrowsingHistoryHandler::HasOtherFormsOfBrowsingHistory( | 543 void BrowsingHistoryHandler::HasOtherFormsOfBrowsingHistory( |
| 549 bool has_other_forms, | 544 bool has_other_forms, |
| 550 bool has_synced_results) { | 545 bool has_synced_results) { |
| 551 web_ui()->CallJavascriptFunctionUnsafe("showNotification", | 546 web_ui()->CallJavascriptFunctionUnsafe("showNotification", |
| 552 base::Value(has_synced_results), | 547 base::Value(has_synced_results), |
| 553 base::Value(has_other_forms)); | 548 base::Value(has_other_forms)); |
| 554 } | 549 } |
| OLD | NEW |