| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/browsing_data_remover.h" | 5 #include "chrome/browser/browsing_data_remover.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 #include <set> | 8 #include <set> |
| 9 | 9 |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| 11 #include "chrome/browser/autofill/personal_data_manager.h" | 11 #include "chrome/browser/autofill/personal_data_manager.h" |
| 12 #include "chrome/browser/browser_process.h" | 12 #include "chrome/browser/browser_process.h" |
| 13 #include "chrome/browser/download/download_manager.h" | 13 #include "chrome/browser/download/download_manager.h" |
| 14 #include "chrome/browser/extensions/extension_service.h" | 14 #include "chrome/browser/extensions/extension_service.h" |
| 15 #include "chrome/browser/extensions/extension_special_storage_policy.h" | 15 #include "chrome/browser/extensions/extension_special_storage_policy.h" |
| 16 #include "chrome/browser/history/history.h" | 16 #include "chrome/browser/history/history.h" |
| 17 #include "chrome/browser/io_thread.h" | 17 #include "chrome/browser/io_thread.h" |
| 18 #include "chrome/browser/net/chrome_net_log.h" | 18 #include "chrome/browser/net/chrome_net_log.h" |
| 19 #include "chrome/browser/net/chrome_url_request_context.h" | 19 #include "chrome/browser/net/chrome_url_request_context.h" |
| 20 #include "chrome/browser/password_manager/password_store.h" | 20 #include "chrome/browser/password_manager/password_store.h" |
| 21 #include "chrome/browser/plugin_data_remover.h" | 21 #include "chrome/browser/plugin_data_remover.h" |
| 22 #include "chrome/browser/profiles/profile.h" | 22 #include "chrome/browser/profiles/profile.h" |
| 23 #include "chrome/browser/renderer_host/web_cache_manager.h" | 23 #include "chrome/browser/renderer_host/web_cache_manager.h" |
| 24 #include "chrome/browser/search_engines/template_url_model.h" | 24 #include "chrome/browser/search_engines/template_url_model.h" |
| 25 #include "chrome/browser/sessions/session_service.h" | 25 #include "chrome/browser/sessions/session_service.h" |
| 26 #include "chrome/browser/sessions/session_service_factory.h" |
| 26 #include "chrome/browser/sessions/tab_restore_service.h" | 27 #include "chrome/browser/sessions/tab_restore_service.h" |
| 28 #include "chrome/browser/sessions/tab_restore_service_factory.h" |
| 27 #include "chrome/browser/webdata/web_data_service.h" | 29 #include "chrome/browser/webdata/web_data_service.h" |
| 28 #include "chrome/common/url_constants.h" | 30 #include "chrome/common/url_constants.h" |
| 29 #include "content/browser/browser_thread.h" | 31 #include "content/browser/browser_thread.h" |
| 30 #include "content/browser/in_process_webkit/webkit_context.h" | 32 #include "content/browser/in_process_webkit/webkit_context.h" |
| 31 #include "content/browser/user_metrics.h" | 33 #include "content/browser/user_metrics.h" |
| 32 #include "content/common/notification_source.h" | 34 #include "content/common/notification_source.h" |
| 33 #include "net/base/cookie_monster.h" | 35 #include "net/base/cookie_monster.h" |
| 34 #include "net/base/net_errors.h" | 36 #include "net/base/net_errors.h" |
| 35 #include "net/base/transport_security_state.h" | 37 #include "net/base/transport_security_state.h" |
| 36 #include "net/disk_cache/disk_cache.h" | 38 #include "net/disk_cache/disk_cache.h" |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 139 if (keywords_model && !keywords_model->loaded()) { | 141 if (keywords_model && !keywords_model->loaded()) { |
| 140 registrar_.Add(this, NotificationType::TEMPLATE_URL_MODEL_LOADED, | 142 registrar_.Add(this, NotificationType::TEMPLATE_URL_MODEL_LOADED, |
| 141 Source<TemplateURLModel>(keywords_model)); | 143 Source<TemplateURLModel>(keywords_model)); |
| 142 keywords_model->Load(); | 144 keywords_model->Load(); |
| 143 } else if (keywords_model) { | 145 } else if (keywords_model) { |
| 144 keywords_model->RemoveAutoGeneratedBetween(delete_begin_, delete_end_); | 146 keywords_model->RemoveAutoGeneratedBetween(delete_begin_, delete_end_); |
| 145 } | 147 } |
| 146 | 148 |
| 147 // We also delete the list of recently closed tabs. Since these expire, | 149 // We also delete the list of recently closed tabs. Since these expire, |
| 148 // they can't be more than a day old, so we can simply clear them all. | 150 // they can't be more than a day old, so we can simply clear them all. |
| 149 TabRestoreService* tab_service = profile_->GetTabRestoreService(); | 151 TabRestoreService* tab_service = |
| 152 TabRestoreServiceFactory::GetForProfile(profile_); |
| 150 if (tab_service) { | 153 if (tab_service) { |
| 151 tab_service->ClearEntries(); | 154 tab_service->ClearEntries(); |
| 152 tab_service->DeleteLastSession(); | 155 tab_service->DeleteLastSession(); |
| 153 } | 156 } |
| 154 | 157 |
| 155 // We also delete the last session when we delete the history. | 158 // We also delete the last session when we delete the history. |
| 156 SessionService* session_service = profile_->GetSessionService(); | 159 SessionService* session_service = |
| 160 SessionServiceFactory::GetForProfile(profile_); |
| 157 if (session_service) | 161 if (session_service) |
| 158 session_service->DeleteLastSession(); | 162 session_service->DeleteLastSession(); |
| 159 } | 163 } |
| 160 | 164 |
| 161 if (remove_mask & REMOVE_DOWNLOADS) { | 165 if (remove_mask & REMOVE_DOWNLOADS) { |
| 162 UserMetrics::RecordAction(UserMetricsAction("ClearBrowsingData_Downloads")); | 166 UserMetrics::RecordAction(UserMetricsAction("ClearBrowsingData_Downloads")); |
| 163 DownloadManager* download_manager = profile_->GetDownloadManager(); | 167 DownloadManager* download_manager = profile_->GetDownloadManager(); |
| 164 download_manager->RemoveDownloadsBetween(delete_begin_, delete_end_); | 168 download_manager->RemoveDownloadsBetween(delete_begin_, delete_end_); |
| 165 download_manager->ClearLastDownloadPath(); | 169 download_manager->ClearLastDownloadPath(); |
| 166 } | 170 } |
| (...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 509 main_context_getter_->GetURLRequestContext()); | 513 main_context_getter_->GetURLRequestContext()); |
| 510 return request_context ? request_context->appcache_service() | 514 return request_context ? request_context->appcache_service() |
| 511 : NULL; | 515 : NULL; |
| 512 } | 516 } |
| 513 | 517 |
| 514 void BrowsingDataRemover::OnWaitableEventSignaled( | 518 void BrowsingDataRemover::OnWaitableEventSignaled( |
| 515 base::WaitableEvent* waitable_event) { | 519 base::WaitableEvent* waitable_event) { |
| 516 waiting_for_clear_lso_data_ = false; | 520 waiting_for_clear_lso_data_ = false; |
| 517 NotifyAndDeleteIfDone(); | 521 NotifyAndDeleteIfDone(); |
| 518 } | 522 } |
| OLD | NEW |