OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/chromeos/drive_internals_ui.h" | 5 #include "chrome/browser/ui/webui/chromeos/drive_internals_ui.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
(...skipping 653 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
664 | 664 |
665 void DriveInternalsWebUIHandler::UpdateGCacheContentsSection() { | 665 void DriveInternalsWebUIHandler::UpdateGCacheContentsSection() { |
666 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 666 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
667 | 667 |
668 // Start updating the GCache contents section. | 668 // Start updating the GCache contents section. |
669 Profile* profile = Profile::FromWebUI(web_ui()); | 669 Profile* profile = Profile::FromWebUI(web_ui()); |
670 const base::FilePath root_path = drive::util::GetCacheRootPath(profile); | 670 const base::FilePath root_path = drive::util::GetCacheRootPath(profile); |
671 base::ListValue* gcache_contents = new base::ListValue; | 671 base::ListValue* gcache_contents = new base::ListValue; |
672 base::DictionaryValue* gcache_summary = new base::DictionaryValue; | 672 base::DictionaryValue* gcache_summary = new base::DictionaryValue; |
673 base::PostTaskWithTraitsAndReply( | 673 base::PostTaskWithTraitsAndReply( |
674 FROM_HERE, base::TaskTraits().MayBlock().WithPriority( | 674 FROM_HERE, {base::MayBlock(), base::TaskPriority::USER_VISIBLE}, |
675 base::TaskPriority::USER_VISIBLE), | |
676 base::Bind(&GetGCacheContents, root_path, gcache_contents, | 675 base::Bind(&GetGCacheContents, root_path, gcache_contents, |
677 gcache_summary), | 676 gcache_summary), |
678 base::Bind(&DriveInternalsWebUIHandler::OnGetGCacheContents, | 677 base::Bind(&DriveInternalsWebUIHandler::OnGetGCacheContents, |
679 weak_ptr_factory_.GetWeakPtr(), base::Owned(gcache_contents), | 678 weak_ptr_factory_.GetWeakPtr(), base::Owned(gcache_contents), |
680 base::Owned(gcache_summary))); | 679 base::Owned(gcache_summary))); |
681 } | 680 } |
682 | 681 |
683 void DriveInternalsWebUIHandler::UpdateFileSystemContentsSection() { | 682 void DriveInternalsWebUIHandler::UpdateFileSystemContentsSection() { |
684 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 683 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
685 | 684 |
(...skipping 18 matching lines...) Expand all Loading... |
704 } | 703 } |
705 | 704 |
706 void DriveInternalsWebUIHandler::UpdateLocalStorageUsageSection() { | 705 void DriveInternalsWebUIHandler::UpdateLocalStorageUsageSection() { |
707 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 706 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
708 | 707 |
709 // Propagate the amount of local free space in bytes. | 708 // Propagate the amount of local free space in bytes. |
710 base::FilePath home_path; | 709 base::FilePath home_path; |
711 if (PathService::Get(base::DIR_HOME, &home_path)) { | 710 if (PathService::Get(base::DIR_HOME, &home_path)) { |
712 base::DictionaryValue* local_storage_summary = new base::DictionaryValue; | 711 base::DictionaryValue* local_storage_summary = new base::DictionaryValue; |
713 base::PostTaskWithTraitsAndReply( | 712 base::PostTaskWithTraitsAndReply( |
714 FROM_HERE, base::TaskTraits().MayBlock().WithPriority( | 713 FROM_HERE, {base::MayBlock(), base::TaskPriority::USER_VISIBLE}, |
715 base::TaskPriority::USER_VISIBLE), | |
716 base::Bind(&GetFreeDiskSpace, home_path, local_storage_summary), | 714 base::Bind(&GetFreeDiskSpace, home_path, local_storage_summary), |
717 base::Bind(&DriveInternalsWebUIHandler::OnGetFreeDiskSpace, | 715 base::Bind(&DriveInternalsWebUIHandler::OnGetFreeDiskSpace, |
718 weak_ptr_factory_.GetWeakPtr(), | 716 weak_ptr_factory_.GetWeakPtr(), |
719 base::Owned(local_storage_summary))); | 717 base::Owned(local_storage_summary))); |
720 } else { | 718 } else { |
721 LOG(ERROR) << "Home directory not found"; | 719 LOG(ERROR) << "Home directory not found"; |
722 } | 720 } |
723 } | 721 } |
724 | 722 |
725 void DriveInternalsWebUIHandler::UpdateCacheContentsSection( | 723 void DriveInternalsWebUIHandler::UpdateCacheContentsSection( |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
899 content::WebUIDataSource::Create(chrome::kChromeUIDriveInternalsHost); | 897 content::WebUIDataSource::Create(chrome::kChromeUIDriveInternalsHost); |
900 source->AddResourcePath("drive_internals.css", IDR_DRIVE_INTERNALS_CSS); | 898 source->AddResourcePath("drive_internals.css", IDR_DRIVE_INTERNALS_CSS); |
901 source->AddResourcePath("drive_internals.js", IDR_DRIVE_INTERNALS_JS); | 899 source->AddResourcePath("drive_internals.js", IDR_DRIVE_INTERNALS_JS); |
902 source->SetDefaultResource(IDR_DRIVE_INTERNALS_HTML); | 900 source->SetDefaultResource(IDR_DRIVE_INTERNALS_HTML); |
903 | 901 |
904 Profile* profile = Profile::FromWebUI(web_ui); | 902 Profile* profile = Profile::FromWebUI(web_ui); |
905 content::WebUIDataSource::Add(profile, source); | 903 content::WebUIDataSource::Add(profile, source); |
906 } | 904 } |
907 | 905 |
908 } // namespace chromeos | 906 } // namespace chromeos |
OLD | NEW |