| 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/metrics/user_metrics.h" | 18 #include "chrome/browser/metrics/user_metrics.h" |
| 19 #include "chrome/browser/net/chrome_net_log.h" | 19 #include "chrome/browser/net/chrome_net_log.h" |
| 20 #include "chrome/browser/net/chrome_url_request_context.h" | 20 #include "chrome/browser/net/chrome_url_request_context.h" |
| 21 #include "chrome/browser/password_manager/password_store.h" | 21 #include "chrome/browser/password_manager/password_store.h" |
| 22 #include "chrome/browser/plugin_data_remover.h" | 22 #include "chrome/browser/plugin_data_remover.h" |
| 23 #include "chrome/browser/profiles/profile.h" | 23 #include "chrome/browser/profiles/profile.h" |
| 24 #include "chrome/browser/renderer_host/web_cache_manager.h" | 24 #include "chrome/browser/renderer_host/web_cache_manager.h" |
| 25 #include "chrome/browser/search_engines/template_url_model.h" | 25 #include "chrome/browser/search_engines/template_url_model.h" |
| 26 #include "chrome/browser/sessions/session_service.h" | 26 #include "chrome/browser/sessions/session_service.h" |
| 27 #include "chrome/browser/sessions/session_service_factory.h" |
| 27 #include "chrome/browser/sessions/tab_restore_service.h" | 28 #include "chrome/browser/sessions/tab_restore_service.h" |
| 29 #include "chrome/browser/sessions/tab_restore_service_factory.h" |
| 28 #include "chrome/browser/webdata/web_data_service.h" | 30 #include "chrome/browser/webdata/web_data_service.h" |
| 29 #include "chrome/common/url_constants.h" | 31 #include "chrome/common/url_constants.h" |
| 30 #include "content/browser/browser_thread.h" | 32 #include "content/browser/browser_thread.h" |
| 31 #include "content/browser/in_process_webkit/webkit_context.h" | 33 #include "content/browser/in_process_webkit/webkit_context.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" |
| 37 #include "net/http/http_cache.h" | 39 #include "net/http/http_cache.h" |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 if (keywords_model && !keywords_model->loaded()) { | 142 if (keywords_model && !keywords_model->loaded()) { |
| 141 registrar_.Add(this, NotificationType::TEMPLATE_URL_MODEL_LOADED, | 143 registrar_.Add(this, NotificationType::TEMPLATE_URL_MODEL_LOADED, |
| 142 Source<TemplateURLModel>(keywords_model)); | 144 Source<TemplateURLModel>(keywords_model)); |
| 143 keywords_model->Load(); | 145 keywords_model->Load(); |
| 144 } else if (keywords_model) { | 146 } else if (keywords_model) { |
| 145 keywords_model->RemoveAutoGeneratedBetween(delete_begin_, delete_end_); | 147 keywords_model->RemoveAutoGeneratedBetween(delete_begin_, delete_end_); |
| 146 } | 148 } |
| 147 | 149 |
| 148 // We also delete the list of recently closed tabs. Since these expire, | 150 // We also delete the list of recently closed tabs. Since these expire, |
| 149 // they can't be more than a day old, so we can simply clear them all. | 151 // they can't be more than a day old, so we can simply clear them all. |
| 150 TabRestoreService* tab_service = profile_->GetTabRestoreService(); | 152 TabRestoreService* tab_service = |
| 153 TabRestoreServiceFactory::GetForProfile(profile_); |
| 151 if (tab_service) { | 154 if (tab_service) { |
| 152 tab_service->ClearEntries(); | 155 tab_service->ClearEntries(); |
| 153 tab_service->DeleteLastSession(); | 156 tab_service->DeleteLastSession(); |
| 154 } | 157 } |
| 155 | 158 |
| 156 // We also delete the last session when we delete the history. | 159 // We also delete the last session when we delete the history. |
| 157 SessionService* session_service = profile_->GetSessionService(); | 160 SessionService* session_service = |
| 161 SessionServiceFactory::GetForProfile(profile_); |
| 158 if (session_service) | 162 if (session_service) |
| 159 session_service->DeleteLastSession(); | 163 session_service->DeleteLastSession(); |
| 160 } | 164 } |
| 161 | 165 |
| 162 if (remove_mask & REMOVE_DOWNLOADS) { | 166 if (remove_mask & REMOVE_DOWNLOADS) { |
| 163 UserMetrics::RecordAction(UserMetricsAction("ClearBrowsingData_Downloads"), | 167 UserMetrics::RecordAction(UserMetricsAction("ClearBrowsingData_Downloads"), |
| 164 profile_); | 168 profile_); |
| 165 DownloadManager* download_manager = profile_->GetDownloadManager(); | 169 DownloadManager* download_manager = profile_->GetDownloadManager(); |
| 166 download_manager->RemoveDownloadsBetween(delete_begin_, delete_end_); | 170 download_manager->RemoveDownloadsBetween(delete_begin_, delete_end_); |
| 167 download_manager->ClearLastDownloadPath(); | 171 download_manager->ClearLastDownloadPath(); |
| (...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 515 main_context_getter_->GetURLRequestContext()); | 519 main_context_getter_->GetURLRequestContext()); |
| 516 return request_context ? request_context->appcache_service() | 520 return request_context ? request_context->appcache_service() |
| 517 : NULL; | 521 : NULL; |
| 518 } | 522 } |
| 519 | 523 |
| 520 void BrowsingDataRemover::OnWaitableEventSignaled( | 524 void BrowsingDataRemover::OnWaitableEventSignaled( |
| 521 base::WaitableEvent* waitable_event) { | 525 base::WaitableEvent* waitable_event) { |
| 522 waiting_for_clear_lso_data_ = false; | 526 waiting_for_clear_lso_data_ = false; |
| 523 NotifyAndDeleteIfDone(); | 527 NotifyAndDeleteIfDone(); |
| 524 } | 528 } |
| OLD | NEW |