| 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 "ios/chrome/browser/browsing_data/ios_chrome_browsing_data_remover.h" | 5 #include "ios/chrome/browser/browsing_data/ios_chrome_browsing_data_remover.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 #include <set> | 8 #include <set> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "base/bind.h" | 11 #include "base/bind.h" |
| 12 #include "base/bind_helpers.h" | 12 #include "base/bind_helpers.h" |
| 13 #include "base/callback.h" | 13 #include "base/callback.h" |
| 14 #include "base/logging.h" | 14 #include "base/logging.h" |
| 15 #include "base/metrics/histogram_macros.h" | 15 #include "base/metrics/histogram_macros.h" |
| 16 #include "base/metrics/user_metrics.h" | 16 #include "base/metrics/user_metrics.h" |
| 17 #include "base/threading/thread_task_runner_handle.h" | 17 #include "base/threading/thread_task_runner_handle.h" |
| 18 #include "components/autofill/core/browser/personal_data_manager.h" | 18 #include "components/autofill/core/browser/personal_data_manager.h" |
| 19 #include "components/autofill/core/browser/webdata/autofill_webdata_service.h" | 19 #include "components/autofill/core/browser/webdata/autofill_webdata_service.h" |
| 20 #include "components/history/core/browser/history_service.h" | 20 #include "components/history/core/browser/history_service.h" |
| 21 #include "components/keyed_service/core/service_access_type.h" | 21 #include "components/keyed_service/core/service_access_type.h" |
| 22 #include "components/omnibox/browser/omnibox_pref_names.h" | 22 #include "components/omnibox/browser/omnibox_pref_names.h" |
| 23 #include "components/password_manager/core/browser/password_store.h" | 23 #include "components/password_manager/core/browser/password_store.h" |
| 24 #include "components/prefs/pref_service.h" | 24 #include "components/prefs/pref_service.h" |
| 25 #include "components/search_engines/template_url_service.h" | 25 #include "components/search_engines/template_url_service.h" |
| 26 #include "components/sessions/core/tab_restore_service.h" | 26 #include "components/sessions/core/tab_restore_service.h" |
| 27 #include "components/translate/core/browser/language_model.h" |
| 27 #include "ios/chrome/browser/application_context.h" | 28 #include "ios/chrome/browser/application_context.h" |
| 28 #include "ios/chrome/browser/autofill/personal_data_manager_factory.h" | 29 #include "ios/chrome/browser/autofill/personal_data_manager_factory.h" |
| 29 #include "ios/chrome/browser/browser_state/chrome_browser_state.h" | 30 #include "ios/chrome/browser/browser_state/chrome_browser_state.h" |
| 30 #include "ios/chrome/browser/history/history_service_factory.h" | 31 #include "ios/chrome/browser/history/history_service_factory.h" |
| 31 #include "ios/chrome/browser/history/web_history_service_factory.h" | 32 #include "ios/chrome/browser/history/web_history_service_factory.h" |
| 32 #include "ios/chrome/browser/ios_chrome_io_thread.h" | 33 #include "ios/chrome/browser/ios_chrome_io_thread.h" |
| 33 #include "ios/chrome/browser/passwords/ios_chrome_password_store_factory.h" | 34 #include "ios/chrome/browser/passwords/ios_chrome_password_store_factory.h" |
| 34 #include "ios/chrome/browser/search_engines/template_url_service_factory.h" | 35 #include "ios/chrome/browser/search_engines/template_url_service_factory.h" |
| 35 #include "ios/chrome/browser/sessions/ios_chrome_tab_restore_service_factory.h" | 36 #include "ios/chrome/browser/sessions/ios_chrome_tab_restore_service_factory.h" |
| 37 #include "ios/chrome/browser/translate/language_model_factory.h" |
| 36 #include "ios/chrome/browser/web_data_service_factory.h" | 38 #include "ios/chrome/browser/web_data_service_factory.h" |
| 37 #include "ios/net/http_cache_helper.h" | 39 #include "ios/net/http_cache_helper.h" |
| 38 #include "ios/public/provider/chrome/browser/chrome_browser_provider.h" | 40 #include "ios/public/provider/chrome/browser/chrome_browser_provider.h" |
| 39 #include "ios/web/public/web_thread.h" | 41 #include "ios/web/public/web_thread.h" |
| 40 #include "net/base/net_errors.h" | 42 #include "net/base/net_errors.h" |
| 41 #include "net/cookies/cookie_store.h" | 43 #include "net/cookies/cookie_store.h" |
| 42 #include "net/http/transport_security_state.h" | 44 #include "net/http/transport_security_state.h" |
| 43 #include "net/ssl/channel_id_service.h" | 45 #include "net/ssl/channel_id_service.h" |
| 44 #include "net/ssl/channel_id_store.h" | 46 #include "net/ssl/channel_id_store.h" |
| 45 #include "net/url_request/url_request_context.h" | 47 #include "net/url_request/url_request_context.h" |
| (...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 238 base::Bind(&IOSChromeBrowsingDataRemover::OnClearedAutofillOriginURLs, | 240 base::Bind(&IOSChromeBrowsingDataRemover::OnClearedAutofillOriginURLs, |
| 239 base::Unretained(this))); | 241 base::Unretained(this))); |
| 240 | 242 |
| 241 autofill::PersonalDataManager* data_manager = | 243 autofill::PersonalDataManager* data_manager = |
| 242 autofill::PersonalDataManagerFactory::GetForBrowserState( | 244 autofill::PersonalDataManagerFactory::GetForBrowserState( |
| 243 browser_state_); | 245 browser_state_); |
| 244 if (data_manager) | 246 if (data_manager) |
| 245 data_manager->Refresh(); | 247 data_manager->Refresh(); |
| 246 } | 248 } |
| 247 | 249 |
| 250 // Remove language model history. |
| 251 translate::LanguageModel* language_model = |
| 252 LanguageModelFactory::GetForBrowserState(browser_state_); |
| 253 if (language_model) { |
| 254 language_model->ClearHistory(delete_begin_, delete_end_); |
| 255 } |
| 248 } | 256 } |
| 249 | 257 |
| 250 if (remove_mask & REMOVE_COOKIES) { | 258 if (remove_mask & REMOVE_COOKIES) { |
| 251 base::RecordAction(UserMetricsAction("ClearBrowsingData_Cookies")); | 259 base::RecordAction(UserMetricsAction("ClearBrowsingData_Cookies")); |
| 252 | 260 |
| 253 ++waiting_for_clear_cookies_count_; | 261 ++waiting_for_clear_cookies_count_; |
| 254 WebThread::PostTask( | 262 WebThread::PostTask( |
| 255 WebThread::IO, FROM_HERE, | 263 WebThread::IO, FROM_HERE, |
| 256 base::Bind(&IOSChromeBrowsingDataRemover::ClearCookiesOnIOThread, | 264 base::Bind(&IOSChromeBrowsingDataRemover::ClearCookiesOnIOThread, |
| 257 base::Unretained(this), main_context_getter_)); | 265 base::Unretained(this), main_context_getter_)); |
| (...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 507 waiting_for_clear_autofill_origin_urls_ = false; | 515 waiting_for_clear_autofill_origin_urls_ = false; |
| 508 NotifyAndDeleteIfDone(); | 516 NotifyAndDeleteIfDone(); |
| 509 } | 517 } |
| 510 | 518 |
| 511 // static | 519 // static |
| 512 IOSChromeBrowsingDataRemover::CallbackSubscription | 520 IOSChromeBrowsingDataRemover::CallbackSubscription |
| 513 IOSChromeBrowsingDataRemover::RegisterOnBrowsingDataRemovedCallback( | 521 IOSChromeBrowsingDataRemover::RegisterOnBrowsingDataRemovedCallback( |
| 514 const IOSChromeBrowsingDataRemover::Callback& callback) { | 522 const IOSChromeBrowsingDataRemover::Callback& callback) { |
| 515 return GetOnBrowsingDataRemovedCallbacks()->Add(callback); | 523 return GetOnBrowsingDataRemovedCallbacks()->Add(callback); |
| 516 } | 524 } |
| OLD | NEW |