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 |
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 "base/task_scheduler/post_task.h" | 13 #include "base/task_scheduler/post_task.h" |
14 #include "chrome/browser/browser_process.h" | 14 #include "chrome/browser/browser_process.h" |
15 #include "chrome/browser/browsing_data/browsing_data_appcache_helper.h" | 15 #include "chrome/browser/browsing_data/browsing_data_appcache_helper.h" |
16 #include "chrome/browser/browsing_data/browsing_data_cache_storage_helper.h" | 16 #include "chrome/browser/browsing_data/browsing_data_cache_storage_helper.h" |
17 #include "chrome/browser/browsing_data/browsing_data_channel_id_helper.h" | 17 #include "chrome/browser/browsing_data/browsing_data_channel_id_helper.h" |
18 #include "chrome/browser/browsing_data/browsing_data_cookie_helper.h" | 18 #include "chrome/browser/browsing_data/browsing_data_cookie_helper.h" |
19 #include "chrome/browser/browsing_data/browsing_data_database_helper.h" | 19 #include "chrome/browser/browsing_data/browsing_data_database_helper.h" |
20 #include "chrome/browser/browsing_data/browsing_data_file_system_helper.h" | 20 #include "chrome/browser/browsing_data/browsing_data_file_system_helper.h" |
21 #include "chrome/browser/browsing_data/browsing_data_flash_lso_helper.h" | 21 #include "chrome/browser/browsing_data/browsing_data_flash_lso_helper.h" |
22 #include "chrome/browser/browsing_data/browsing_data_indexed_db_helper.h" | 22 #include "chrome/browser/browsing_data/browsing_data_indexed_db_helper.h" |
23 #include "chrome/browser/browsing_data/browsing_data_local_storage_helper.h" | 23 #include "chrome/browser/browsing_data/browsing_data_local_storage_helper.h" |
24 #include "chrome/browser/browsing_data/browsing_data_service_worker_helper.h" | 24 #include "chrome/browser/browsing_data/browsing_data_service_worker_helper.h" |
25 #include "chrome/browser/chromeos/arc/arc_session_manager.h" | |
26 #include "chrome/browser/chromeos/arc/arc_util.h" | 25 #include "chrome/browser/chromeos/arc/arc_util.h" |
27 #include "chrome/browser/chromeos/drive/file_system_util.h" | 26 #include "chrome/browser/chromeos/drive/file_system_util.h" |
28 #include "chrome/browser/chromeos/file_manager/path_util.h" | 27 #include "chrome/browser/chromeos/file_manager/path_util.h" |
29 #include "chrome/browser/platform_util.h" | 28 #include "chrome/browser/platform_util.h" |
30 #include "chrome/browser/profiles/profile.h" | 29 #include "chrome/browser/profiles/profile.h" |
31 #include "chrome/grit/generated_resources.h" | 30 #include "chrome/grit/generated_resources.h" |
32 #include "chromeos/cryptohome/homedir_methods.h" | 31 #include "chromeos/cryptohome/homedir_methods.h" |
33 #include "components/arc/arc_util.h" | 32 #include "components/arc/arc_util.h" |
34 #include "components/browsing_data/content/conditional_cache_counting_helper.h" | 33 #include "components/browsing_data/content/conditional_cache_counting_helper.h" |
35 #include "components/drive/chromeos/file_system_interface.h" | 34 #include "components/drive/chromeos/file_system_interface.h" |
(...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
408 base::StringValue(size_string)); | 407 base::StringValue(size_string)); |
409 } | 408 } |
410 } | 409 } |
411 | 410 |
412 void StorageManagerHandler::UpdateArcSize() { | 411 void StorageManagerHandler::UpdateArcSize() { |
413 if (updating_arc_size_) | 412 if (updating_arc_size_) |
414 return; | 413 return; |
415 updating_arc_size_ = true; | 414 updating_arc_size_ = true; |
416 | 415 |
417 Profile* const profile = Profile::FromWebUI(web_ui()); | 416 Profile* const profile = Profile::FromWebUI(web_ui()); |
418 if (!arc::IsArcAllowedForProfile(profile) || | 417 if (!arc::IsArcPlayStoreEnabledForProfile(profile) || |
419 arc::IsArcOptInVerificationDisabled() || | 418 arc::IsArcOptInVerificationDisabled()) { |
420 !arc::ArcSessionManager::Get()->IsArcPlayStoreEnabled()) { | |
421 return; | 419 return; |
422 } | 420 } |
423 | 421 |
424 // Shows the item "Android apps and cache" and start calculating size. | 422 // Shows the item "Android apps and cache" and start calculating size. |
425 web_ui()->CallJavascriptFunctionUnsafe( | 423 web_ui()->CallJavascriptFunctionUnsafe( |
426 "options.StorageManager.showArcItem"); | 424 "options.StorageManager.showArcItem"); |
427 bool success = arc::ArcStorageManager::Get()->GetApplicationsSize( | 425 bool success = arc::ArcStorageManager::Get()->GetApplicationsSize( |
428 base::Bind(&StorageManagerHandler::OnGetArcSize, | 426 base::Bind(&StorageManagerHandler::OnGetArcSize, |
429 weak_ptr_factory_.GetWeakPtr())); | 427 weak_ptr_factory_.GetWeakPtr())); |
430 if (!success) | 428 if (!success) |
(...skipping 16 matching lines...) Expand all Loading... |
447 web_ui()->CallJavascriptFunctionUnsafe("options.StorageManager.setArcSize", | 445 web_ui()->CallJavascriptFunctionUnsafe("options.StorageManager.setArcSize", |
448 base::StringValue(size_string)); | 446 base::StringValue(size_string)); |
449 } | 447 } |
450 | 448 |
451 void StorageManagerHandler::OnClearDriveCacheDone(bool success) { | 449 void StorageManagerHandler::OnClearDriveCacheDone(bool success) { |
452 UpdateDriveCacheSize(); | 450 UpdateDriveCacheSize(); |
453 } | 451 } |
454 | 452 |
455 } // namespace options | 453 } // namespace options |
456 } // namespace chromeos | 454 } // namespace chromeos |
OLD | NEW |