Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/browsing_data_remover.h" | 5 #include "chrome/browser/browsing_data/browsing_data_remover.h" |
| 6 | 6 |
| 7 #include <set> | 7 #include <set> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 545 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 556 profile_->GetPath().AppendASCII("Local Storage"); | 556 profile_->GetPath().AppendASCII("Local Storage"); |
| 557 base::CreateDirectory(storage_path); | 557 base::CreateDirectory(storage_path); |
| 558 | 558 |
| 559 // Write some files. | 559 // Write some files. |
| 560 file_util::WriteFile(storage_path.Append(kDomStorageOrigin1), NULL, 0); | 560 file_util::WriteFile(storage_path.Append(kDomStorageOrigin1), NULL, 0); |
| 561 file_util::WriteFile(storage_path.Append(kDomStorageOrigin2), NULL, 0); | 561 file_util::WriteFile(storage_path.Append(kDomStorageOrigin2), NULL, 0); |
| 562 file_util::WriteFile(storage_path.Append(kDomStorageOrigin3), NULL, 0); | 562 file_util::WriteFile(storage_path.Append(kDomStorageOrigin3), NULL, 0); |
| 563 file_util::WriteFile(storage_path.Append(kDomStorageExt), NULL, 0); | 563 file_util::WriteFile(storage_path.Append(kDomStorageExt), NULL, 0); |
| 564 | 564 |
| 565 // Tweak their dates. | 565 // Tweak their dates. |
| 566 file_util::SetLastModifiedTime(storage_path.Append(kDomStorageOrigin1), | 566 base::Time now = base::Time::Now(); |
|
viettrungluu
2013/12/04 21:09:23
(Note that the new version isn't absolutely equiva
| |
| 567 base::Time::Now()); | 567 base::TouchFile(storage_path.Append(kDomStorageOrigin1), now, now); |
| 568 file_util::SetLastModifiedTime(storage_path.Append(kDomStorageOrigin2), | 568 |
| 569 base::Time::Now() - base::TimeDelta::FromDays(1)); | 569 base::Time one_day_ago = now - base::TimeDelta::FromDays(1); |
| 570 file_util::SetLastModifiedTime(storage_path.Append(kDomStorageOrigin3), | 570 base::TouchFile(storage_path.Append(kDomStorageOrigin2), |
| 571 base::Time::Now() - base::TimeDelta::FromDays(60)); | 571 one_day_ago, one_day_ago); |
| 572 file_util::SetLastModifiedTime(storage_path.Append(kDomStorageExt), | 572 |
| 573 base::Time::Now()); | 573 base::Time sixty_days_ago = now - base::TimeDelta::FromDays(60); |
| 574 base::TouchFile(storage_path.Append(kDomStorageOrigin3), | |
| 575 sixty_days_ago, sixty_days_ago); | |
| 576 | |
| 577 base::TouchFile(storage_path.Append(kDomStorageExt), now, now); | |
| 574 } | 578 } |
| 575 | 579 |
| 576 private: | 580 private: |
| 577 void GetLocalStorageUsage() { | 581 void GetLocalStorageUsage() { |
| 578 dom_storage_context_->GetLocalStorageUsage( | 582 dom_storage_context_->GetLocalStorageUsage( |
| 579 base::Bind(&RemoveLocalStorageTester::OnGotLocalStorageUsage, | 583 base::Bind(&RemoveLocalStorageTester::OnGotLocalStorageUsage, |
| 580 base::Unretained(this))); | 584 base::Unretained(this))); |
| 581 } | 585 } |
| 582 void OnGotLocalStorageUsage( | 586 void OnGotLocalStorageUsage( |
| 583 const std::vector<content::LocalStorageUsageInfo>& infos) { | 587 const std::vector<content::LocalStorageUsageInfo>& infos) { |
| (...skipping 1003 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1587 EXPECT_CALL(*cryptohome_client, TpmAttestationDeleteKeys(_, _, _, _)) | 1591 EXPECT_CALL(*cryptohome_client, TpmAttestationDeleteKeys(_, _, _, _)) |
| 1588 .WillOnce(WithArgs<3>(Invoke(FakeDBusCall))); | 1592 .WillOnce(WithArgs<3>(Invoke(FakeDBusCall))); |
| 1589 | 1593 |
| 1590 BlockUntilBrowsingDataRemoved( | 1594 BlockUntilBrowsingDataRemoved( |
| 1591 BrowsingDataRemover::EVERYTHING, | 1595 BrowsingDataRemover::EVERYTHING, |
| 1592 BrowsingDataRemover::REMOVE_CONTENT_LICENSES, false); | 1596 BrowsingDataRemover::REMOVE_CONTENT_LICENSES, false); |
| 1593 | 1597 |
| 1594 chromeos::DBusThreadManager::Shutdown(); | 1598 chromeos::DBusThreadManager::Shutdown(); |
| 1595 } | 1599 } |
| 1596 #endif | 1600 #endif |
| OLD | NEW |