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 "components/autofill/core/browser/personal_data_manager.h" | 18 #include "components/autofill/core/browser/personal_data_manager.h" |
18 #include "components/autofill/core/browser/webdata/autofill_webdata_service.h" | 19 #include "components/autofill/core/browser/webdata/autofill_webdata_service.h" |
19 #include "components/history/core/browser/history_service.h" | 20 #include "components/history/core/browser/history_service.h" |
20 #include "components/keyed_service/core/service_access_type.h" | 21 #include "components/keyed_service/core/service_access_type.h" |
21 #include "components/omnibox/browser/omnibox_pref_names.h" | 22 #include "components/omnibox/browser/omnibox_pref_names.h" |
22 #include "components/password_manager/core/browser/password_store.h" | 23 #include "components/password_manager/core/browser/password_store.h" |
23 #include "components/prefs/pref_service.h" | 24 #include "components/prefs/pref_service.h" |
24 #include "components/search_engines/template_url_service.h" | 25 #include "components/search_engines/template_url_service.h" |
25 #include "components/sessions/core/tab_restore_service.h" | 26 #include "components/sessions/core/tab_restore_service.h" |
26 #include "ios/chrome/browser/application_context.h" | 27 #include "ios/chrome/browser/application_context.h" |
(...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
392 IOSChromeBrowsingDataRemover::NotificationDetails details(delete_begin_, | 393 IOSChromeBrowsingDataRemover::NotificationDetails details(delete_begin_, |
393 remove_mask_); | 394 remove_mask_); |
394 | 395 |
395 GetOnBrowsingDataRemovedCallbacks()->Notify(details); | 396 GetOnBrowsingDataRemovedCallbacks()->Notify(details); |
396 | 397 |
397 FOR_EACH_OBSERVER(Observer, observer_list_, | 398 FOR_EACH_OBSERVER(Observer, observer_list_, |
398 OnIOSChromeBrowsingDataRemoverDone()); | 399 OnIOSChromeBrowsingDataRemoverDone()); |
399 | 400 |
400 // History requests aren't happy if you delete yourself from the callback. | 401 // History requests aren't happy if you delete yourself from the callback. |
401 // As such, we do a delete later. | 402 // As such, we do a delete later. |
402 base::MessageLoop::current()->DeleteSoon(FROM_HERE, this); | 403 base::ThreadTaskRunnerHandle::Get()->DeleteSoon(FROM_HERE, this); |
403 } | 404 } |
404 | 405 |
405 void IOSChromeBrowsingDataRemover::NotifyAndDeleteIfDone() { | 406 void IOSChromeBrowsingDataRemover::NotifyAndDeleteIfDone() { |
406 // TODO(brettw) http://crbug.com/305259: This should also observe session | 407 // TODO(brettw) http://crbug.com/305259: This should also observe session |
407 // clearing (what about other things such as passwords, etc.?) and wait for | 408 // clearing (what about other things such as passwords, etc.?) and wait for |
408 // them to complete before continuing. | 409 // them to complete before continuing. |
409 | 410 |
410 if (!AllDone()) | 411 if (!AllDone()) |
411 return; | 412 return; |
412 | 413 |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
505 waiting_for_clear_autofill_origin_urls_ = false; | 506 waiting_for_clear_autofill_origin_urls_ = false; |
506 NotifyAndDeleteIfDone(); | 507 NotifyAndDeleteIfDone(); |
507 } | 508 } |
508 | 509 |
509 // static | 510 // static |
510 IOSChromeBrowsingDataRemover::CallbackSubscription | 511 IOSChromeBrowsingDataRemover::CallbackSubscription |
511 IOSChromeBrowsingDataRemover::RegisterOnBrowsingDataRemovedCallback( | 512 IOSChromeBrowsingDataRemover::RegisterOnBrowsingDataRemovedCallback( |
512 const IOSChromeBrowsingDataRemover::Callback& callback) { | 513 const IOSChromeBrowsingDataRemover::Callback& callback) { |
513 return GetOnBrowsingDataRemovedCallbacks()->Add(callback); | 514 return GetOnBrowsingDataRemovedCallbacks()->Add(callback); |
514 } | 515 } |
OLD | NEW |