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

Side by Side Diff: chrome/browser/local_discovery/storage/privet_filesystem_operations.h

Issue 177373010: [Privet FS] Allow files to be able to be copied in to the privet filesystem (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 #ifndef CHROME_BROWSER_LOCAL_DISCOVERY_STORAGE_PRIVET_FILESYSTEM_OPERATIONS_H_ 5 #ifndef CHROME_BROWSER_LOCAL_DISCOVERY_STORAGE_PRIVET_FILESYSTEM_OPERATIONS_H_
6 #define CHROME_BROWSER_LOCAL_DISCOVERY_STORAGE_PRIVET_FILESYSTEM_OPERATIONS_H_ 6 #define CHROME_BROWSER_LOCAL_DISCOVERY_STORAGE_PRIVET_FILESYSTEM_OPERATIONS_H_
7 7
8 #include "base/cancelable_callback.h" 8 #include "base/cancelable_callback.h"
9 #include "chrome/browser/local_discovery/privet_device_resolver.h" 9 #include "chrome/browser/local_discovery/privet_device_resolver.h"
10 #include "chrome/browser/local_discovery/privet_http.h" 10 #include "chrome/browser/local_discovery/privet_http.h"
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 void CopyFile(const fileapi::FileSystemURL& src, 66 void CopyFile(const fileapi::FileSystemURL& src,
67 const fileapi::FileSystemURL& dest, 67 const fileapi::FileSystemURL& dest,
68 const fileapi::AsyncFileUtil::StatusCallback& callback); 68 const fileapi::AsyncFileUtil::StatusCallback& callback);
69 void MoveFile(const fileapi::FileSystemURL& src, 69 void MoveFile(const fileapi::FileSystemURL& src,
70 const fileapi::FileSystemURL& dest, 70 const fileapi::FileSystemURL& dest,
71 const fileapi::AsyncFileUtil::StatusCallback& callback); 71 const fileapi::AsyncFileUtil::StatusCallback& callback);
72 void CreateDirectory(const fileapi::FileSystemURL& url, 72 void CreateDirectory(const fileapi::FileSystemURL& url,
73 bool exclusive, 73 bool exclusive,
74 bool recursive, 74 bool recursive,
75 const fileapi::AsyncFileUtil::StatusCallback& callback); 75 const fileapi::AsyncFileUtil::StatusCallback& callback);
76 void CopyInForeignFile(
77 base::FilePath src_file_path,
78 const fileapi::FileSystemURL& dest_url,
79 const fileapi::AsyncFileUtil::StatusCallback& callback);
76 80
77 base::WeakPtr<PrivetFileSystemOperationFactory> GetWeakPtr() { 81 base::WeakPtr<PrivetFileSystemOperationFactory> GetWeakPtr() {
78 return weak_factory_.GetWeakPtr(); 82 return weak_factory_.GetWeakPtr();
79 } 83 }
80 84
81 private: 85 private:
82 virtual void RemoveOperation(PrivetFileSystemAsyncOperation* operation) 86 virtual void RemoveOperation(PrivetFileSystemAsyncOperation* operation)
83 OVERRIDE; 87 OVERRIDE;
84 virtual void RemoveAllOperations() OVERRIDE; 88 virtual void RemoveAllOperations() OVERRIDE;
85 89
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after
319 PrivetFileSystemAsyncOperationUtil core_; 323 PrivetFileSystemAsyncOperationUtil core_;
320 base::FilePath full_path_; 324 base::FilePath full_path_;
321 GetOperationCallback get_operation_; 325 GetOperationCallback get_operation_;
322 bool check_status_; 326 bool check_status_;
323 PrivetFileSystemAsyncOperationContainer* container_; 327 PrivetFileSystemAsyncOperationContainer* container_;
324 fileapi::AsyncFileUtil::StatusCallback callback_; 328 fileapi::AsyncFileUtil::StatusCallback callback_;
325 329
326 scoped_ptr<PrivetJSONOperation> operation_; 330 scoped_ptr<PrivetJSONOperation> operation_;
327 }; 331 };
328 332
333 class PrivetFileSystemUploadOperation
334 : public PrivetFileSystemAsyncOperationUtil::Delegate,
335 public local_discovery::PrivetFileSystemAsyncOperation {
336 public:
337 PrivetFileSystemUploadOperation(
338 const base::FilePath& full_path,
339 const base::FilePath& upload_path,
340 content::BrowserContext* browser_context,
341 PrivetFileSystemAsyncOperationContainer* container,
342 const fileapi::AsyncFileUtil::StatusCallback& callback);
343 virtual ~PrivetFileSystemUploadOperation();
344
345 virtual void Start() OVERRIDE;
346
347 virtual void PrivetFileSystemResolved(PrivetHTTPClient* http_client,
348 const std::string& path) OVERRIDE;
349
350 private:
351 void OnStorageOverwriteResult(
352 PrivetDataReadOperation::ResponseType result_type,
353 const std::string& data,
354 const base::FilePath& file);
355 void SignalError();
356 void TriggerCallbackAndDestroy(base::File::Error result);
357
358 PrivetFileSystemAsyncOperationUtil core_;
359 base::FilePath full_path_;
360 base::FilePath upload_path_;
361 PrivetFileSystemAsyncOperationContainer* container_;
362 fileapi::AsyncFileUtil::StatusCallback callback_;
363
364 scoped_ptr<PrivetDataReadOperation> overwrite_operation_;
365 };
366
329 } // namespace local_discovery 367 } // namespace local_discovery
330 368
331 #endif // CHROME_BROWSER_LOCAL_DISCOVERY_STORAGE_PRIVET_FILESYSTEM_OPERATIONS_H _ 369 #endif // CHROME_BROWSER_LOCAL_DISCOVERY_STORAGE_PRIVET_FILESYSTEM_OPERATIONS_H _
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698