Chromium Code Reviews| 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/bind.h" | 10 #include "base/bind.h" |
| (...skipping 450 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 461 switch (next_cache_state_) { | 461 switch (next_cache_state_) { |
| 462 case STATE_CREATE_MAIN: | 462 case STATE_CREATE_MAIN: |
| 463 case STATE_CREATE_MEDIA: { | 463 case STATE_CREATE_MEDIA: { |
| 464 // Get a pointer to the cache. | 464 // Get a pointer to the cache. |
| 465 net::URLRequestContextGetter* getter = | 465 net::URLRequestContextGetter* getter = |
| 466 (next_cache_state_ == STATE_CREATE_MAIN) ? | 466 (next_cache_state_ == STATE_CREATE_MAIN) ? |
| 467 main_context_getter_ : media_context_getter_; | 467 main_context_getter_ : media_context_getter_; |
| 468 net::HttpTransactionFactory* factory = | 468 net::HttpTransactionFactory* factory = |
| 469 getter->GetURLRequestContext()->http_transaction_factory(); | 469 getter->GetURLRequestContext()->http_transaction_factory(); |
| 470 | 470 |
| 471 rv = factory->GetCache()->GetBackend(&cache_, &cache_callback_); | 471 rv = factory->GetCache()->GetBackend(&cache_, &cache_callback_); |
|
dpapad
2011/12/15 17:27:41
Could this also be replaced?
James Hawkins
2011/12/15 17:54:42
Not in this CL.
| |
| 472 next_cache_state_ = (next_cache_state_ == STATE_CREATE_MAIN) ? | 472 next_cache_state_ = (next_cache_state_ == STATE_CREATE_MAIN) ? |
| 473 STATE_DELETE_MAIN : STATE_DELETE_MEDIA; | 473 STATE_DELETE_MAIN : STATE_DELETE_MEDIA; |
| 474 break; | 474 break; |
| 475 } | 475 } |
| 476 case STATE_DELETE_MAIN: | 476 case STATE_DELETE_MAIN: |
| 477 case STATE_DELETE_MEDIA: { | 477 case STATE_DELETE_MEDIA: { |
| 478 // |cache_| can be null if it cannot be initialized. | 478 // |cache_| can be null if it cannot be initialized. |
| 479 if (cache_) { | 479 if (cache_) { |
| 480 if (delete_begin_.is_null()) { | 480 if (delete_begin_.is_null()) { |
| 481 rv = cache_->DoomAllEntries(&cache_callback_); | 481 rv = cache_->DoomAllEntries( |
| 482 base::Bind(&BrowsingDataRemover::DoClearCache, | |
| 483 base::Unretained(this))); | |
| 482 } else { | 484 } else { |
| 483 rv = cache_->DoomEntriesBetween(delete_begin_, delete_end_, | 485 rv = cache_->DoomEntriesBetween( |
| 484 &cache_callback_); | 486 delete_begin_, delete_end_, |
| 487 base::Bind(&BrowsingDataRemover::DoClearCache, | |
| 488 base::Unretained(this))); | |
| 485 } | 489 } |
| 486 cache_ = NULL; | 490 cache_ = NULL; |
| 487 } | 491 } |
| 488 next_cache_state_ = (next_cache_state_ == STATE_DELETE_MAIN) ? | 492 next_cache_state_ = (next_cache_state_ == STATE_DELETE_MAIN) ? |
| 489 STATE_CREATE_MEDIA : STATE_DONE; | 493 STATE_CREATE_MEDIA : STATE_DONE; |
| 490 break; | 494 break; |
| 491 } | 495 } |
| 492 case STATE_DONE: { | 496 case STATE_DONE: { |
| 493 cache_ = NULL; | 497 cache_ = NULL; |
| 494 | 498 |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 618 GetURLRequestContext()->cookie_store()->GetCookieMonster(); | 622 GetURLRequestContext()->cookie_store()->GetCookieMonster(); |
| 619 if (cookie_monster) { | 623 if (cookie_monster) { |
| 620 cookie_monster->DeleteAllCreatedBetweenAsync( | 624 cookie_monster->DeleteAllCreatedBetweenAsync( |
| 621 delete_begin_, delete_end_, | 625 delete_begin_, delete_end_, |
| 622 base::Bind(&BrowsingDataRemover::OnClearedCookies, | 626 base::Bind(&BrowsingDataRemover::OnClearedCookies, |
| 623 base::Unretained(this))); | 627 base::Unretained(this))); |
| 624 } else { | 628 } else { |
| 625 OnClearedCookies(0); | 629 OnClearedCookies(0); |
| 626 } | 630 } |
| 627 } | 631 } |
| OLD | NEW |