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/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
10 #include "base/files/file_enumerator.h" | 10 #include "base/files/file_enumerator.h" |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 base::FileEnumerator::DIRECTORIES | | 73 base::FileEnumerator::DIRECTORIES | |
74 base::FileEnumerator::SHOW_SYM_LINKS); | 74 base::FileEnumerator::SHOW_SYM_LINKS); |
75 base::FileEnumerator enumerator(root_path, true /* recursive */, options); | 75 base::FileEnumerator enumerator(root_path, true /* recursive */, options); |
76 | 76 |
77 int64 total_size = 0; | 77 int64 total_size = 0; |
78 for (base::FilePath current = enumerator.Next(); !current.empty(); | 78 for (base::FilePath current = enumerator.Next(); !current.empty(); |
79 current = enumerator.Next()) { | 79 current = enumerator.Next()) { |
80 base::FileEnumerator::FileInfo info = enumerator.GetInfo(); | 80 base::FileEnumerator::FileInfo info = enumerator.GetInfo(); |
81 int64 size = info.GetSize(); | 81 int64 size = info.GetSize(); |
82 const bool is_directory = info.IsDirectory(); | 82 const bool is_directory = info.IsDirectory(); |
83 const bool is_symbolic_link = file_util::IsLink(info.GetName()); | 83 const bool is_symbolic_link = base::IsLink(info.GetName()); |
84 const base::Time last_modified = info.GetLastModifiedTime(); | 84 const base::Time last_modified = info.GetLastModifiedTime(); |
85 | 85 |
86 base::DictionaryValue* entry = new base::DictionaryValue; | 86 base::DictionaryValue* entry = new base::DictionaryValue; |
87 entry->SetString("path", current.value()); | 87 entry->SetString("path", current.value()); |
88 // Use double instead of integer for large files. | 88 // Use double instead of integer for large files. |
89 entry->SetDouble("size", size); | 89 entry->SetDouble("size", size); |
90 entry->SetBoolean("is_directory", is_directory); | 90 entry->SetBoolean("is_directory", is_directory); |
91 entry->SetBoolean("is_symbolic_link", is_symbolic_link); | 91 entry->SetBoolean("is_symbolic_link", is_symbolic_link); |
92 entry->SetString( | 92 entry->SetString( |
93 "last_modified", | 93 "last_modified", |
(...skipping 792 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
886 content::WebUIDataSource::Create(chrome::kChromeUIDriveInternalsHost); | 886 content::WebUIDataSource::Create(chrome::kChromeUIDriveInternalsHost); |
887 source->AddResourcePath("drive_internals.css", IDR_DRIVE_INTERNALS_CSS); | 887 source->AddResourcePath("drive_internals.css", IDR_DRIVE_INTERNALS_CSS); |
888 source->AddResourcePath("drive_internals.js", IDR_DRIVE_INTERNALS_JS); | 888 source->AddResourcePath("drive_internals.js", IDR_DRIVE_INTERNALS_JS); |
889 source->SetDefaultResource(IDR_DRIVE_INTERNALS_HTML); | 889 source->SetDefaultResource(IDR_DRIVE_INTERNALS_HTML); |
890 | 890 |
891 Profile* profile = Profile::FromWebUI(web_ui); | 891 Profile* profile = Profile::FromWebUI(web_ui); |
892 content::WebUIDataSource::Add(profile, source); | 892 content::WebUIDataSource::Add(profile, source); |
893 } | 893 } |
894 | 894 |
895 } // namespace chromeos | 895 } // namespace chromeos |
OLD | NEW |