| 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 "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
| 9 #include "base/format_macros.h" | 9 #include "base/format_macros.h" |
| 10 #include "base/stringprintf.h" | 10 #include "base/stringprintf.h" |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 file_util::FileEnumerator::SHOW_SYM_LINKS); | 55 file_util::FileEnumerator::SHOW_SYM_LINKS); |
| 56 FileEnumerator enumerator(root_path, true /* recursive */, options); | 56 FileEnumerator enumerator(root_path, true /* recursive */, options); |
| 57 | 57 |
| 58 int64 total_size = 0; | 58 int64 total_size = 0; |
| 59 for (FilePath current = enumerator.Next(); !current.empty(); | 59 for (FilePath current = enumerator.Next(); !current.empty(); |
| 60 current = enumerator.Next()) { | 60 current = enumerator.Next()) { |
| 61 FileEnumerator::FindInfo find_info; | 61 FileEnumerator::FindInfo find_info; |
| 62 enumerator.GetFindInfo(&find_info); | 62 enumerator.GetFindInfo(&find_info); |
| 63 int64 size = FileEnumerator::GetFilesize(find_info); | 63 int64 size = FileEnumerator::GetFilesize(find_info); |
| 64 const bool is_directory = FileEnumerator::IsDirectory(find_info); | 64 const bool is_directory = FileEnumerator::IsDirectory(find_info); |
| 65 const bool is_symbolic_link = FileEnumerator::IsLink(find_info); | 65 const bool is_symbolic_link = |
| 66 file_util::IsLink(FileEnumerator::GetFilename(find_info)); |
| 66 const base::Time last_modified = | 67 const base::Time last_modified = |
| 67 FileEnumerator::GetLastModifiedTime(find_info); | 68 FileEnumerator::GetLastModifiedTime(find_info); |
| 68 | 69 |
| 69 base::DictionaryValue* entry = new base::DictionaryValue; | 70 base::DictionaryValue* entry = new base::DictionaryValue; |
| 70 entry->SetString("path", current.value()); | 71 entry->SetString("path", current.value()); |
| 71 // Use double instead of integer for large files. | 72 // Use double instead of integer for large files. |
| 72 entry->SetDouble("size", size); | 73 entry->SetDouble("size", size); |
| 73 entry->SetBoolean("is_directory", is_directory); | 74 entry->SetBoolean("is_directory", is_directory); |
| 74 entry->SetBoolean("is_symbolic_link", is_symbolic_link); | 75 entry->SetBoolean("is_symbolic_link", is_symbolic_link); |
| 75 entry->SetString("last_modified", | 76 entry->SetString("last_modified", |
| (...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 444 new ChromeWebUIDataSource(chrome::kChromeUIDriveInternalsHost); | 445 new ChromeWebUIDataSource(chrome::kChromeUIDriveInternalsHost); |
| 445 source->add_resource_path("drive_internals.css", IDR_DRIVE_INTERNALS_CSS); | 446 source->add_resource_path("drive_internals.css", IDR_DRIVE_INTERNALS_CSS); |
| 446 source->add_resource_path("drive_internals.js", IDR_DRIVE_INTERNALS_JS); | 447 source->add_resource_path("drive_internals.js", IDR_DRIVE_INTERNALS_JS); |
| 447 source->set_default_resource(IDR_DRIVE_INTERNALS_HTML); | 448 source->set_default_resource(IDR_DRIVE_INTERNALS_HTML); |
| 448 | 449 |
| 449 Profile* profile = Profile::FromWebUI(web_ui); | 450 Profile* profile = Profile::FromWebUI(web_ui); |
| 450 ChromeURLDataManager::AddDataSource(profile, source); | 451 ChromeURLDataManager::AddDataSource(profile, source); |
| 451 } | 452 } |
| 452 | 453 |
| 453 } // namespace chromeos | 454 } // namespace chromeos |
| OLD | NEW |