| 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/settings/chromeos/device_storage_handler.h" | 5 #include "chrome/browser/ui/webui/settings/chromeos/device_storage_handler.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <numeric> | 8 #include <numeric> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "base/files/file_util.h" | 11 #include "base/files/file_util.h" |
| 12 #include "base/sys_info.h" | 12 #include "base/sys_info.h" |
| 13 #include "chrome/browser/browser_process.h" | 13 #include "chrome/browser/browser_process.h" |
| 14 #include "chrome/browser/browsing_data/browsing_data_appcache_helper.h" | 14 #include "chrome/browser/browsing_data/browsing_data_appcache_helper.h" |
| 15 #include "chrome/browser/browsing_data/browsing_data_cache_storage_helper.h" | 15 #include "chrome/browser/browsing_data/browsing_data_cache_storage_helper.h" |
| 16 #include "chrome/browser/browsing_data/browsing_data_channel_id_helper.h" | 16 #include "chrome/browser/browsing_data/browsing_data_channel_id_helper.h" |
| 17 #include "chrome/browser/browsing_data/browsing_data_cookie_helper.h" | 17 #include "chrome/browser/browsing_data/browsing_data_cookie_helper.h" |
| 18 #include "chrome/browser/browsing_data/browsing_data_database_helper.h" | 18 #include "chrome/browser/browsing_data/browsing_data_database_helper.h" |
| 19 #include "chrome/browser/browsing_data/browsing_data_file_system_helper.h" | 19 #include "chrome/browser/browsing_data/browsing_data_file_system_helper.h" |
| 20 #include "chrome/browser/browsing_data/browsing_data_flash_lso_helper.h" | 20 #include "chrome/browser/browsing_data/browsing_data_flash_lso_helper.h" |
| 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_auth_service.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/storage_partition_http_cache_data_rem
over.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" |
| (...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 338 base::StringValue(size_string)); | 338 base::StringValue(size_string)); |
| 339 } | 339 } |
| 340 } | 340 } |
| 341 | 341 |
| 342 void StorageHandler::UpdateAndroidSize() { | 342 void StorageHandler::UpdateAndroidSize() { |
| 343 if (updating_android_size_) | 343 if (updating_android_size_) |
| 344 return; | 344 return; |
| 345 updating_android_size_ = true; | 345 updating_android_size_ = true; |
| 346 | 346 |
| 347 Profile* const profile = Profile::FromWebUI(web_ui()); | 347 Profile* const profile = Profile::FromWebUI(web_ui()); |
| 348 if (!arc::ArcAuthService::IsAllowedForProfile(profile) || | 348 if (!arc::ArcSessionManager::IsAllowedForProfile(profile) || |
| 349 arc::ArcAuthService::IsOptInVerificationDisabled() || | 349 arc::ArcSessionManager::IsOptInVerificationDisabled() || |
| 350 !arc::ArcAuthService::Get()->IsArcEnabled()) { | 350 !arc::ArcSessionManager::Get()->IsArcEnabled()) { |
| 351 return; | 351 return; |
| 352 } | 352 } |
| 353 | 353 |
| 354 // Shows the item "Android apps and cache" and start calculating size. | 354 // Shows the item "Android apps and cache" and start calculating size. |
| 355 CallJavascriptFunction("cr.webUIListenerCallback", | 355 CallJavascriptFunction("cr.webUIListenerCallback", |
| 356 base::StringValue("storage-android-enabled-changed"), | 356 base::StringValue("storage-android-enabled-changed"), |
| 357 base::FundamentalValue(true)); | 357 base::FundamentalValue(true)); |
| 358 bool success = arc::ArcStorageManager::Get()->GetApplicationsSize( | 358 bool success = arc::ArcStorageManager::Get()->GetApplicationsSize( |
| 359 base::Bind(&StorageHandler::OnGetAndroidSize, | 359 base::Bind(&StorageHandler::OnGetAndroidSize, |
| 360 base::Unretained(this))); | 360 base::Unretained(this))); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 379 base::StringValue("storage-android-size-changed"), | 379 base::StringValue("storage-android-size-changed"), |
| 380 base::StringValue(size_string)); | 380 base::StringValue(size_string)); |
| 381 } | 381 } |
| 382 | 382 |
| 383 void StorageHandler::OnClearDriveCacheDone(bool success) { | 383 void StorageHandler::OnClearDriveCacheDone(bool success) { |
| 384 UpdateDriveCacheSize(); | 384 UpdateDriveCacheSize(); |
| 385 } | 385 } |
| 386 | 386 |
| 387 } // namespace settings | 387 } // namespace settings |
| 388 } // namespace chromeos | 388 } // namespace chromeos |
| OLD | NEW |