| 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 |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 void GetDeviceNameAndType(const browser_sync::ProfileSyncService* sync_service, | 104 void GetDeviceNameAndType(const browser_sync::ProfileSyncService* sync_service, |
| 105 const std::string& client_id, | 105 const std::string& client_id, |
| 106 std::string* name, | 106 std::string* name, |
| 107 std::string* type) { | 107 std::string* type) { |
| 108 // DeviceInfoTracker must be syncing in order for remote history entries to | 108 // DeviceInfoTracker must be syncing in order for remote history entries to |
| 109 // be available. | 109 // be available. |
| 110 DCHECK(sync_service); | 110 DCHECK(sync_service); |
| 111 DCHECK(sync_service->GetDeviceInfoTracker()); | 111 DCHECK(sync_service->GetDeviceInfoTracker()); |
| 112 DCHECK(sync_service->GetDeviceInfoTracker()->IsSyncing()); | 112 DCHECK(sync_service->GetDeviceInfoTracker()->IsSyncing()); |
| 113 | 113 |
| 114 std::unique_ptr<sync_driver::DeviceInfo> device_info = | 114 std::unique_ptr<syncer::DeviceInfo> device_info = |
| 115 sync_service->GetDeviceInfoTracker()->GetDeviceInfo(client_id); | 115 sync_service->GetDeviceInfoTracker()->GetDeviceInfo(client_id); |
| 116 if (device_info.get()) { | 116 if (device_info.get()) { |
| 117 *name = device_info->client_name(); | 117 *name = device_info->client_name(); |
| 118 switch (device_info->device_type()) { | 118 switch (device_info->device_type()) { |
| 119 case sync_pb::SyncEnums::TYPE_PHONE: | 119 case sync_pb::SyncEnums::TYPE_PHONE: |
| 120 *type = kDeviceTypePhone; | 120 *type = kDeviceTypePhone; |
| 121 break; | 121 break; |
| 122 case sync_pb::SyncEnums::TYPE_TABLET: | 122 case sync_pb::SyncEnums::TYPE_TABLET: |
| 123 *type = kDeviceTypeTablet; | 123 *type = kDeviceTypeTablet; |
| 124 break; | 124 break; |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 275 // Create our favicon data source. | 275 // Create our favicon data source. |
| 276 ios::ChromeBrowserState* browser_state = | 276 ios::ChromeBrowserState* browser_state = |
| 277 ios::ChromeBrowserState::FromWebUIIOS(web_ui()); | 277 ios::ChromeBrowserState::FromWebUIIOS(web_ui()); |
| 278 ios::ChromeBrowserState* original_browser_state = | 278 ios::ChromeBrowserState* original_browser_state = |
| 279 browser_state->GetOriginalChromeBrowserState(); | 279 browser_state->GetOriginalChromeBrowserState(); |
| 280 favicon::FaviconService* favicon_service = | 280 favicon::FaviconService* favicon_service = |
| 281 ios::FaviconServiceFactory::GetForBrowserState( | 281 ios::FaviconServiceFactory::GetForBrowserState( |
| 282 original_browser_state, ServiceAccessType::EXPLICIT_ACCESS); | 282 original_browser_state, ServiceAccessType::EXPLICIT_ACCESS); |
| 283 scoped_refptr<history::TopSites> top_sites = | 283 scoped_refptr<history::TopSites> top_sites = |
| 284 ios::TopSitesFactory::GetForBrowserState(original_browser_state); | 284 ios::TopSitesFactory::GetForBrowserState(original_browser_state); |
| 285 sync_driver::SyncService* sync_service = | 285 syncer::SyncService* sync_service = |
| 286 IOSChromeProfileSyncServiceFactory::GetForBrowserState( | 286 IOSChromeProfileSyncServiceFactory::GetForBrowserState( |
| 287 original_browser_state); | 287 original_browser_state); |
| 288 web::URLDataSourceIOS::Add( | 288 web::URLDataSourceIOS::Add( |
| 289 browser_state, | 289 browser_state, |
| 290 new FaviconSource(favicon_service, top_sites, sync_service)); | 290 new FaviconSource(favicon_service, top_sites, sync_service)); |
| 291 | 291 |
| 292 // Get notifications when history is cleared. | 292 // Get notifications when history is cleared. |
| 293 history::HistoryService* hs = ios::HistoryServiceFactory::GetForBrowserState( | 293 history::HistoryService* hs = ios::HistoryServiceFactory::GetForBrowserState( |
| 294 browser_state, ServiceAccessType::EXPLICIT_ACCESS); | 294 browser_state, ServiceAccessType::EXPLICIT_ACCESS); |
| 295 if (hs) | 295 if (hs) |
| (...skipping 555 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 |