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

Side by Side Diff: chrome/browser/ui/webui/settings/chromeos/device_storage_handler.cc

Issue 2642783003: Move more utility functions to arc_util. (Closed)
Patch Set: address comments Created 3 years, 10 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
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/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_session_manager.h" 24 #include "chrome/browser/chromeos/arc/arc_session_manager.h"
25 #include "chrome/browser/chromeos/arc/arc_util.h"
25 #include "chrome/browser/chromeos/drive/file_system_util.h" 26 #include "chrome/browser/chromeos/drive/file_system_util.h"
26 #include "chrome/browser/chromeos/file_manager/path_util.h" 27 #include "chrome/browser/chromeos/file_manager/path_util.h"
27 #include "chrome/browser/platform_util.h" 28 #include "chrome/browser/platform_util.h"
28 #include "chrome/browser/profiles/profile.h" 29 #include "chrome/browser/profiles/profile.h"
29 #include "chrome/grit/generated_resources.h" 30 #include "chrome/grit/generated_resources.h"
30 #include "chromeos/cryptohome/homedir_methods.h" 31 #include "chromeos/cryptohome/homedir_methods.h"
32 #include "components/arc/arc_util.h"
31 #include "components/browsing_data/content/conditional_cache_counting_helper.h" 33 #include "components/browsing_data/content/conditional_cache_counting_helper.h"
32 #include "components/drive/chromeos/file_system_interface.h" 34 #include "components/drive/chromeos/file_system_interface.h"
33 #include "components/user_manager/user_manager.h" 35 #include "components/user_manager/user_manager.h"
34 #include "content/public/browser/browser_context.h" 36 #include "content/public/browser/browser_context.h"
35 #include "content/public/browser/browser_thread.h" 37 #include "content/public/browser/browser_thread.h"
36 #include "content/public/browser/storage_partition.h" 38 #include "content/public/browser/storage_partition.h"
37 #include "ui/base/l10n/l10n_util.h" 39 #include "ui/base/l10n/l10n_util.h"
38 #include "ui/base/text/bytes_formatting.h" 40 #include "ui/base/text/bytes_formatting.h"
39 41
40 namespace chromeos { 42 namespace chromeos {
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after
342 base::StringValue(size_string)); 344 base::StringValue(size_string));
343 } 345 }
344 } 346 }
345 347
346 void StorageHandler::UpdateAndroidSize() { 348 void StorageHandler::UpdateAndroidSize() {
347 if (updating_android_size_) 349 if (updating_android_size_)
348 return; 350 return;
349 updating_android_size_ = true; 351 updating_android_size_ = true;
350 352
351 Profile* const profile = Profile::FromWebUI(web_ui()); 353 Profile* const profile = Profile::FromWebUI(web_ui());
352 if (!arc::ArcSessionManager::IsAllowedForProfile(profile) || 354 if (!arc::IsArcAllowedForProfile(profile) ||
353 arc::ArcSessionManager::IsOptInVerificationDisabled() || 355 arc::IsArcOptInVerificationDisabled() ||
354 !arc::ArcSessionManager::Get()->IsArcEnabled()) { 356 !arc::ArcSessionManager::Get()->IsArcEnabled()) {
355 return; 357 return;
356 } 358 }
357 359
358 // Shows the item "Android apps and cache" and start calculating size. 360 // Shows the item "Android apps and cache" and start calculating size.
359 CallJavascriptFunction("cr.webUIListenerCallback", 361 CallJavascriptFunction("cr.webUIListenerCallback",
360 base::StringValue("storage-android-enabled-changed"), 362 base::StringValue("storage-android-enabled-changed"),
361 base::FundamentalValue(true)); 363 base::FundamentalValue(true));
362 bool success = arc::ArcStorageManager::Get()->GetApplicationsSize( 364 bool success = arc::ArcStorageManager::Get()->GetApplicationsSize(
363 base::Bind(&StorageHandler::OnGetAndroidSize, 365 base::Bind(&StorageHandler::OnGetAndroidSize,
(...skipping 19 matching lines...) Expand all
383 base::StringValue("storage-android-size-changed"), 385 base::StringValue("storage-android-size-changed"),
384 base::StringValue(size_string)); 386 base::StringValue(size_string));
385 } 387 }
386 388
387 void StorageHandler::OnClearDriveCacheDone(bool success) { 389 void StorageHandler::OnClearDriveCacheDone(bool success) {
388 UpdateDriveCacheSize(); 390 UpdateDriveCacheSize();
389 } 391 }
390 392
391 } // namespace settings 393 } // namespace settings
392 } // namespace chromeos 394 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/settings/chromeos/android_apps_handler.cc ('k') | chrome/browser/ui/webui/settings/md_settings_ui.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698