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/large_icon_service_factory.h" | 24 #include "chrome/browser/favicon/large_icon_service_factory.h" |
25 #include "chrome/browser/profiles/profile.h" | 25 #include "chrome/browser/profiles/profile.h" |
26 #include "chrome/browser/sync/profile_sync_service_factory.h" | 26 #include "chrome/browser/sync/profile_sync_service_factory.h" |
27 #include "chrome/browser/ui/browser_finder.h" | 27 #include "chrome/browser/ui/browser_finder.h" |
28 #include "chrome/browser/ui/chrome_pages.h" | 28 #include "chrome/browser/ui/chrome_pages.h" |
29 #include "chrome/browser/ui/webui/favicon_source.h" | 29 #include "chrome/browser/ui/webui/favicon_source.h" |
30 #include "chrome/browser/ui/webui/large_icon_source.h" | |
31 #include "chrome/common/features.h" | 30 #include "chrome/common/features.h" |
32 #include "components/bookmarks/browser/bookmark_model.h" | 31 #include "components/bookmarks/browser/bookmark_model.h" |
33 #include "components/bookmarks/browser/bookmark_utils.h" | 32 #include "components/bookmarks/browser/bookmark_utils.h" |
34 #include "components/browser_sync/profile_sync_service.h" | 33 #include "components/browser_sync/profile_sync_service.h" |
35 #include "components/favicon/core/fallback_url_util.h" | 34 #include "components/favicon/core/fallback_url_util.h" |
36 #include "components/favicon/core/large_icon_service.h" | 35 #include "components/favicon/core/large_icon_service.h" |
37 #include "components/query_parser/snippet.h" | 36 #include "components/query_parser/snippet.h" |
38 #include "components/strings/grit/components_strings.h" | 37 #include "components/strings/grit/components_strings.h" |
39 #include "components/sync/device_info/device_info.h" | 38 #include "components/sync/device_info/device_info.h" |
40 #include "components/sync/device_info/device_info_tracker.h" | 39 #include "components/sync/device_info/device_info_tracker.h" |
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
262 | 261 |
263 BrowsingHistoryHandler::~BrowsingHistoryHandler() { | 262 BrowsingHistoryHandler::~BrowsingHistoryHandler() { |
264 } | 263 } |
265 | 264 |
266 void BrowsingHistoryHandler::RegisterMessages() { | 265 void BrowsingHistoryHandler::RegisterMessages() { |
267 browsing_history_service_ = base::MakeUnique<BrowsingHistoryService>( | 266 browsing_history_service_ = base::MakeUnique<BrowsingHistoryService>( |
268 Profile::FromWebUI(web_ui()), this); | 267 Profile::FromWebUI(web_ui()), this); |
269 | 268 |
270 // Create our favicon data source. | 269 // Create our favicon data source. |
271 Profile* profile = Profile::FromWebUI(web_ui()); | 270 Profile* profile = Profile::FromWebUI(web_ui()); |
272 | |
273 #if defined(OS_ANDROID) | |
274 favicon::LargeIconService* large_icon_service = | |
275 LargeIconServiceFactory::GetForBrowserContext(profile); | |
276 content::URLDataSource::Add(profile, new LargeIconSource(large_icon_service)); | |
277 #else | |
278 content::URLDataSource::Add(profile, new FaviconSource(profile)); | 271 content::URLDataSource::Add(profile, new FaviconSource(profile)); |
279 #endif | |
280 | 272 |
281 web_ui()->RegisterMessageCallback("queryHistory", | 273 web_ui()->RegisterMessageCallback("queryHistory", |
282 base::Bind(&BrowsingHistoryHandler::HandleQueryHistory, | 274 base::Bind(&BrowsingHistoryHandler::HandleQueryHistory, |
283 base::Unretained(this))); | 275 base::Unretained(this))); |
284 web_ui()->RegisterMessageCallback("removeVisits", | 276 web_ui()->RegisterMessageCallback("removeVisits", |
285 base::Bind(&BrowsingHistoryHandler::HandleRemoveVisits, | 277 base::Bind(&BrowsingHistoryHandler::HandleRemoveVisits, |
286 base::Unretained(this))); | 278 base::Unretained(this))); |
287 web_ui()->RegisterMessageCallback("clearBrowsingData", | 279 web_ui()->RegisterMessageCallback("clearBrowsingData", |
288 base::Bind(&BrowsingHistoryHandler::HandleClearBrowsingData, | 280 base::Bind(&BrowsingHistoryHandler::HandleClearBrowsingData, |
289 base::Unretained(this))); | 281 base::Unretained(this))); |
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
540 web_ui()->CallJavascriptFunctionUnsafe("historyDeleted"); | 532 web_ui()->CallJavascriptFunctionUnsafe("historyDeleted"); |
541 } | 533 } |
542 | 534 |
543 void BrowsingHistoryHandler::HasOtherFormsOfBrowsingHistory( | 535 void BrowsingHistoryHandler::HasOtherFormsOfBrowsingHistory( |
544 bool has_other_forms, | 536 bool has_other_forms, |
545 bool has_synced_results) { | 537 bool has_synced_results) { |
546 web_ui()->CallJavascriptFunctionUnsafe("showNotification", | 538 web_ui()->CallJavascriptFunctionUnsafe("showNotification", |
547 base::Value(has_synced_results), | 539 base::Value(has_synced_results), |
548 base::Value(has_other_forms)); | 540 base::Value(has_other_forms)); |
549 } | 541 } |
OLD | NEW |