| 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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 #include "ui/base/l10n/l10n_util.h" | 48 #include "ui/base/l10n/l10n_util.h" |
| 49 #include "ui/base/l10n/time_format.h" | 49 #include "ui/base/l10n/time_format.h" |
| 50 | 50 |
| 51 #if BUILDFLAG(ENABLE_SUPERVISED_USERS) | 51 #if BUILDFLAG(ENABLE_SUPERVISED_USERS) |
| 52 #include "chrome/browser/supervised_user/supervised_user_navigation_observer.h" | 52 #include "chrome/browser/supervised_user/supervised_user_navigation_observer.h" |
| 53 #include "chrome/browser/supervised_user/supervised_user_service.h" | 53 #include "chrome/browser/supervised_user/supervised_user_service.h" |
| 54 #include "chrome/browser/supervised_user/supervised_user_service_factory.h" | 54 #include "chrome/browser/supervised_user/supervised_user_service_factory.h" |
| 55 #include "chrome/browser/supervised_user/supervised_user_url_filter.h" | 55 #include "chrome/browser/supervised_user/supervised_user_url_filter.h" |
| 56 #endif | 56 #endif |
| 57 | 57 |
| 58 #if BUILDFLAG(ANDROID_JAVA_UI) | 58 #if defined(OS_ANDROID) |
| 59 #include "chrome/browser/android/chrome_application.h" | 59 #include "chrome/browser/android/chrome_application.h" |
| 60 #endif | 60 #else |
| 61 | |
| 62 #if !defined(OS_ANDROID) | |
| 63 #include "chrome/browser/ui/webui/md_history_ui.h" | 61 #include "chrome/browser/ui/webui/md_history_ui.h" |
| 64 #endif | 62 #endif |
| 65 | 63 |
| 66 // Number of chars to truncate titles when making them "short". | 64 // Number of chars to truncate titles when making them "short". |
| 67 static const size_t kShortTitleLength = 300; | 65 static const size_t kShortTitleLength = 300; |
| 68 | 66 |
| 69 using bookmarks::BookmarkModel; | 67 using bookmarks::BookmarkModel; |
| 70 | 68 |
| 71 namespace { | 69 namespace { |
| 72 | 70 |
| (...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 398 | 396 |
| 399 items_to_remove.push_back(std::move(entry)); | 397 items_to_remove.push_back(std::move(entry)); |
| 400 } | 398 } |
| 401 | 399 |
| 402 browsing_history_service_->RemoveVisits(&items_to_remove); | 400 browsing_history_service_->RemoveVisits(&items_to_remove); |
| 403 items_to_remove.clear(); | 401 items_to_remove.clear(); |
| 404 } | 402 } |
| 405 | 403 |
| 406 void BrowsingHistoryHandler::HandleClearBrowsingData( | 404 void BrowsingHistoryHandler::HandleClearBrowsingData( |
| 407 const base::ListValue* args) { | 405 const base::ListValue* args) { |
| 408 #if BUILDFLAG(ANDROID_JAVA_UI) | 406 #if defined(OS_ANDROID) |
| 409 chrome::android::ChromeApplication::OpenClearBrowsingData( | 407 chrome::android::ChromeApplication::OpenClearBrowsingData( |
| 410 web_ui()->GetWebContents()); | 408 web_ui()->GetWebContents()); |
| 411 #else | 409 #else |
| 412 // TODO(beng): This is an improper direct dependency on Browser. Route this | 410 // TODO(beng): This is an improper direct dependency on Browser. Route this |
| 413 // through some sort of delegate. | 411 // through some sort of delegate. |
| 414 Browser* browser = chrome::FindBrowserWithWebContents( | 412 Browser* browser = chrome::FindBrowserWithWebContents( |
| 415 web_ui()->GetWebContents()); | 413 web_ui()->GetWebContents()); |
| 416 chrome::ShowClearBrowsingDataDialog(browser); | 414 chrome::ShowClearBrowsingDataDialog(browser); |
| 417 #endif | 415 #endif |
| 418 } | 416 } |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 541 web_ui()->CallJavascriptFunctionUnsafe("historyDeleted"); | 539 web_ui()->CallJavascriptFunctionUnsafe("historyDeleted"); |
| 542 } | 540 } |
| 543 | 541 |
| 544 void BrowsingHistoryHandler::HasOtherFormsOfBrowsingHistory( | 542 void BrowsingHistoryHandler::HasOtherFormsOfBrowsingHistory( |
| 545 bool has_other_forms, | 543 bool has_other_forms, |
| 546 bool has_synced_results) { | 544 bool has_synced_results) { |
| 547 web_ui()->CallJavascriptFunctionUnsafe( | 545 web_ui()->CallJavascriptFunctionUnsafe( |
| 548 "showNotification", base::FundamentalValue(has_synced_results), | 546 "showNotification", base::FundamentalValue(has_synced_results), |
| 549 base::FundamentalValue(has_other_forms)); | 547 base::FundamentalValue(has_other_forms)); |
| 550 } | 548 } |
| OLD | NEW |