OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/ui/webui/options/chromeos/storage_manager_handler.h" | 5 #include "chrome/browser/ui/webui/options/chromeos/storage_manager_handler.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <numeric> | 8 #include <numeric> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 10 matching lines...) Expand all Loading... |
21 #include "chrome/browser/browsing_data/browsing_data_indexed_db_helper.h" | 21 #include "chrome/browser/browsing_data/browsing_data_indexed_db_helper.h" |
22 #include "chrome/browser/browsing_data/browsing_data_local_storage_helper.h" | 22 #include "chrome/browser/browsing_data/browsing_data_local_storage_helper.h" |
23 #include "chrome/browser/browsing_data/browsing_data_service_worker_helper.h" | 23 #include "chrome/browser/browsing_data/browsing_data_service_worker_helper.h" |
24 #include "chrome/browser/chromeos/arc/arc_session_manager.h" | 24 #include "chrome/browser/chromeos/arc/arc_session_manager.h" |
25 #include "chrome/browser/chromeos/drive/file_system_util.h" | 25 #include "chrome/browser/chromeos/drive/file_system_util.h" |
26 #include "chrome/browser/chromeos/file_manager/path_util.h" | 26 #include "chrome/browser/chromeos/file_manager/path_util.h" |
27 #include "chrome/browser/platform_util.h" | 27 #include "chrome/browser/platform_util.h" |
28 #include "chrome/browser/profiles/profile.h" | 28 #include "chrome/browser/profiles/profile.h" |
29 #include "chrome/grit/generated_resources.h" | 29 #include "chrome/grit/generated_resources.h" |
30 #include "chromeos/cryptohome/homedir_methods.h" | 30 #include "chromeos/cryptohome/homedir_methods.h" |
31 #include "components/browsing_data/content/storage_partition_http_cache_data_rem
over.h" | 31 #include "components/browsing_data/content/conditional_cache_counting_helper.h" |
32 #include "components/drive/chromeos/file_system_interface.h" | 32 #include "components/drive/chromeos/file_system_interface.h" |
33 #include "components/user_manager/user_manager.h" | 33 #include "components/user_manager/user_manager.h" |
34 #include "content/public/browser/browser_context.h" | 34 #include "content/public/browser/browser_context.h" |
35 #include "content/public/browser/browser_thread.h" | 35 #include "content/public/browser/browser_thread.h" |
36 #include "content/public/browser/storage_partition.h" | 36 #include "content/public/browser/storage_partition.h" |
37 #include "ui/base/l10n/l10n_util.h" | 37 #include "ui/base/l10n/l10n_util.h" |
38 #include "ui/base/text/bytes_formatting.h" | 38 #include "ui/base/text/bytes_formatting.h" |
39 | 39 |
40 namespace chromeos { | 40 namespace chromeos { |
41 namespace options { | 41 namespace options { |
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
293 | 293 |
294 void StorageManagerHandler::UpdateBrowsingDataSize() { | 294 void StorageManagerHandler::UpdateBrowsingDataSize() { |
295 if (updating_browsing_data_size_) | 295 if (updating_browsing_data_size_) |
296 return; | 296 return; |
297 updating_browsing_data_size_ = true; | 297 updating_browsing_data_size_ = true; |
298 | 298 |
299 has_browser_cache_size_ = false; | 299 has_browser_cache_size_ = false; |
300 has_browser_site_data_size_ = false; | 300 has_browser_site_data_size_ = false; |
301 Profile* const profile = Profile::FromWebUI(web_ui()); | 301 Profile* const profile = Profile::FromWebUI(web_ui()); |
302 // Fetch the size of http cache in browsing data. | 302 // Fetch the size of http cache in browsing data. |
303 // StoragePartitionHttpCacheDataRemover deletes itself when it is done. | 303 // ConditionalCacheCountingHelper deletes itself when it is done. |
304 browsing_data::StoragePartitionHttpCacheDataRemover::CreateForRange( | 304 browsing_data::ConditionalCacheCountingHelper::CreateForRange( |
305 content::BrowserContext::GetDefaultStoragePartition(profile), | 305 content::BrowserContext::GetDefaultStoragePartition(profile), |
306 base::Time(), | 306 base::Time(), base::Time::Max()) |
307 base::Time::Max())->Count( | 307 ->CountAndDestroySelfWhenFinished( |
308 base::Bind(&StorageManagerHandler::OnGetBrowsingDataSize, | 308 base::Bind(&StorageManagerHandler::OnGetBrowsingDataSize, |
309 weak_ptr_factory_.GetWeakPtr(), false)); | 309 weak_ptr_factory_.GetWeakPtr(), false)); |
310 | 310 |
311 // Fetch the size of site data in browsing data. | 311 // Fetch the size of site data in browsing data. |
312 if (!site_data_size_collector_.get()) { | 312 if (!site_data_size_collector_.get()) { |
313 content::StoragePartition* storage_partition = | 313 content::StoragePartition* storage_partition = |
314 content::BrowserContext::GetDefaultStoragePartition(profile); | 314 content::BrowserContext::GetDefaultStoragePartition(profile); |
315 site_data_size_collector_.reset(new SiteDataSizeCollector( | 315 site_data_size_collector_.reset(new SiteDataSizeCollector( |
316 storage_partition->GetPath(), | 316 storage_partition->GetPath(), |
317 new BrowsingDataCookieHelper(profile->GetRequestContext()), | 317 new BrowsingDataCookieHelper(profile->GetRequestContext()), |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
443 web_ui()->CallJavascriptFunctionUnsafe("options.StorageManager.setArcSize", | 443 web_ui()->CallJavascriptFunctionUnsafe("options.StorageManager.setArcSize", |
444 base::StringValue(size_string)); | 444 base::StringValue(size_string)); |
445 } | 445 } |
446 | 446 |
447 void StorageManagerHandler::OnClearDriveCacheDone(bool success) { | 447 void StorageManagerHandler::OnClearDriveCacheDone(bool success) { |
448 UpdateDriveCacheSize(); | 448 UpdateDriveCacheSize(); |
449 } | 449 } |
450 | 450 |
451 } // namespace options | 451 } // namespace options |
452 } // namespace chromeos | 452 } // namespace chromeos |
OLD | NEW |