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

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

Issue 8798001: base::Bind: Convert browsing_data_remover. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years 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') | net/disk_cache/backend_impl.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/bind.h" 10 #include "base/bind.h"
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 bool BrowsingDataRemover::removing_ = false; 66 bool BrowsingDataRemover::removing_ = false;
67 67
68 BrowsingDataRemover::BrowsingDataRemover(Profile* profile, 68 BrowsingDataRemover::BrowsingDataRemover(Profile* profile,
69 base::Time delete_begin, 69 base::Time delete_begin,
70 base::Time delete_end) 70 base::Time delete_end)
71 : profile_(profile), 71 : profile_(profile),
72 quota_manager_(NULL), 72 quota_manager_(NULL),
73 special_storage_policy_(profile->GetExtensionSpecialStoragePolicy()), 73 special_storage_policy_(profile->GetExtensionSpecialStoragePolicy()),
74 delete_begin_(delete_begin), 74 delete_begin_(delete_begin),
75 delete_end_(delete_end), 75 delete_end_(delete_end),
76 ALLOW_THIS_IN_INITIALIZER_LIST(old_cache_callback_(
77 this, &BrowsingDataRemover::DoClearCache)),
78 ALLOW_THIS_IN_INITIALIZER_LIST(cache_callback_( 76 ALLOW_THIS_IN_INITIALIZER_LIST(cache_callback_(
79 base::Bind(&BrowsingDataRemover::DoClearCache, 77 base::Bind(&BrowsingDataRemover::DoClearCache,
80 base::Unretained(this)))), 78 base::Unretained(this)))),
81 next_cache_state_(STATE_NONE), 79 next_cache_state_(STATE_NONE),
82 cache_(NULL), 80 cache_(NULL),
83 main_context_getter_(profile->GetRequestContext()), 81 main_context_getter_(profile->GetRequestContext()),
84 media_context_getter_(profile->GetRequestContextForMedia()), 82 media_context_getter_(profile->GetRequestContextForMedia()),
85 waiting_for_clear_history_(false), 83 waiting_for_clear_history_(false),
86 waiting_for_clear_quota_managed_data_(false), 84 waiting_for_clear_quota_managed_data_(false),
87 waiting_for_clear_networking_history_(false), 85 waiting_for_clear_networking_history_(false),
88 waiting_for_clear_cookies_(false), 86 waiting_for_clear_cookies_(false),
89 waiting_for_clear_cache_(false), 87 waiting_for_clear_cache_(false),
90 waiting_for_clear_lso_data_(false) { 88 waiting_for_clear_lso_data_(false) {
91 DCHECK(profile); 89 DCHECK(profile);
92 } 90 }
93 91
94 BrowsingDataRemover::BrowsingDataRemover(Profile* profile, 92 BrowsingDataRemover::BrowsingDataRemover(Profile* profile,
95 TimePeriod time_period, 93 TimePeriod time_period,
96 base::Time delete_end) 94 base::Time delete_end)
97 : profile_(profile), 95 : profile_(profile),
98 quota_manager_(NULL), 96 quota_manager_(NULL),
99 special_storage_policy_(profile->GetExtensionSpecialStoragePolicy()), 97 special_storage_policy_(profile->GetExtensionSpecialStoragePolicy()),
100 delete_begin_(CalculateBeginDeleteTime(time_period)), 98 delete_begin_(CalculateBeginDeleteTime(time_period)),
101 delete_end_(delete_end), 99 delete_end_(delete_end),
102 ALLOW_THIS_IN_INITIALIZER_LIST(old_cache_callback_(
103 this, &BrowsingDataRemover::DoClearCache)),
104 ALLOW_THIS_IN_INITIALIZER_LIST(cache_callback_( 100 ALLOW_THIS_IN_INITIALIZER_LIST(cache_callback_(
105 base::Bind(&BrowsingDataRemover::DoClearCache, 101 base::Bind(&BrowsingDataRemover::DoClearCache,
106 base::Unretained(this)))), 102 base::Unretained(this)))),
107 next_cache_state_(STATE_NONE), 103 next_cache_state_(STATE_NONE),
108 cache_(NULL), 104 cache_(NULL),
109 main_context_getter_(profile->GetRequestContext()), 105 main_context_getter_(profile->GetRequestContext()),
110 media_context_getter_(profile->GetRequestContextForMedia()), 106 media_context_getter_(profile->GetRequestContextForMedia()),
111 waiting_for_clear_history_(false), 107 waiting_for_clear_history_(false),
112 waiting_for_clear_quota_managed_data_(false), 108 waiting_for_clear_quota_managed_data_(false),
113 waiting_for_clear_networking_history_(false), 109 waiting_for_clear_networking_history_(false),
(...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after
445 rv = factory->GetCache()->GetBackend(&cache_, cache_callback_); 441 rv = factory->GetCache()->GetBackend(&cache_, cache_callback_);
446 next_cache_state_ = (next_cache_state_ == STATE_CREATE_MAIN) ? 442 next_cache_state_ = (next_cache_state_ == STATE_CREATE_MAIN) ?
447 STATE_DELETE_MAIN : STATE_DELETE_MEDIA; 443 STATE_DELETE_MAIN : STATE_DELETE_MEDIA;
448 break; 444 break;
449 } 445 }
450 case STATE_DELETE_MAIN: 446 case STATE_DELETE_MAIN:
451 case STATE_DELETE_MEDIA: { 447 case STATE_DELETE_MEDIA: {
452 // |cache_| can be null if it cannot be initialized. 448 // |cache_| can be null if it cannot be initialized.
453 if (cache_) { 449 if (cache_) {
454 if (delete_begin_.is_null()) { 450 if (delete_begin_.is_null()) {
455 rv = cache_->DoomAllEntries(&old_cache_callback_); 451 rv = cache_->DoomAllEntries(cache_callback_);
456 } else { 452 } else {
457 rv = cache_->DoomEntriesBetween(delete_begin_, delete_end_, 453 rv = cache_->DoomEntriesBetween(delete_begin_, delete_end_,
458 &old_cache_callback_); 454 cache_callback_);
459 } 455 }
460 cache_ = NULL; 456 cache_ = NULL;
461 } 457 }
462 next_cache_state_ = (next_cache_state_ == STATE_DELETE_MAIN) ? 458 next_cache_state_ = (next_cache_state_ == STATE_DELETE_MAIN) ?
463 STATE_CREATE_MEDIA : STATE_DONE; 459 STATE_CREATE_MEDIA : STATE_DONE;
464 break; 460 break;
465 } 461 }
466 case STATE_DONE: { 462 case STATE_DONE: {
467 cache_ = NULL; 463 cache_ = NULL;
468 464
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
592 GetURLRequestContext()->cookie_store()->GetCookieMonster(); 588 GetURLRequestContext()->cookie_store()->GetCookieMonster();
593 if (cookie_monster) { 589 if (cookie_monster) {
594 cookie_monster->DeleteAllCreatedBetweenAsync( 590 cookie_monster->DeleteAllCreatedBetweenAsync(
595 delete_begin_, delete_end_, 591 delete_begin_, delete_end_,
596 base::Bind(&BrowsingDataRemover::OnClearedCookies, 592 base::Bind(&BrowsingDataRemover::OnClearedCookies,
597 base::Unretained(this))); 593 base::Unretained(this)));
598 } else { 594 } else {
599 OnClearedCookies(0); 595 OnClearedCookies(0);
600 } 596 }
601 } 597 }
OLDNEW
« no previous file with comments | « chrome/browser/browsing_data_remover.h ('k') | net/disk_cache/backend_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698