Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(63)

Side by Side Diff: chrome/browser/ui/webui/options/chromeos/storage_manager_handler.cc

Issue 2202483002: Storage manager: Hide "Offline files" when Google Drive volume is not mounted. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2785
Patch Set: Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/browser/resources/options/chromeos/storage_manager.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 251 matching lines...) Expand 10 before | Expand all | Expand 10 after
262 void StorageManagerHandler::OnGetDownloadsSize(int64_t size) { 262 void StorageManagerHandler::OnGetDownloadsSize(int64_t size) {
263 updating_downloads_size_ = false; 263 updating_downloads_size_ = false;
264 web_ui()->CallJavascriptFunctionUnsafe( 264 web_ui()->CallJavascriptFunctionUnsafe(
265 "options.StorageManager.setDownloadsSize", 265 "options.StorageManager.setDownloadsSize",
266 base::StringValue(ui::FormatBytes(size))); 266 base::StringValue(ui::FormatBytes(size)));
267 } 267 }
268 268
269 void StorageManagerHandler::UpdateDriveCacheSize() { 269 void StorageManagerHandler::UpdateDriveCacheSize() {
270 if (updating_drive_cache_size_) 270 if (updating_drive_cache_size_)
271 return; 271 return;
272 updating_drive_cache_size_ = true;
273 272
274 drive::FileSystemInterface* const file_system = 273 drive::FileSystemInterface* const file_system =
275 drive::util::GetFileSystemByProfile(Profile::FromWebUI(web_ui())); 274 drive::util::GetFileSystemByProfile(Profile::FromWebUI(web_ui()));
275 if (!file_system)
276 return;
277
278 // Shows the item "Offline cache" and start calculating size.
279 web_ui()->CallJavascriptFunctionUnsafe(
280 "options.StorageManager.showDriveCacheItem");
281 updating_drive_cache_size_ = true;
276 file_system->CalculateCacheSize( 282 file_system->CalculateCacheSize(
277 base::Bind(&StorageManagerHandler::OnGetDriveCacheSize, 283 base::Bind(&StorageManagerHandler::OnGetDriveCacheSize,
278 weak_ptr_factory_.GetWeakPtr())); 284 weak_ptr_factory_.GetWeakPtr()));
279 } 285 }
280 286
281 void StorageManagerHandler::OnGetDriveCacheSize(int64_t size) { 287 void StorageManagerHandler::OnGetDriveCacheSize(int64_t size) {
282 updating_drive_cache_size_ = false; 288 updating_drive_cache_size_ = false;
283 web_ui()->CallJavascriptFunctionUnsafe( 289 web_ui()->CallJavascriptFunctionUnsafe(
284 "options.StorageManager.setDriveCacheSize", 290 "options.StorageManager.setDriveCacheSize",
285 base::StringValue(ui::FormatBytes(size))); 291 base::StringValue(ui::FormatBytes(size)));
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
437 web_ui()->CallJavascriptFunctionUnsafe("options.StorageManager.setArcSize", 443 web_ui()->CallJavascriptFunctionUnsafe("options.StorageManager.setArcSize",
438 base::StringValue(size_string)); 444 base::StringValue(size_string));
439 } 445 }
440 446
441 void StorageManagerHandler::OnClearDriveCacheDone(bool success) { 447 void StorageManagerHandler::OnClearDriveCacheDone(bool success) {
442 UpdateDriveCacheSize(); 448 UpdateDriveCacheSize();
443 } 449 }
444 450
445 } // namespace options 451 } // namespace options
446 } // namespace chromeos 452 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/resources/options/chromeos/storage_manager.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698