| 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 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 210 base::FundamentalValue(true)); | 210 base::FundamentalValue(true)); |
| 211 updating_drive_cache_size_ = true; | 211 updating_drive_cache_size_ = true; |
| 212 file_system->CalculateCacheSize( | 212 file_system->CalculateCacheSize( |
| 213 base::Bind(&StorageHandler::OnGetDriveCacheSize, base::Unretained(this))); | 213 base::Bind(&StorageHandler::OnGetDriveCacheSize, base::Unretained(this))); |
| 214 } | 214 } |
| 215 | 215 |
| 216 void StorageHandler::OnGetDriveCacheSize(int64_t size) { | 216 void StorageHandler::OnGetDriveCacheSize(int64_t size) { |
| 217 updating_drive_cache_size_ = false; | 217 updating_drive_cache_size_ = false; |
| 218 CallJavascriptFunction("cr.webUIListenerCallback", | 218 CallJavascriptFunction("cr.webUIListenerCallback", |
| 219 base::StringValue("storage-drive-cache-size-changed"), | 219 base::StringValue("storage-drive-cache-size-changed"), |
| 220 base::StringValue(ui::FormatBytes(size))); | 220 base::StringValue(ui::FormatBytes(size)), |
| 221 base::FundamentalValue(size > 0)); |
| 221 } | 222 } |
| 222 | 223 |
| 223 void StorageHandler::UpdateBrowsingDataSize() { | 224 void StorageHandler::UpdateBrowsingDataSize() { |
| 224 if (updating_browsing_data_size_) | 225 if (updating_browsing_data_size_) |
| 225 return; | 226 return; |
| 226 updating_browsing_data_size_ = true; | 227 updating_browsing_data_size_ = true; |
| 227 | 228 |
| 228 has_browser_cache_size_ = false; | 229 has_browser_cache_size_ = false; |
| 229 has_browser_site_data_size_ = false; | 230 has_browser_site_data_size_ = false; |
| 230 Profile* const profile = Profile::FromWebUI(web_ui()); | 231 Profile* const profile = Profile::FromWebUI(web_ui()); |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 380 base::StringValue("storage-android-size-changed"), | 381 base::StringValue("storage-android-size-changed"), |
| 381 base::StringValue(size_string)); | 382 base::StringValue(size_string)); |
| 382 } | 383 } |
| 383 | 384 |
| 384 void StorageHandler::OnClearDriveCacheDone(bool success) { | 385 void StorageHandler::OnClearDriveCacheDone(bool success) { |
| 385 UpdateDriveCacheSize(); | 386 UpdateDriveCacheSize(); |
| 386 } | 387 } |
| 387 | 388 |
| 388 } // namespace settings | 389 } // namespace settings |
| 389 } // namespace chromeos | 390 } // namespace chromeos |
| OLD | NEW |