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

Unified Diff: chrome/browser/chromeos/gdata/gdata_util.cc

Issue 10827068: gdata: Fix "save as pdf" to work on Google Drive. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase + add bug id + drive-by comment typo fix. Created 8 years, 4 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
Index: chrome/browser/chromeos/gdata/gdata_util.cc
diff --git a/chrome/browser/chromeos/gdata/gdata_util.cc b/chrome/browser/chromeos/gdata/gdata_util.cc
index fe764c9ea56c16d80185a3bde161038ae20ee606..3db16702ec620677e710e2d508326b9174c7fc2f 100644
--- a/chrome/browser/chromeos/gdata/gdata_util.cc
+++ b/chrome/browser/chromeos/gdata/gdata_util.cc
@@ -21,6 +21,7 @@
#include "base/stringprintf.h"
#include "base/threading/sequenced_worker_pool.h"
#include "base/time.h"
+#include "chrome/browser/chromeos/gdata/file_write_helper.h"
#include "chrome/browser/chromeos/gdata/gdata.pb.h"
#include "chrome/browser/chromeos/gdata/gdata_file_system_interface.h"
#include "chrome/browser/chromeos/gdata/gdata_system_service.h"
@@ -71,6 +72,12 @@ GDataCache* GetGDataCache(Profile* profile) {
return system_service ? system_service->cache() : NULL;
}
+FileWriteHelper* GetFileWriteHelper(Profile* profile) {
+ GDataSystemService* system_service =
+ GDataSystemServiceFactory::GetForProfile(profile);
+ return system_service ? system_service->file_write_helper() : NULL;
+}
+
void GetHostedDocumentURLBlockingThread(const FilePath& gdata_cache_path,
GURL* url) {
std::string json;
@@ -579,5 +586,23 @@ std::string FormatTimeAsString(const base::Time& time) {
exploded.hour, exploded.minute, exploded.second, exploded.millisecond);
}
+void PrepareWritableFileAndRun(Profile* profile,
+ const FilePath& path,
+ const OpenFileCallback& callback) {
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+ if (IsUnderGDataMountPoint(path)) {
+ FileWriteHelper* file_write_helper = GetFileWriteHelper(profile);
+ if (!file_write_helper)
+ return;
+ FilePath remote_path(ExtractGDataPath(path));
+ file_write_helper->PrepareWritableFileAndRun(remote_path, callback);
+ } else {
+ if (!callback.is_null()) {
+ content::BrowserThread::GetBlockingPool()->PostTask(
+ FROM_HERE, base::Bind(callback, GDATA_FILE_OK, path));
+ }
+ }
+}
+
} // namespace util
} // namespace gdata
« no previous file with comments | « chrome/browser/chromeos/gdata/gdata_util.h ('k') | chrome/browser/ui/webui/print_preview/print_preview_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698