| 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 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 | 173 |
| 174 // Called when the page is first loaded. | 174 // Called when the page is first loaded. |
| 175 void OnPageLoaded(const base::ListValue* args); | 175 void OnPageLoaded(const base::ListValue* args); |
| 176 | 176 |
| 177 // Called when GetGCacheContents() is complete. | 177 // Called when GetGCacheContents() is complete. |
| 178 void OnGetGCacheContents(base::ListValue* gcache_contents, | 178 void OnGetGCacheContents(base::ListValue* gcache_contents, |
| 179 base::DictionaryValue* cache_summary); | 179 base::DictionaryValue* cache_summary); |
| 180 | 180 |
| 181 // Called when ReadDirectoryByPath() is complete. | 181 // Called when ReadDirectoryByPath() is complete. |
| 182 void OnReadDirectoryByPath(const FilePath& parent_path, | 182 void OnReadDirectoryByPath(const FilePath& parent_path, |
| 183 gdata::GDataFileError error, | 183 gdata::DriveFileError error, |
| 184 bool hide_hosted_documents, | 184 bool hide_hosted_documents, |
| 185 scoped_ptr<gdata::DriveEntryProtoVector> entries); | 185 scoped_ptr<gdata::DriveEntryProtoVector> entries); |
| 186 | 186 |
| 187 // Called when GetResourceIdsOfAllFilesOnUIThread() is complete. | 187 // Called when GetResourceIdsOfAllFilesOnUIThread() is complete. |
| 188 void OnGetResourceIdsOfAllFiles( | 188 void OnGetResourceIdsOfAllFiles( |
| 189 const std::vector<std::string>& resource_ids); | 189 const std::vector<std::string>& resource_ids); |
| 190 | 190 |
| 191 // Called when GetCacheEntryOnUIThread() is complete. | 191 // Called when GetCacheEntryOnUIThread() is complete. |
| 192 void OnGetCacheEntry(const std::string& resource_id, | 192 void OnGetCacheEntry(const std::string& resource_id, |
| 193 bool success, | 193 bool success, |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 284 ++num_pending_reads_; | 284 ++num_pending_reads_; |
| 285 system_service->file_system()->ReadDirectoryByPath( | 285 system_service->file_system()->ReadDirectoryByPath( |
| 286 root_path, | 286 root_path, |
| 287 base::Bind(&DriveInternalsWebUIHandler::OnReadDirectoryByPath, | 287 base::Bind(&DriveInternalsWebUIHandler::OnReadDirectoryByPath, |
| 288 weak_ptr_factory_.GetWeakPtr(), | 288 weak_ptr_factory_.GetWeakPtr(), |
| 289 root_path)); | 289 root_path)); |
| 290 } | 290 } |
| 291 | 291 |
| 292 void DriveInternalsWebUIHandler::OnReadDirectoryByPath( | 292 void DriveInternalsWebUIHandler::OnReadDirectoryByPath( |
| 293 const FilePath& parent_path, | 293 const FilePath& parent_path, |
| 294 gdata::GDataFileError error, | 294 gdata::DriveFileError error, |
| 295 bool hide_hosted_documents, | 295 bool hide_hosted_documents, |
| 296 scoped_ptr<gdata::DriveEntryProtoVector> entries) { | 296 scoped_ptr<gdata::DriveEntryProtoVector> entries) { |
| 297 --num_pending_reads_; | 297 --num_pending_reads_; |
| 298 if (error == gdata::GDATA_FILE_OK) { | 298 if (error == gdata::DRIVE_FILE_OK) { |
| 299 DCHECK(entries.get()); | 299 DCHECK(entries.get()); |
| 300 | 300 |
| 301 std::string file_system_as_text; | 301 std::string file_system_as_text; |
| 302 for (size_t i = 0; i < entries->size(); ++i) { | 302 for (size_t i = 0; i < entries->size(); ++i) { |
| 303 const gdata::DriveEntryProto& entry = (*entries)[i]; | 303 const gdata::DriveEntryProto& entry = (*entries)[i]; |
| 304 const FilePath current_path = parent_path.Append( | 304 const FilePath current_path = parent_path.Append( |
| 305 FilePath::FromUTF8Unsafe(entry.base_name())); | 305 FilePath::FromUTF8Unsafe(entry.base_name())); |
| 306 | 306 |
| 307 file_system_as_text.append(FormatEntry(current_path, entry) + "\n"); | 307 file_system_as_text.append(FormatEntry(current_path, entry) + "\n"); |
| 308 | 308 |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 386 new ChromeWebUIDataSource(chrome::kChromeUIDriveInternalsHost); | 386 new ChromeWebUIDataSource(chrome::kChromeUIDriveInternalsHost); |
| 387 source->add_resource_path("drive_internals.css", IDR_DRIVE_INTERNALS_CSS); | 387 source->add_resource_path("drive_internals.css", IDR_DRIVE_INTERNALS_CSS); |
| 388 source->add_resource_path("drive_internals.js", IDR_DRIVE_INTERNALS_JS); | 388 source->add_resource_path("drive_internals.js", IDR_DRIVE_INTERNALS_JS); |
| 389 source->set_default_resource(IDR_DRIVE_INTERNALS_HTML); | 389 source->set_default_resource(IDR_DRIVE_INTERNALS_HTML); |
| 390 | 390 |
| 391 Profile* profile = Profile::FromWebUI(web_ui); | 391 Profile* profile = Profile::FromWebUI(web_ui); |
| 392 ChromeURLDataManager::AddDataSource(profile, source); | 392 ChromeURLDataManager::AddDataSource(profile, source); |
| 393 } | 393 } |
| 394 | 394 |
| 395 } // namespace chromeos | 395 } // namespace chromeos |
| OLD | NEW |