Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(546)

Unified Diff: chrome/browser/chromeos/extensions/file_manager_util.cc

Issue 9720020: [COPY] - Implemented API for tracking ongoing file transfers from file manager. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/chromeos/extensions/file_manager_util.h ('k') | chrome/browser/chromeos/gdata/gdata.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/chromeos/extensions/file_manager_util.cc
===================================================================
--- chrome/browser/chromeos/extensions/file_manager_util.cc (revision 127341)
+++ chrome/browser/chromeos/extensions/file_manager_util.cc (working copy)
@@ -12,6 +12,7 @@
#include "base/utf_string_conversions.h"
#include "base/values.h"
#include "chrome/browser/chromeos/extensions/file_handler_util.h"
+#include "chrome/browser/chromeos/gdata/gdata_operation_registry.h"
#include "chrome/browser/extensions/crx_installer.h"
#include "chrome/browser/extensions/extension_install_ui.h"
#include "chrome/browser/extensions/extension_service.h"
@@ -40,14 +41,17 @@
#include "chrome/browser/chromeos/media/media_player.h"
#endif
+using base::DictionaryValue;
+using base::ListValue;
using content::BrowserContext;
using content::BrowserThread;
using content::PluginService;
using content::UserMetricsAction;
using file_handler_util::FileTaskExecutor;
+using gdata::GDataOperationRegistry;
-#define FILEBROWSER_DOMAIN "hhaomjibdihmijegdhdafkllkbggdgoj"
-const char kFileBrowserDomain[] = FILEBROWSER_DOMAIN;
+#define FILEBROWSER_EXTENSON_ID "hhaomjibdihmijegdhdafkllkbggdgoj"
+const char kFileBrowserDomain[] = FILEBROWSER_EXTENSON_ID;
const char kFileBrowserGalleryTaskId[] = "gallery";
const char kFileBrowserMountArchiveTaskId[] = "mount-archive";
@@ -56,7 +60,7 @@
namespace {
#define FILEBROWSER_URL(PATH) \
- ("chrome-extension://" FILEBROWSER_DOMAIN "/" PATH)
+ ("chrome-extension://" FILEBROWSER_EXTENSON_ID "/" PATH)
// This is the "well known" url for the file manager extension from
// browser/resources/file_manager. In the future we may provide a way to swap
// out this file manager for an aftermarket part, but not yet.
@@ -65,7 +69,7 @@
const char kMediaPlayerUrl[] = FILEBROWSER_URL("mediaplayer.html");
const char kMediaPlayerPlaylistUrl[] = FILEBROWSER_URL("playlist.html");
#undef FILEBROWSER_URL
-#undef FILEBROWSER_DOMAIN
+#undef FILEBROWSER_EXTENSON_ID
const char kCRXExtension[] = ".crx";
const char kPdfExtension[] = ".pdf";
@@ -164,6 +168,29 @@
return type_str;
}
+DictionaryValue* ProgessStatusToDictionaryValue(
+ Profile* profile,
+ const GURL& origin_url,
+ const GDataOperationRegistry::ProgressStatus& status) {
+ scoped_ptr<DictionaryValue> result(new DictionaryValue());
+ GURL file_url;
+ if (file_manager_util::ConvertFileToFileSystemUrl(profile,
+ FilePath(status.file_path),
+ origin_url,
+ &file_url)) {
+ result->SetString("fileUrl", file_url.spec());
+ }
+
+ result->SetString("transferState",
+ GDataOperationRegistry::OperationTransferStateToString(
+ status.transfer_state));
+ result->SetString("transferType",
+ GDataOperationRegistry::OperationTypeToString(status.operation_type));
+ result->SetInteger("processed", static_cast<int>(status.progress_current));
+ result->SetInteger("total", static_cast<int>(status.progress_total));
+ return result.release();
+}
+
} // namespace
GURL GetFileBrowserExtensionUrl() {
@@ -495,4 +522,18 @@
return plugin_prefs->IsPluginEnabled(plugin);
}
+ListValue* ProgressStatusVectorToListValue(
+ Profile* profile, const GURL& origin_url,
+ const std::vector<GDataOperationRegistry::ProgressStatus>& list) {
+ scoped_ptr<ListValue> result_list(new ListValue());
+ for (std::vector<
+ GDataOperationRegistry::ProgressStatus>::const_iterator iter =
+ list.begin();
+ iter != list.end(); ++iter) {
+ result_list->Append(
+ ProgessStatusToDictionaryValue(profile, origin_url, *iter));
+ }
+ return result_list.release();
+}
+
} // namespace file_manager_util
« no previous file with comments | « chrome/browser/chromeos/extensions/file_manager_util.h ('k') | chrome/browser/chromeos/gdata/gdata.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698