summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorzelidrag@chromium.org <zelidrag@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-03-16 04:51:52 +0000
committerzelidrag@chromium.org <zelidrag@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-03-16 04:51:52 +0000
commit021c8ac52a41d2214b29f16820fbb07a3db330e9 (patch)
treeb6a8a7e2e90097c09f7f57a30e18b8ecbc1d5a3e
parenta2b2f841191849ded26bbd1ef597954a4f4bb8a6 (diff)
downloadchromium_src-021c8ac52a41d2214b29f16820fbb07a3db330e9.zip
chromium_src-021c8ac52a41d2214b29f16820fbb07a3db330e9.tar.gz
chromium_src-021c8ac52a41d2214b29f16820fbb07a3db330e9.tar.bz2
Implemented API for tracking ongoing file transfers from file manager.
new method: chrome.fileManagerPrivate.getFileTransfers(function(transfers) { }); new event: chrome.fileManagerPrivate.onFileTransfersUpdated.addListener(function(transfers) { }); where: transfers = [ { 'fileUrl': 'filesystem://.../external/gdata/myfile.txt', 'transferState': 'started|in_progress|completed|failed', 'transferType': 'upload|download', 'processed': 1234, 'total': 54331 }, ... ] BUG=chromium-os:27819 TEST=none Review URL: https://chromiumcodereview.appspot.com/9703042 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@127107 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/chromeos/extensions/file_browser_event_router.cc58
-rw-r--r--chrome/browser/chromeos/extensions/file_browser_event_router.h21
-rw-r--r--chrome/browser/chromeos/extensions/file_browser_private_api.cc30
-rw-r--r--chrome/browser/chromeos/extensions/file_browser_private_api.h16
-rw-r--r--chrome/browser/chromeos/extensions/file_manager_util.cc49
-rw-r--r--chrome/browser/chromeos/extensions/file_manager_util.h11
-rw-r--r--chrome/browser/chromeos/gdata/gdata.cc4
-rw-r--r--chrome/browser/chromeos/gdata/gdata.h4
-rw-r--r--chrome/browser/chromeos/gdata/gdata_file_system.cc17
-rw-r--r--chrome/browser/chromeos/gdata/gdata_file_system.h8
-rw-r--r--chrome/browser/chromeos/gdata/gdata_mock.h1
-rw-r--r--chrome/browser/chromeos/login/login_utils.cc5
-rw-r--r--chrome/browser/extensions/extension_event_names.cc2
-rw-r--r--chrome/browser/extensions/extension_event_names.h1
-rw-r--r--chrome/browser/net/gaia/gaia_oauth_fetcher.cc15
-rw-r--r--chrome/browser/resources/file_manager/js/directory_model.js7
-rw-r--r--chrome/common/extensions/api/fileBrowserPrivate.json62
17 files changed, 299 insertions, 12 deletions
diff --git a/chrome/browser/chromeos/extensions/file_browser_event_router.cc b/chrome/browser/chromeos/extensions/file_browser_event_router.cc
index e16ff38..ee14ea5 100644
--- a/chrome/browser/chromeos/extensions/file_browser_event_router.cc
+++ b/chrome/browser/chromeos/extensions/file_browser_event_router.cc
@@ -16,6 +16,8 @@
#include "chrome/browser/extensions/extension_event_router.h"
#include "chrome/browser/extensions/extension_service.h"
#include "chrome/browser/profiles/profile.h"
+#include "chrome/common/chrome_notification_types.h"
+#include "content/public/browser/notification_source.h"
#include "grit/generated_resources.h"
#include "webkit/fileapi/file_system_types.h"
#include "webkit/fileapi/file_system_util.h"
@@ -78,6 +80,9 @@ ExtensionFileBrowserEventRouter::ExtensionFileBrowserEventRouter(
: delegate_(new ExtensionFileBrowserEventRouter::FileWatcherDelegate(this)),
notifications_(new FileBrowserNotifications(profile)),
profile_(profile) {
+ registrar_.Add(this,
+ chrome::NOTIFICATION_PROFILE_DESTROYED,
+ content::Source<Profile>(profile_));
}
ExtensionFileBrowserEventRouter::~ExtensionFileBrowserEventRouter() {
@@ -92,17 +97,41 @@ ExtensionFileBrowserEventRouter::~ExtensionFileBrowserEventRouter() {
DiskMountManager::GetInstance()->RemoveObserver(this);
}
+void ExtensionFileBrowserEventRouter::Observe(
+ int type,
+ const content::NotificationSource& source,
+ const content::NotificationDetails& details) {
+ if (chrome::NOTIFICATION_PROFILE_DESTROYED == type) {
+ gdata::GDataFileSystem* file_system =
+ gdata::GDataFileSystemFactory::GetForProfile(profile_);
+ if (!file_system) {
+ NOTREACHED();
+ return;
+ }
+ file_system->RemoveOperationObserver(this);
+ }
+}
+
void ExtensionFileBrowserEventRouter::ObserveFileSystemEvents() {
if (!profile_) {
NOTREACHED();
return;
}
- if (chromeos::UserManager::Get()->IsUserLoggedIn()) {
- DiskMountManager* disk_mount_manager = DiskMountManager::GetInstance();
- disk_mount_manager->RemoveObserver(this);
- disk_mount_manager->AddObserver(this);
- disk_mount_manager->RequestMountInfoRefresh();
+ if (!chromeos::UserManager::Get()->IsUserLoggedIn())
+ return;
+
+ DiskMountManager* disk_mount_manager = DiskMountManager::GetInstance();
+ disk_mount_manager->RemoveObserver(this);
+ disk_mount_manager->AddObserver(this);
+ disk_mount_manager->RequestMountInfoRefresh();
+
+ gdata::GDataFileSystem* file_system =
+ gdata::GDataFileSystemFactory::GetForProfile(profile_);
+ if (!file_system) {
+ NOTREACHED();
+ return;
}
+ file_system->AddOperationObserver(this);
}
// File watch setup routines.
@@ -202,6 +231,25 @@ void ExtensionFileBrowserEventRouter::MountCompleted(
}
}
+void ExtensionFileBrowserEventRouter::OnProgressUpdate(
+ const std::vector<gdata::GDataOperationRegistry::ProgressStatus>& list) {
+ scoped_ptr<ListValue> event_list(
+ file_manager_util::ProgressStatusVectorToListValue(
+ profile_,
+ file_manager_util::GetFileBrowserExtensionUrl().GetOrigin(),
+ list));
+
+ std::string args_json;
+ base::JSONWriter::Write(event_list.get(),
+ &args_json);
+
+ profile_->GetExtensionEventRouter()->DispatchEventToExtension(
+ std::string(kFileBrowserDomain),
+ extension_event_names::kOnFileTransfersUpdated, args_json,
+ NULL, GURL());
+}
+
+
void ExtensionFileBrowserEventRouter::HandleFileWatchNotification(
const FilePath& local_path, bool got_error) {
base::AutoLock lock(lock_);
diff --git a/chrome/browser/chromeos/extensions/file_browser_event_router.h b/chrome/browser/chromeos/extensions/file_browser_event_router.h
index e546455..1a4948d 100644
--- a/chrome/browser/chromeos/extensions/file_browser_event_router.h
+++ b/chrome/browser/chromeos/extensions/file_browser_event_router.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -16,6 +16,10 @@
#include "base/string16.h"
#include "base/synchronization/lock.h"
#include "chrome/browser/chromeos/disks/disk_mount_manager.h"
+#include "chrome/browser/chromeos/gdata/gdata_file_system.h"
+#include "chrome/browser/chromeos/gdata/gdata_operation_registry.h"
+#include "content/public/browser/notification_observer.h"
+#include "content/public/browser/notification_registrar.h"
class FileBrowserNotifications;
class Profile;
@@ -23,7 +27,9 @@ class Profile;
// Used to monitor disk mount changes and signal when new mounted usb device is
// found.
class ExtensionFileBrowserEventRouter
- : public chromeos::disks::DiskMountManager::Observer {
+ : public chromeos::disks::DiskMountManager::Observer,
+ public gdata::GDataOperationRegistry::Observer,
+ public content::NotificationObserver {
public:
explicit ExtensionFileBrowserEventRouter(Profile* profile);
virtual ~ExtensionFileBrowserEventRouter();
@@ -50,6 +56,11 @@ class ExtensionFileBrowserEventRouter
const chromeos::disks::DiskMountManager::MountPointInfo& mount_info)
OVERRIDE;
+ // GDataOperationRegistry::Observer overrides.
+ virtual void OnProgressUpdate(
+ const std::vector<gdata::GDataOperationRegistry::ProgressStatus>& list)
+ OVERRIDE;
+
private:
// Helper class for passing through file watch notification events.
class FileWatcherDelegate : public base::files::FilePathWatcher::Delegate {
@@ -112,6 +123,11 @@ class ExtensionFileBrowserEventRouter
void HandleFileWatchNotification(const FilePath& path,
bool got_error);
+ // content::NotificationObserver implementation.
+ virtual void Observe(int type,
+ const content::NotificationSource& source,
+ const content::NotificationDetails& details) OVERRIDE;
+
// Sends folder change event.
void DispatchFolderChangeEvent(const FilePath& path, bool error,
const ExtensionUsageRegistry& extensions);
@@ -138,6 +154,7 @@ class ExtensionFileBrowserEventRouter
scoped_ptr<FileBrowserNotifications> notifications_;
Profile* profile_;
base::Lock lock_;
+ content::NotificationRegistrar registrar_;
DISALLOW_COPY_AND_ASSIGN(ExtensionFileBrowserEventRouter);
};
diff --git a/chrome/browser/chromeos/extensions/file_browser_private_api.cc b/chrome/browser/chromeos/extensions/file_browser_private_api.cc
index b19a6e3..a4d3328 100644
--- a/chrome/browser/chromeos/extensions/file_browser_private_api.cc
+++ b/chrome/browser/chromeos/extensions/file_browser_private_api.cc
@@ -17,6 +17,7 @@
#include "chrome/browser/chromeos/extensions/file_handler_util.h"
#include "chrome/browser/chromeos/extensions/file_manager_util.h"
#include "chrome/browser/chromeos/gdata/gdata_file_system_proxy.h"
+#include "chrome/browser/chromeos/gdata/gdata_operation_registry.h"
#include "chrome/browser/chromeos/gdata/gdata_util.h"
#include "chrome/browser/extensions/extension_function_dispatcher.h"
#include "chrome/browser/extensions/extension_process_manager.h"
@@ -60,6 +61,7 @@ using content::ChildProcessSecurityPolicy;
using content::SiteInstance;
using content::WebContents;
using file_handler_util::FileTaskExecutor;
+using gdata::GDataOperationRegistry;
namespace {
@@ -1715,3 +1717,31 @@ void GetGDataFilesFunction::OnFileReady(
GetFileOrSendResponse();
}
+GetFileTransfersFunction::GetFileTransfersFunction() {}
+
+GetFileTransfersFunction::~GetFileTransfersFunction() {}
+
+ListValue* GetFileTransfersFunction::GetFileTransfersList() {
+ gdata::GDataFileSystem* file_system =
+ gdata::GDataFileSystemFactory::GetForProfile(profile_);
+ if (!file_system)
+ return NULL;
+
+ std::vector<gdata::GDataOperationRegistry::ProgressStatus>
+ list = file_system->GetProgressStatusList();
+ return file_manager_util::ProgressStatusVectorToListValue(
+ profile_, source_url_.GetOrigin(), list);
+}
+
+bool GetFileTransfersFunction::RunImpl() {
+ scoped_ptr<ListValue> progress_status_list(GetFileTransfersList());
+ if (!progress_status_list.get()) {
+ SendResponse(false);
+ return false;
+ }
+
+ result_.reset(progress_status_list.release());
+ SendResponse(true);
+ return true;
+}
+
diff --git a/chrome/browser/chromeos/extensions/file_browser_private_api.h b/chrome/browser/chromeos/extensions/file_browser_private_api.h
index 6d2bffc..747eb03 100644
--- a/chrome/browser/chromeos/extensions/file_browser_private_api.h
+++ b/chrome/browser/chromeos/extensions/file_browser_private_api.h
@@ -481,4 +481,20 @@ class GetGDataFilesFunction : public FileBrowserFunction {
DECLARE_EXTENSION_FUNCTION_NAME("fileBrowserPrivate.getGDataFiles");
};
+// Implements the chrome.fileBrowserPrivate.executeTask method.
+class GetFileTransfersFunction : public AsyncExtensionFunction {
+ public:
+ GetFileTransfersFunction();
+ virtual ~GetFileTransfersFunction();
+
+ protected:
+ // AsyncExtensionFunction overrides.
+ virtual bool RunImpl() OVERRIDE;
+
+ private:
+ ListValue* GetFileTransfersList();
+
+ DECLARE_EXTENSION_FUNCTION_NAME("fileBrowserPrivate.getFileTransfers");
+};
+
#endif // CHROME_BROWSER_CHROMEOS_EXTENSIONS_FILE_BROWSER_PRIVATE_API_H_
diff --git a/chrome/browser/chromeos/extensions/file_manager_util.cc b/chrome/browser/chromeos/extensions/file_manager_util.cc
index 509a4d3..caee01b 100644
--- a/chrome/browser/chromeos/extensions/file_manager_util.cc
+++ b/chrome/browser/chromeos/extensions/file_manager_util.cc
@@ -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 file_manager_util {
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 kBaseFileBrowserUrl[] = FILEBROWSER_URL("main.html");
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 @@ std::string GetDialogTypeAsString(
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 @@ bool ShouldBeOpenedWithPdfPlugin(const char* file_extension) {
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
diff --git a/chrome/browser/chromeos/extensions/file_manager_util.h b/chrome/browser/chromeos/extensions/file_manager_util.h
index 7e520ef..9645b8a 100644
--- a/chrome/browser/chromeos/extensions/file_manager_util.h
+++ b/chrome/browser/chromeos/extensions/file_manager_util.h
@@ -7,13 +7,19 @@
#pragma once
#include <string>
+#include <vector>
#include "base/file_path.h"
+#include "chrome/browser/chromeos/gdata/gdata_operation_registry.h"
#include "chrome/browser/ui/select_file_dialog.h"
#include "googleurl/src/gurl.h"
class Profile;
+namespace base {
+class ListValue;
+}
+
extern const char kFileBrowserDomain[];
// File manager helper methods.
@@ -68,6 +74,11 @@ void InstallCRX(Profile* profile, const FilePath& full_path);
bool ShouldBeOpenedWithPdfPlugin(const char* file_extension);
+// Converts the vector of progress status to their JSON (Value) form.
+base::ListValue* ProgressStatusVectorToListValue(
+ Profile* profile, const GURL& origin_url,
+ const std::vector<gdata::GDataOperationRegistry::ProgressStatus>& list);
+
} // namespace file_manager_util
#endif // CHROME_BROWSER_CHROMEOS_EXTENSIONS_FILE_MANAGER_UTIL_H_
diff --git a/chrome/browser/chromeos/gdata/gdata.cc b/chrome/browser/chromeos/gdata/gdata.cc
index 61d7542..18bec67 100644
--- a/chrome/browser/chromeos/gdata/gdata.cc
+++ b/chrome/browser/chromeos/gdata/gdata.cc
@@ -1417,6 +1417,10 @@ void DocumentsService::Initialize(Profile* profile) {
gdata_auth_service_->Initialize(profile);
}
+GDataOperationRegistry* DocumentsService::operation_registry() const {
+ return operation_registry_.get();
+}
+
void DocumentsService::CancelAll() {
operation_registry_->CancelAll();
}
diff --git a/chrome/browser/chromeos/gdata/gdata.h b/chrome/browser/chromeos/gdata/gdata.h
index 8d40eb5..528d52d 100644
--- a/chrome/browser/chromeos/gdata/gdata.h
+++ b/chrome/browser/chromeos/gdata/gdata.h
@@ -145,6 +145,9 @@ class DocumentsServiceInterface {
// Initializes the documents service tied with |profile|.
virtual void Initialize(Profile* profile) = 0;
+ // Retrieves the operation registry.
+ virtual GDataOperationRegistry* operation_registry() const = 0;
+
// Cancels all in-flight operations.
virtual void CancelAll() = 0;
@@ -270,6 +273,7 @@ class DocumentsService
// DocumentsServiceInterface Overrides
virtual void Initialize(Profile* profile) OVERRIDE;
+ virtual GDataOperationRegistry* operation_registry() const OVERRIDE;
virtual void CancelAll() OVERRIDE;
virtual void Authenticate(const AuthStatusCallback& callback) OVERRIDE;
virtual void GetDocuments(const GURL& feed_url,
diff --git a/chrome/browser/chromeos/gdata/gdata_file_system.cc b/chrome/browser/chromeos/gdata/gdata_file_system.cc
index 9540b0b..9f9942e 100644
--- a/chrome/browser/chromeos/gdata/gdata_file_system.cc
+++ b/chrome/browser/chromeos/gdata/gdata_file_system.cc
@@ -19,7 +19,6 @@
#include "chrome/browser/browser_process.h"
#include "chrome/browser/chromeos/gdata/gdata.h"
#include "chrome/browser/chromeos/gdata/gdata_download_observer.h"
-#include "chrome/browser/chromeos/gdata/gdata_parser.h"
#include "chrome/browser/download/download_service.h"
#include "chrome/browser/download/download_service_factory.h"
#include "chrome/browser/profiles/profile.h"
@@ -1223,6 +1222,22 @@ void GDataFileSystem::OnGetAvailableSpace(
feed->quota_bytes_used());
}
+std::vector<GDataOperationRegistry::ProgressStatus>
+ GDataFileSystem::GetProgressStatusList() {
+ return documents_service_->operation_registry()->GetProgressStatusList();
+}
+
+void GDataFileSystem::AddOperationObserver(
+ GDataOperationRegistry::Observer* observer) {
+ return documents_service_->operation_registry()->AddObserver(observer);
+}
+
+void GDataFileSystem::RemoveOperationObserver(
+ GDataOperationRegistry::Observer* observer) {
+ return documents_service_->operation_registry()->RemoveObserver(observer);
+}
+
+
void GDataFileSystem::OnCreateDirectoryCompleted(
const CreateDirectoryParams& params,
GDataErrorCode status,
diff --git a/chrome/browser/chromeos/gdata/gdata_file_system.h b/chrome/browser/chromeos/gdata/gdata_file_system.h
index 8464f00..5c6f224 100644
--- a/chrome/browser/chromeos/gdata/gdata_file_system.h
+++ b/chrome/browser/chromeos/gdata/gdata_file_system.h
@@ -19,6 +19,7 @@
#include "base/platform_file.h"
#include "base/synchronization/lock.h"
#include "chrome/browser/chromeos/gdata/gdata_files.h"
+#include "chrome/browser/chromeos/gdata/gdata_operation_registry.h"
#include "chrome/browser/chromeos/gdata/gdata_params.h"
#include "chrome/browser/chromeos/gdata/gdata_parser.h"
#include "chrome/browser/chromeos/gdata/gdata_uploader.h"
@@ -233,6 +234,13 @@ class GDataFileSystem : public ProfileKeyedService {
void GetFromCacheForPath(const FilePath& gdata_file_path,
const GetFromCacheCallback& callback);
+ // Obtains the list of currently active operations.
+ std::vector<GDataOperationRegistry::ProgressStatus> GetProgressStatusList();
+ // Add operation observer.
+ void AddOperationObserver(GDataOperationRegistry::Observer* observer);
+ // Remove operation observer.
+ void RemoveOperationObserver(GDataOperationRegistry::Observer* observer);
+
// Finds file object by |file_path| and returns its |file_info|.
// Returns true if file was found.
bool GetFileInfoFromPath(const FilePath& gdata_file_path,
diff --git a/chrome/browser/chromeos/gdata/gdata_mock.h b/chrome/browser/chromeos/gdata/gdata_mock.h
index d967c01..bd848e0 100644
--- a/chrome/browser/chromeos/gdata/gdata_mock.h
+++ b/chrome/browser/chromeos/gdata/gdata_mock.h
@@ -28,6 +28,7 @@ class MockDocumentsService : public DocumentsServiceInterface {
// DocumentServiceInterface overrides.
MOCK_METHOD1(Initialize, void(Profile* profile));
+ MOCK_CONST_METHOD0(operation_registry, GDataOperationRegistry*());
MOCK_METHOD0(CancelAll, void(void));
MOCK_METHOD1(Authenticate, void(const AuthStatusCallback& callback));
MOCK_METHOD2(GetDocuments, void(const GURL& feed_url,
diff --git a/chrome/browser/chromeos/login/login_utils.cc b/chrome/browser/chromeos/login/login_utils.cc
index 672687f..501fc6c 100644
--- a/chrome/browser/chromeos/login/login_utils.cc
+++ b/chrome/browser/chromeos/login/login_utils.cc
@@ -1337,6 +1337,11 @@ void LoginUtilsImpl::FetchCredentials(Profile* user_profile,
void LoginUtilsImpl::FetchPolicyToken(Profile* offrecord_profile,
const std::string& token,
const std::string& secret) {
+ if (!CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kEnableDevicePolicy)) {
+ return;
+ }
+
// Fetch dm service token now, if it hasn't been fetched yet.
if (!policy_oauth_fetcher_.get() || policy_oauth_fetcher_->failed()) {
// Get the default system profile to use with the policy fetching. If there
diff --git a/chrome/browser/extensions/extension_event_names.cc b/chrome/browser/extensions/extension_event_names.cc
index 9f25a7a..c127cd5 100644
--- a/chrome/browser/extensions/extension_event_names.cc
+++ b/chrome/browser/extensions/extension_event_names.cc
@@ -31,6 +31,8 @@ const char kOnFileBrowserDiskChanged[] = "fileBrowserPrivate.onDiskChanged";
const char kOnFileChanged[] = "fileBrowserPrivate.onFileChanged";
const char kOnFileBrowserMountCompleted[] =
"fileBrowserPrivate.onMountCompleted";
+const char kOnFileTransfersUpdated[] =
+ "fileBrowserPrivate.onFileTransfersUpdated";
const char kOnInputMethodChanged[] = "inputMethodPrivate.onChanged";
diff --git a/chrome/browser/extensions/extension_event_names.h b/chrome/browser/extensions/extension_event_names.h
index d18c1f11..200328d 100644
--- a/chrome/browser/extensions/extension_event_names.h
+++ b/chrome/browser/extensions/extension_event_names.h
@@ -38,6 +38,7 @@ extern const char kOnExtensionDisabled[];
extern const char kOnFileBrowserDiskChanged[];
extern const char kOnFileChanged[];
extern const char kOnFileBrowserMountCompleted[];
+extern const char kOnFileTransfersUpdated[];
// InputMethod.
extern const char kOnInputMethodChanged[];
diff --git a/chrome/browser/net/gaia/gaia_oauth_fetcher.cc b/chrome/browser/net/gaia/gaia_oauth_fetcher.cc
index 4ee520b..892d0a1 100644
--- a/chrome/browser/net/gaia/gaia_oauth_fetcher.cc
+++ b/chrome/browser/net/gaia/gaia_oauth_fetcher.cc
@@ -26,6 +26,7 @@
#include "content/public/common/url_fetcher.h"
#include "grit/chromium_strings.h"
#include "net/base/load_flags.h"
+#include "net/http/http_response_headers.h"
#include "net/http/http_status_code.h"
#include "net/url_request/url_request_context_getter.h"
#include "net/url_request/url_request_status.h"
@@ -688,6 +689,20 @@ void GaiaOAuthFetcher::OnURLFetchComplete(const content::URLFetcher* source) {
} else {
NOTREACHED();
}
+
+ // Dump full response header for failed attempts:
+ if (response_code >= 400) {
+ if (source->GetResponseCode() ==
+ content::URLFetcher::RESPONSE_CODE_INVALID) {
+ LOG(WARNING) << "Error " << response_code
+ << ", Response headers are malformed!!";
+ } else {
+ std::string headers;
+ source->GetResponseHeaders()->GetNormalizedHeaders(&headers);
+ LOG(WARNING) << "Error " << response_code
+ << ", response header:\n" << headers;
+ }
+ }
}
bool GaiaOAuthFetcher::ShouldAutoFetch(AutoFetchLimit fetch_step) {
diff --git a/chrome/browser/resources/file_manager/js/directory_model.js b/chrome/browser/resources/file_manager/js/directory_model.js
index eb98100..f7457ae 100644
--- a/chrome/browser/resources/file_manager/js/directory_model.js
+++ b/chrome/browser/resources/file_manager/js/directory_model.js
@@ -763,11 +763,15 @@ DirectoryModel.prototype = {
}
function onGData(entry) {
+ console.log('onGData');
+ console.log(entry);
groups.gdata = [entry];
done();
}
function onGDataError(error) {
+ console.log('onGDataError');
+ console.log(error);
groups.gdata = [];
done();
}
@@ -784,8 +788,11 @@ DirectoryModel.prototype = {
},
updateRoots: function(opt_callback) {
+ console.log('directoryModel_.updateRoots');
var self = this;
this.resolveRoots_(function(rootEntries) {
+ console.log('rootsList_ = ');
+ console.log(self.rootsList_);
var dm = self.rootsList_;
var args = [0, dm.length].concat(rootEntries);
dm.splice.apply(dm, args);
diff --git a/chrome/common/extensions/api/fileBrowserPrivate.json b/chrome/common/extensions/api/fileBrowserPrivate.json
index 0993aed..bd8b71a 100644
--- a/chrome/common/extensions/api/fileBrowserPrivate.json
+++ b/chrome/common/extensions/api/fileBrowserPrivate.json
@@ -259,6 +259,37 @@
}
},
{
+ "id": "FileTransferStatus",
+ "type": "object",
+ "description": "Payload data for file transfer status updates.",
+ "properties": {
+ "fileUrl": {
+ "type": "string",
+ "description": "URL of file that is being transfered."
+ },
+ "transferState": {
+ "type": "string",
+ "enum": ["started", "in_progress", "completed", "failed"],
+ "description": "File transfer progress state."
+ },
+ "transferType": {
+ "type": "string",
+ "enum": ["upload", "download"],
+ "description": "Defines file transfer direction."
+ },
+ "processed": {
+ "type": "integer",
+ "optional": true,
+ "description": "Completed portion of the transfer operation."
+ },
+ "total": {
+ "type": "integer",
+ "optional": true,
+ "description": "Total size (cost) of transfer operation."
+ }
+ }
+ },
+ {
"id": "FileWatchEvent",
"type": "object",
"description": "Payload data for disk mount / unmount event.",
@@ -652,6 +683,24 @@
]
},
{
+ "name": "getFileTransfers",
+ "description": "Get the list of ongoing file transfer operations.",
+ "parameters": [
+ {
+ "name": "callback",
+ "type": "function",
+ "parameters": [
+ {
+ "name" : "fileTransfers",
+ "type": "array",
+ "items": {"$ref": "FileTransferStatus"},
+ "description": "The list of FileTransferStatus representing ongoing file transfers."
+ }
+ ]
+ }
+ ]
+ },
+ {
"name": "getSizeStats",
"description": "Retrieves total and remaining size of a mount point.",
"parameters": [
@@ -733,6 +782,19 @@
]
},
{
+ "name": "onFileTransfersUpdated",
+ "type": "function",
+ "description": "Fired when file transfers with remote file system are in progress.",
+ "parameters": [
+ {
+ "type": "array",
+ "items": {"$ref": "FileTransferStatus"},
+ "name": "event",
+ "description": "List of ongoing file statuses for ongoing transfer operations."
+ }
+ ]
+ },
+ {
"name": "onFileChanged",
"type": "function",
"description": "Fired when watched file change event is detected.",