OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_EXTENSIONS_API_DEVELOPER_PRIVATE_DEVELOPER_PRIVATE_API_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_DEVELOPER_PRIVATE_DEVELOPER_PRIVATE_API_H_ |
6 #define CHROME_BROWSER_EXTENSIONS_API_DEVELOPER_PRIVATE_DEVELOPER_PRIVATE_API_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_API_DEVELOPER_PRIVATE_DEVELOPER_PRIVATE_API_H_ |
7 | 7 |
8 #include "base/platform_file.h" | 8 #include "base/platform_file.h" |
9 #include "chrome/browser/extensions/api/developer_private/entry_picker.h" | 9 #include "chrome/browser/extensions/api/developer_private/entry_picker.h" |
10 #include "chrome/browser/extensions/api/file_system/file_system_api.h" | 10 #include "chrome/browser/extensions/api/file_system/file_system_api.h" |
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
359 DECLARE_EXTENSION_FUNCTION("developerPrivate.isProfileManaged", | 359 DECLARE_EXTENSION_FUNCTION("developerPrivate.isProfileManaged", |
360 DEVELOPERPRIVATE_ISPROFILEMANAGED); | 360 DEVELOPERPRIVATE_ISPROFILEMANAGED); |
361 | 361 |
362 protected: | 362 protected: |
363 virtual ~DeveloperPrivateIsProfileManagedFunction(); | 363 virtual ~DeveloperPrivateIsProfileManagedFunction(); |
364 | 364 |
365 // ExtensionFunction | 365 // ExtensionFunction |
366 virtual bool RunImpl() OVERRIDE; | 366 virtual bool RunImpl() OVERRIDE; |
367 }; | 367 }; |
368 | 368 |
369 class DeveloperPrivateExportSyncfsFolderToLocalfsFunction | 369 class DeveloperPrivateLoadDirectoryFunction |
370 : public ChromeAsyncExtensionFunction { | 370 : public ChromeAsyncExtensionFunction { |
371 public: | 371 public: |
372 DECLARE_EXTENSION_FUNCTION("developerPrivate.exportSyncfsFolderToLocalfs", | 372 DECLARE_EXTENSION_FUNCTION("developerPrivate.loadDirectory", |
373 DEVELOPERPRIVATE_LOADUNPACKEDCROS); | 373 DEVELOPERPRIVATE_LOADUNPACKEDCROS); |
374 | 374 |
375 DeveloperPrivateExportSyncfsFolderToLocalfsFunction(); | 375 DeveloperPrivateLoadDirectoryFunction(); |
376 | 376 |
377 protected: | 377 protected: |
378 virtual ~DeveloperPrivateExportSyncfsFolderToLocalfsFunction(); | 378 virtual ~DeveloperPrivateLoadDirectoryFunction(); |
379 | 379 |
380 // ExtensionFunction | 380 // ExtensionFunction |
381 virtual bool RunImpl() OVERRIDE; | 381 virtual bool RunImpl() OVERRIDE; |
382 | 382 |
383 void ClearPrexistingDirectoryContent(const base::FilePath& project_path); | 383 void ClearExistingDirectoryContent(const base::FilePath& project_path); |
384 | 384 |
385 void ReadSyncFileSystemDirectory(const base::FilePath& project_path, | 385 void ReadSyncFileSystemDirectory(const base::FilePath& project_path, |
386 const base::FilePath& destination_path); | 386 const base::FilePath& destination_path); |
387 | 387 |
388 void ReadSyncFileSystemDirectoryCb( | 388 void ReadSyncFileSystemDirectoryCb( |
389 const base::FilePath& project_path, | 389 const base::FilePath& project_path, |
390 const base::FilePath& destination_path, | 390 const base::FilePath& destination_path, |
391 base::PlatformFileError result, | 391 base::PlatformFileError result, |
392 const fileapi::FileSystemOperation::FileEntryList& file_list, | 392 const fileapi::FileSystemOperation::FileEntryList& file_list, |
393 bool has_more); | 393 bool has_more); |
394 | 394 |
395 void SnapshotFileCallback( | 395 void SnapshotFileCallback( |
396 const base::FilePath& target_path, | 396 const base::FilePath& target_path, |
397 base::PlatformFileError result, | 397 base::PlatformFileError result, |
398 const base::PlatformFileInfo& file_info, | 398 const base::PlatformFileInfo& file_info, |
399 const base::FilePath& platform_path, | 399 const base::FilePath& platform_path, |
400 const scoped_refptr<webkit_blob::ShareableFileReference>& file_ref); | 400 const scoped_refptr<webkit_blob::ShareableFileReference>& file_ref); |
401 | 401 |
402 void CopyFile(const base::FilePath& src_path, | 402 void CopyFile(const base::FilePath& src_path, |
403 const base::FilePath& dest_path); | 403 const base::FilePath& dest_path); |
404 | 404 |
| 405 void Load(); |
| 406 |
405 scoped_refptr<fileapi::FileSystemContext> context_; | 407 scoped_refptr<fileapi::FileSystemContext> context_; |
406 | 408 |
| 409 // syncfs url representing the root of the folder to be copied. |
| 410 std::string project_base_url_; |
| 411 |
| 412 // physical path on disc of the folder to be copied. |
| 413 base::FilePath project_base_path_; |
| 414 |
| 415 // Path of the current folder to be copied. |
| 416 base::FilePath current_path_; |
| 417 |
407 private: | 418 private: |
408 int pendingCopyOperationsCount_; | 419 int pending_copy_operations_count_; |
409 | 420 |
410 // This is set to false if any of the copyFile operations fail on | 421 // This is set to false if any of the copyFile operations fail on |
411 // call of the API. It is returned as a response of the API call. | 422 // call of the API. It is returned as a response of the API call. |
412 bool success_; | 423 bool success_; |
413 }; | |
414 | 424 |
415 class DeveloperPrivateLoadProjectFunction | |
416 : public ChromeAsyncExtensionFunction { | |
417 public: | |
418 DECLARE_EXTENSION_FUNCTION("developerPrivate.loadProject", | |
419 DEVELOPERPRIVATE_LOADPROJECT); | |
420 | |
421 DeveloperPrivateLoadProjectFunction(); | |
422 | |
423 protected: | |
424 virtual ~DeveloperPrivateLoadProjectFunction(); | |
425 | |
426 // ExtensionFunction | |
427 virtual bool RunImpl() OVERRIDE; | |
428 | |
429 void GetUnpackedExtension(const base::FilePath& path, | |
430 const ExtensionSet* extensions); | |
431 }; | 425 }; |
432 | 426 |
433 } // namespace api | 427 } // namespace api |
434 | 428 |
435 } // namespace extensions | 429 } // namespace extensions |
436 | 430 |
437 #endif // CHROME_BROWSER_EXTENSIONS_API_DEVELOPER_PRIVATE_DEVELOPER_PRIVATE_API
_H_ | 431 #endif // CHROME_BROWSER_EXTENSIONS_API_DEVELOPER_PRIVATE_DEVELOPER_PRIVATE_API
_H_ |
OLD | NEW |