| 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> |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 #include "components/url_formatter/url_formatter.h" | 58 #include "components/url_formatter/url_formatter.h" |
| 59 #include "content/public/browser/url_data_source.h" | 59 #include "content/public/browser/url_data_source.h" |
| 60 #include "content/public/browser/web_ui.h" | 60 #include "content/public/browser/web_ui.h" |
| 61 #include "ui/base/l10n/l10n_util.h" | 61 #include "ui/base/l10n/l10n_util.h" |
| 62 #include "ui/base/l10n/time_format.h" | 62 #include "ui/base/l10n/time_format.h" |
| 63 | 63 |
| 64 #if defined(ENABLE_EXTENSIONS) | 64 #if defined(ENABLE_EXTENSIONS) |
| 65 #include "chrome/browser/extensions/activity_log/activity_log.h" | 65 #include "chrome/browser/extensions/activity_log/activity_log.h" |
| 66 #endif | 66 #endif |
| 67 | 67 |
| 68 #if defined(ENABLE_SUPERVISED_USERS) | 68 #if BUILDFLAG(ENABLE_SUPERVISED_USERS) |
| 69 #include "chrome/browser/supervised_user/supervised_user_navigation_observer.h" | 69 #include "chrome/browser/supervised_user/supervised_user_navigation_observer.h" |
| 70 #include "chrome/browser/supervised_user/supervised_user_service.h" | 70 #include "chrome/browser/supervised_user/supervised_user_service.h" |
| 71 #include "chrome/browser/supervised_user/supervised_user_service_factory.h" | 71 #include "chrome/browser/supervised_user/supervised_user_service_factory.h" |
| 72 #include "chrome/browser/supervised_user/supervised_user_url_filter.h" | 72 #include "chrome/browser/supervised_user/supervised_user_url_filter.h" |
| 73 #endif | 73 #endif |
| 74 | 74 |
| 75 #if BUILDFLAG(ANDROID_JAVA_UI) | 75 #if BUILDFLAG(ANDROID_JAVA_UI) |
| 76 #include "chrome/browser/android/chrome_application.h" | 76 #include "chrome/browser/android/chrome_application.h" |
| 77 #endif | 77 #endif |
| 78 | 78 |
| (...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 293 date_time_of_day = base::TimeFormatTimeOfDay(time); | 293 date_time_of_day = base::TimeFormatTimeOfDay(time); |
| 294 } | 294 } |
| 295 | 295 |
| 296 std::string device_name; | 296 std::string device_name; |
| 297 std::string device_type; | 297 std::string device_type; |
| 298 if (!client_id.empty()) | 298 if (!client_id.empty()) |
| 299 GetDeviceNameAndType(sync_service, client_id, &device_name, &device_type); | 299 GetDeviceNameAndType(sync_service, client_id, &device_name, &device_type); |
| 300 result->SetString("deviceName", device_name); | 300 result->SetString("deviceName", device_name); |
| 301 result->SetString("deviceType", device_type); | 301 result->SetString("deviceType", device_type); |
| 302 | 302 |
| 303 #if defined(ENABLE_SUPERVISED_USERS) | 303 #if BUILDFLAG(ENABLE_SUPERVISED_USERS) |
| 304 if (supervised_user_service) { | 304 if (supervised_user_service) { |
| 305 const SupervisedUserURLFilter* url_filter = | 305 const SupervisedUserURLFilter* url_filter = |
| 306 supervised_user_service->GetURLFilterForUIThread(); | 306 supervised_user_service->GetURLFilterForUIThread(); |
| 307 int filtering_behavior = | 307 int filtering_behavior = |
| 308 url_filter->GetFilteringBehaviorForURL(url.GetWithEmptyPath()); | 308 url_filter->GetFilteringBehaviorForURL(url.GetWithEmptyPath()); |
| 309 is_blocked_visit = blocked_visit; | 309 is_blocked_visit = blocked_visit; |
| 310 host_filtering_behavior = filtering_behavior; | 310 host_filtering_behavior = filtering_behavior; |
| 311 } | 311 } |
| 312 #endif | 312 #endif |
| 313 | 313 |
| (...skipping 441 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 755 } | 755 } |
| 756 if (!web_history_timer_.IsRunning()) | 756 if (!web_history_timer_.IsRunning()) |
| 757 ReturnResultsToFrontEnd(); | 757 ReturnResultsToFrontEnd(); |
| 758 } | 758 } |
| 759 | 759 |
| 760 void BrowsingHistoryHandler::ReturnResultsToFrontEnd() { | 760 void BrowsingHistoryHandler::ReturnResultsToFrontEnd() { |
| 761 Profile* profile = Profile::FromWebUI(web_ui()); | 761 Profile* profile = Profile::FromWebUI(web_ui()); |
| 762 BookmarkModel* bookmark_model = | 762 BookmarkModel* bookmark_model = |
| 763 BookmarkModelFactory::GetForBrowserContext(profile); | 763 BookmarkModelFactory::GetForBrowserContext(profile); |
| 764 SupervisedUserService* supervised_user_service = NULL; | 764 SupervisedUserService* supervised_user_service = NULL; |
| 765 #if defined(ENABLE_SUPERVISED_USERS) | 765 #if BUILDFLAG(ENABLE_SUPERVISED_USERS) |
| 766 if (profile->IsSupervised()) | 766 if (profile->IsSupervised()) |
| 767 supervised_user_service = | 767 supervised_user_service = |
| 768 SupervisedUserServiceFactory::GetForProfile(profile); | 768 SupervisedUserServiceFactory::GetForProfile(profile); |
| 769 #endif | 769 #endif |
| 770 browser_sync::ProfileSyncService* sync_service = | 770 browser_sync::ProfileSyncService* sync_service = |
| 771 ProfileSyncServiceFactory::GetInstance()->GetForProfile(profile); | 771 ProfileSyncServiceFactory::GetInstance()->GetForProfile(profile); |
| 772 | 772 |
| 773 // Combine the local and remote results into |query_results_|, and remove | 773 // Combine the local and remote results into |query_results_|, and remove |
| 774 // any duplicates. | 774 // any duplicates. |
| 775 if (!web_history_query_results_.empty()) { | 775 if (!web_history_query_results_.empty()) { |
| (...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1005 bool expired, | 1005 bool expired, |
| 1006 const history::URLRows& deleted_rows, | 1006 const history::URLRows& deleted_rows, |
| 1007 const std::set<GURL>& favicon_urls) { | 1007 const std::set<GURL>& favicon_urls) { |
| 1008 if (all_history || DeletionsDiffer(deleted_rows, urls_to_be_deleted_)) | 1008 if (all_history || DeletionsDiffer(deleted_rows, urls_to_be_deleted_)) |
| 1009 web_ui()->CallJavascriptFunctionUnsafe("historyDeleted"); | 1009 web_ui()->CallJavascriptFunctionUnsafe("historyDeleted"); |
| 1010 } | 1010 } |
| 1011 | 1011 |
| 1012 void BrowsingHistoryHandler::OnWebHistoryDeleted() { | 1012 void BrowsingHistoryHandler::OnWebHistoryDeleted() { |
| 1013 web_ui()->CallJavascriptFunctionUnsafe("historyDeleted"); | 1013 web_ui()->CallJavascriptFunctionUnsafe("historyDeleted"); |
| 1014 } | 1014 } |
| OLD | NEW |