summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkinaba@chromium.org <kinaba@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-11-02 08:04:01 +0000
committerkinaba@chromium.org <kinaba@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-11-02 08:04:01 +0000
commit1f233969cd4931f2e953743a3010487909c674ce (patch)
tree02b068032cdc49c201304eca2ee55590d9196b25
parent20f067e1c97ada685a266799302b72be841cc86b (diff)
downloadchromium_src-1f233969cd4931f2e953743a3010487909c674ce.zip
chromium_src-1f233969cd4931f2e953743a3010487909c674ce.tar.gz
chromium_src-1f233969cd4931f2e953743a3010487909c674ce.tar.bz2
drive: Add root directory information to chrome:drive-internals.
The root entry is not supposed to vary often, but I suspect some corruption is happening in the case of the associated bug. It would be good to have the info on the debug console page. BUG=159087 TEST=Open chrome:drive-internals and verify "File System Contents" section shows the information of "drive" entry. Review URL: https://chromiumcodereview.appspot.com/11369044 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@165640 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/ui/webui/chromeos/drive_internals_ui.cc24
1 files changed, 24 insertions, 0 deletions
diff --git a/chrome/browser/ui/webui/chromeos/drive_internals_ui.cc b/chrome/browser/ui/webui/chromeos/drive_internals_ui.cc
index 075684c..912371d 100644
--- a/chrome/browser/ui/webui/chromeos/drive_internals_ui.cc
+++ b/chrome/browser/ui/webui/chromeos/drive_internals_ui.cc
@@ -207,6 +207,11 @@ class DriveInternalsWebUIHandler : public content::WebUIMessageHandler {
void OnGetGCacheContents(base::ListValue* gcache_contents,
base::DictionaryValue* cache_summary);
+ // Called when GetEntryInfoByPath() is complete.
+ void OnGetEntryInfoByPath(const FilePath& path,
+ drive::DriveFileError error,
+ scoped_ptr<drive::DriveEntryProto> entry);
+
// Called when ReadDirectoryByPath() is complete.
void OnReadDirectoryByPath(const FilePath& parent_path,
drive::DriveFileError error,
@@ -497,6 +502,13 @@ void DriveInternalsWebUIHandler::UpdateFileSystemContentsSection(
// Start rendering the file system tree as text.
const FilePath root_path = FilePath(drive::kDriveRootDirectory);
++num_pending_reads_;
+ system_service->file_system()->GetEntryInfoByPath(
+ root_path,
+ base::Bind(&DriveInternalsWebUIHandler::OnGetEntryInfoByPath,
+ weak_ptr_factory_.GetWeakPtr(),
+ root_path));
+
+ ++num_pending_reads_;
system_service->file_system()->ReadDirectoryByPath(
root_path,
base::Bind(&DriveInternalsWebUIHandler::OnReadDirectoryByPath,
@@ -537,6 +549,18 @@ void DriveInternalsWebUIHandler::OnGetGCacheContents(
*gcache_summary);
}
+void DriveInternalsWebUIHandler::OnGetEntryInfoByPath(
+ const FilePath& path,
+ drive::DriveFileError error,
+ scoped_ptr<drive::DriveEntryProto> entry) {
+ --num_pending_reads_;
+ if (error == drive::DRIVE_FILE_OK) {
+ DCHECK(entry.get());
+ const base::StringValue value(FormatEntry(path, *entry) + "\n");
+ web_ui()->CallJavascriptFunction("updateFileSystemContents", value);
+ }
+}
+
void DriveInternalsWebUIHandler::OnReadDirectoryByPath(
const FilePath& parent_path,
drive::DriveFileError error,