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 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 // Called when the page is first loaded. | 163 // Called when the page is first loaded. |
164 void OnPageLoaded(const base::ListValue* args); | 164 void OnPageLoaded(const base::ListValue* args); |
165 | 165 |
166 // Called when GetGCacheContents() is complete. | 166 // Called when GetGCacheContents() is complete. |
167 void OnGetGCacheContents(base::ListValue* gcache_contents, | 167 void OnGetGCacheContents(base::ListValue* gcache_contents, |
168 base::DictionaryValue* cache_summary); | 168 base::DictionaryValue* cache_summary); |
169 | 169 |
170 // Called when ReadDirectoryByPath() is complete. | 170 // Called when ReadDirectoryByPath() is complete. |
171 void OnReadDirectoryByPath(const FilePath& parent_path, | 171 void OnReadDirectoryByPath(const FilePath& parent_path, |
172 gdata::GDataFileError error, | 172 gdata::GDataFileError error, |
173 bool hide_hosted_documents, | |
174 scoped_ptr<gdata::GDataEntryProtoVector> entries); | 173 scoped_ptr<gdata::GDataEntryProtoVector> entries); |
175 | 174 |
176 // Called when GetResourceIdsOfAllFilesOnUIThread() is complete. | 175 // Called when GetResourceIdsOfAllFilesOnUIThread() is complete. |
177 void OnGetResourceIdsOfAllFiles( | 176 void OnGetResourceIdsOfAllFiles( |
178 const std::vector<std::string>& resource_ids); | 177 const std::vector<std::string>& resource_ids); |
179 | 178 |
180 // Called when GetCacheEntryOnUIThread() is complete. | 179 // Called when GetCacheEntryOnUIThread() is complete. |
181 void OnGetCacheEntry(const std::string& resource_id, | 180 void OnGetCacheEntry(const std::string& resource_id, |
182 bool success, | 181 bool success, |
183 const gdata::GDataCacheEntry& cache_entry); | 182 const gdata::GDataCacheEntry& cache_entry); |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
256 system_service->file_system()->ReadDirectoryByPath( | 255 system_service->file_system()->ReadDirectoryByPath( |
257 root_path, | 256 root_path, |
258 base::Bind(&DriveInternalsWebUIHandler::OnReadDirectoryByPath, | 257 base::Bind(&DriveInternalsWebUIHandler::OnReadDirectoryByPath, |
259 weak_ptr_factory_.GetWeakPtr(), | 258 weak_ptr_factory_.GetWeakPtr(), |
260 root_path)); | 259 root_path)); |
261 } | 260 } |
262 | 261 |
263 void DriveInternalsWebUIHandler::OnReadDirectoryByPath( | 262 void DriveInternalsWebUIHandler::OnReadDirectoryByPath( |
264 const FilePath& parent_path, | 263 const FilePath& parent_path, |
265 gdata::GDataFileError error, | 264 gdata::GDataFileError error, |
266 bool hide_hosted_documents, | |
267 scoped_ptr<gdata::GDataEntryProtoVector> entries) { | 265 scoped_ptr<gdata::GDataEntryProtoVector> entries) { |
268 --num_pending_reads_; | 266 --num_pending_reads_; |
269 if (error == gdata::GDATA_FILE_OK) { | 267 if (error == gdata::GDATA_FILE_OK) { |
270 DCHECK(entries.get()); | 268 DCHECK(entries.get()); |
271 | 269 |
272 std::string file_system_as_text; | 270 std::string file_system_as_text; |
273 for (size_t i = 0; i < entries->size(); ++i) { | 271 for (size_t i = 0; i < entries->size(); ++i) { |
274 const gdata::GDataEntryProto& entry = (*entries)[i]; | 272 const gdata::GDataEntryProto& entry = (*entries)[i]; |
275 const FilePath current_path = parent_path.Append( | 273 const FilePath current_path = parent_path.Append( |
276 FilePath::FromUTF8Unsafe(entry.base_name())); | 274 FilePath::FromUTF8Unsafe(entry.base_name())); |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
348 new ChromeWebUIDataSource(chrome::kChromeUIDriveInternalsHost); | 346 new ChromeWebUIDataSource(chrome::kChromeUIDriveInternalsHost); |
349 source->add_resource_path("drive_internals.css", IDR_DRIVE_INTERNALS_CSS); | 347 source->add_resource_path("drive_internals.css", IDR_DRIVE_INTERNALS_CSS); |
350 source->add_resource_path("drive_internals.js", IDR_DRIVE_INTERNALS_JS); | 348 source->add_resource_path("drive_internals.js", IDR_DRIVE_INTERNALS_JS); |
351 source->set_default_resource(IDR_DRIVE_INTERNALS_HTML); | 349 source->set_default_resource(IDR_DRIVE_INTERNALS_HTML); |
352 | 350 |
353 Profile* profile = Profile::FromWebUI(web_ui); | 351 Profile* profile = Profile::FromWebUI(web_ui); |
354 ChromeURLDataManager::AddDataSource(profile, source); | 352 ChromeURLDataManager::AddDataSource(profile, source); |
355 } | 353 } |
356 | 354 |
357 } // namespace chromeos | 355 } // namespace chromeos |
OLD | NEW |