| 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 |
| (...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 203 return; | 203 return; |
| 204 | 204 |
| 205 drive::FileSystemInterface* const file_system = | 205 drive::FileSystemInterface* const file_system = |
| 206 drive::util::GetFileSystemByProfile(Profile::FromWebUI(web_ui())); | 206 drive::util::GetFileSystemByProfile(Profile::FromWebUI(web_ui())); |
| 207 if (!file_system) | 207 if (!file_system) |
| 208 return; | 208 return; |
| 209 | 209 |
| 210 // Shows the item "Offline cache" and start calculating size. | 210 // Shows the item "Offline cache" and start calculating size. |
| 211 CallJavascriptFunction("cr.webUIListenerCallback", | 211 CallJavascriptFunction("cr.webUIListenerCallback", |
| 212 base::StringValue("storage-drive-enabled-changed"), | 212 base::StringValue("storage-drive-enabled-changed"), |
| 213 base::FundamentalValue(true)); | 213 base::Value(true)); |
| 214 updating_drive_cache_size_ = true; | 214 updating_drive_cache_size_ = true; |
| 215 file_system->CalculateCacheSize( | 215 file_system->CalculateCacheSize( |
| 216 base::Bind(&StorageHandler::OnGetDriveCacheSize, base::Unretained(this))); | 216 base::Bind(&StorageHandler::OnGetDriveCacheSize, base::Unretained(this))); |
| 217 } | 217 } |
| 218 | 218 |
| 219 void StorageHandler::OnGetDriveCacheSize(int64_t size) { | 219 void StorageHandler::OnGetDriveCacheSize(int64_t size) { |
| 220 updating_drive_cache_size_ = false; | 220 updating_drive_cache_size_ = false; |
| 221 CallJavascriptFunction("cr.webUIListenerCallback", | 221 CallJavascriptFunction("cr.webUIListenerCallback", |
| 222 base::StringValue("storage-drive-cache-size-changed"), | 222 base::StringValue("storage-drive-cache-size-changed"), |
| 223 base::StringValue(ui::FormatBytes(size))); | 223 base::StringValue(ui::FormatBytes(size))); |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 347 Profile* const profile = Profile::FromWebUI(web_ui()); | 347 Profile* const profile = Profile::FromWebUI(web_ui()); |
| 348 if (!arc::ArcSessionManager::IsAllowedForProfile(profile) || | 348 if (!arc::ArcSessionManager::IsAllowedForProfile(profile) || |
| 349 arc::ArcSessionManager::IsOptInVerificationDisabled() || | 349 arc::ArcSessionManager::IsOptInVerificationDisabled() || |
| 350 !arc::ArcSessionManager::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::Value(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))); |
| 361 if (!success) | 361 if (!success) |
| 362 updating_android_size_ = false; | 362 updating_android_size_ = false; |
| 363 } | 363 } |
| 364 | 364 |
| 365 void StorageHandler::OnGetAndroidSize(bool succeeded, | 365 void StorageHandler::OnGetAndroidSize(bool succeeded, |
| 366 arc::mojom::ApplicationsSizePtr size) { | 366 arc::mojom::ApplicationsSizePtr size) { |
| 367 base::string16 size_string; | 367 base::string16 size_string; |
| (...skipping 11 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 |