| 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" | 
| (...skipping 13 matching lines...) Expand all  Loading... | 
| 24 #include "chrome/browser/prerender/prerender_manager.h" | 24 #include "chrome/browser/prerender/prerender_manager.h" | 
| 25 #include "chrome/browser/profiles/profile.h" | 25 #include "chrome/browser/profiles/profile.h" | 
| 26 #include "chrome/browser/renderer_host/web_cache_manager.h" | 26 #include "chrome/browser/renderer_host/web_cache_manager.h" | 
| 27 #include "chrome/browser/search_engines/template_url_service.h" | 27 #include "chrome/browser/search_engines/template_url_service.h" | 
| 28 #include "chrome/browser/search_engines/template_url_service_factory.h" | 28 #include "chrome/browser/search_engines/template_url_service_factory.h" | 
| 29 #include "chrome/browser/sessions/session_service.h" | 29 #include "chrome/browser/sessions/session_service.h" | 
| 30 #include "chrome/browser/sessions/session_service_factory.h" | 30 #include "chrome/browser/sessions/session_service_factory.h" | 
| 31 #include "chrome/browser/sessions/tab_restore_service.h" | 31 #include "chrome/browser/sessions/tab_restore_service.h" | 
| 32 #include "chrome/browser/sessions/tab_restore_service_factory.h" | 32 #include "chrome/browser/sessions/tab_restore_service_factory.h" | 
| 33 #include "chrome/browser/webdata/web_data_service.h" | 33 #include "chrome/browser/webdata/web_data_service.h" | 
|  | 34 #include "chrome/common/chrome_notification_types.h" | 
| 34 #include "chrome/common/url_constants.h" | 35 #include "chrome/common/url_constants.h" | 
| 35 #include "content/browser/browser_thread.h" | 36 #include "content/browser/browser_thread.h" | 
| 36 #include "content/browser/in_process_webkit/webkit_context.h" | 37 #include "content/browser/in_process_webkit/webkit_context.h" | 
| 37 #include "content/browser/user_metrics.h" | 38 #include "content/browser/user_metrics.h" | 
| 38 #include "content/common/notification_source.h" | 39 #include "content/common/notification_source.h" | 
| 39 #include "net/base/cookie_monster.h" | 40 #include "net/base/cookie_monster.h" | 
| 40 #include "net/base/net_errors.h" | 41 #include "net/base/net_errors.h" | 
| 41 #include "net/base/transport_security_state.h" | 42 #include "net/base/transport_security_state.h" | 
| 42 #include "net/disk_cache/disk_cache.h" | 43 #include "net/disk_cache/disk_cache.h" | 
| 43 #include "net/http/http_cache.h" | 44 #include "net/http/http_cache.h" | 
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 146           NewRunnableMethod( | 147           NewRunnableMethod( | 
| 147               this, | 148               this, | 
| 148               &BrowsingDataRemover::ClearNetworkingHistory, | 149               &BrowsingDataRemover::ClearNetworkingHistory, | 
| 149               g_browser_process->io_thread())); | 150               g_browser_process->io_thread())); | 
| 150     } | 151     } | 
| 151 | 152 | 
| 152     // As part of history deletion we also delete the auto-generated keywords. | 153     // As part of history deletion we also delete the auto-generated keywords. | 
| 153     TemplateURLService* keywords_model = | 154     TemplateURLService* keywords_model = | 
| 154         TemplateURLServiceFactory::GetForProfile(profile_); | 155         TemplateURLServiceFactory::GetForProfile(profile_); | 
| 155     if (keywords_model && !keywords_model->loaded()) { | 156     if (keywords_model && !keywords_model->loaded()) { | 
| 156       registrar_.Add(this, NotificationType::TEMPLATE_URL_SERVICE_LOADED, | 157       registrar_.Add(this, chrome::NOTIFICATION_TEMPLATE_URL_SERVICE_LOADED, | 
| 157                      Source<TemplateURLService>(keywords_model)); | 158                      Source<TemplateURLService>(keywords_model)); | 
| 158       keywords_model->Load(); | 159       keywords_model->Load(); | 
| 159     } else if (keywords_model) { | 160     } else if (keywords_model) { | 
| 160       keywords_model->RemoveAutoGeneratedBetween(delete_begin_, delete_end_); | 161       keywords_model->RemoveAutoGeneratedBetween(delete_begin_, delete_end_); | 
| 161     } | 162     } | 
| 162 | 163 | 
| 163     // We also delete the list of recently closed tabs. Since these expire, | 164     // We also delete the list of recently closed tabs. Since these expire, | 
| 164     // they can't be more than a day old, so we can simply clear them all. | 165     // they can't be more than a day old, so we can simply clear them all. | 
| 165     TabRestoreService* tab_service = | 166     TabRestoreService* tab_service = | 
| 166         TabRestoreServiceFactory::GetForProfile(profile_); | 167         TabRestoreServiceFactory::GetForProfile(profile_); | 
| (...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 354     case EVERYTHING: | 355     case EVERYTHING: | 
| 355       delete_begin_time = base::Time(); | 356       delete_begin_time = base::Time(); | 
| 356       break; | 357       break; | 
| 357     default: | 358     default: | 
| 358       NOTREACHED() << L"Missing item"; | 359       NOTREACHED() << L"Missing item"; | 
| 359       break; | 360       break; | 
| 360   } | 361   } | 
| 361   return delete_begin_time - diff; | 362   return delete_begin_time - diff; | 
| 362 } | 363 } | 
| 363 | 364 | 
| 364 void BrowsingDataRemover::Observe(NotificationType type, | 365 void BrowsingDataRemover::Observe(int type, | 
| 365                                   const NotificationSource& source, | 366                                   const NotificationSource& source, | 
| 366                                   const NotificationDetails& details) { | 367                                   const NotificationDetails& details) { | 
| 367   // TODO(brettw) bug 1139736: This should also observe session | 368   // TODO(brettw) bug 1139736: This should also observe session | 
| 368   // clearing (what about other things such as passwords, etc.?) and wait for | 369   // clearing (what about other things such as passwords, etc.?) and wait for | 
| 369   // them to complete before continuing. | 370   // them to complete before continuing. | 
| 370   DCHECK(type == NotificationType::TEMPLATE_URL_SERVICE_LOADED); | 371   DCHECK(type == chrome::NOTIFICATION_TEMPLATE_URL_SERVICE_LOADED); | 
| 371   TemplateURLService* model = Source<TemplateURLService>(source).ptr(); | 372   TemplateURLService* model = Source<TemplateURLService>(source).ptr(); | 
| 372   if (model->profile() == profile_->GetOriginalProfile()) { | 373   if (model->profile() == profile_->GetOriginalProfile()) { | 
| 373     registrar_.RemoveAll(); | 374     registrar_.RemoveAll(); | 
| 374     model->RemoveAutoGeneratedBetween(delete_begin_, delete_end_); | 375     model->RemoveAutoGeneratedBetween(delete_begin_, delete_end_); | 
| 375     NotifyAndDeleteIfDone(); | 376     NotifyAndDeleteIfDone(); | 
| 376   } | 377   } | 
| 377 } | 378 } | 
| 378 | 379 | 
| 379 void BrowsingDataRemover::NotifyAndDeleteIfDone() { | 380 void BrowsingDataRemover::NotifyAndDeleteIfDone() { | 
| 380   // TODO(brettw) bug 1139736: see TODO in Observe() above. | 381   // TODO(brettw) bug 1139736: see TODO in Observe() above. | 
| (...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 625 | 626 | 
| 626   ClearGearsData(profile_dir); | 627   ClearGearsData(profile_dir); | 
| 627   OnClearedGearsData(); | 628   OnClearedGearsData(); | 
| 628 } | 629 } | 
| 629 | 630 | 
| 630 void BrowsingDataRemover::OnWaitableEventSignaled( | 631 void BrowsingDataRemover::OnWaitableEventSignaled( | 
| 631     base::WaitableEvent* waitable_event) { | 632     base::WaitableEvent* waitable_event) { | 
| 632   waiting_for_clear_lso_data_ = false; | 633   waiting_for_clear_lso_data_ = false; | 
| 633   NotifyAndDeleteIfDone(); | 634   NotifyAndDeleteIfDone(); | 
| 634 } | 635 } | 
| OLD | NEW | 
|---|