Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(30)

Side by Side Diff: chrome/browser/browsing_data_remover.cc

Issue 7327007: Moving notification types which are chrome specific to a new header file chrome_notification_type... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/browsing_data_remover.h ('k') | chrome/browser/chromeos/boot_times_loader.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
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
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 }
OLDNEW
« no previous file with comments | « chrome/browser/browsing_data_remover.h ('k') | chrome/browser/chromeos/boot_times_loader.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698