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_CHROMEOS_GDATA_GDATA_FILE_SYSTEM_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_GDATA_GDATA_FILE_SYSTEM_H_ |
6 #define CHROME_BROWSER_CHROMEOS_GDATA_GDATA_FILE_SYSTEM_H_ | 6 #define CHROME_BROWSER_CHROMEOS_GDATA_GDATA_FILE_SYSTEM_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <sys/stat.h> | 9 #include <sys/stat.h> |
10 | 10 |
11 #include <map> | 11 #include <map> |
12 #include <string> | 12 #include <string> |
13 #include <vector> | 13 #include <vector> |
14 | 14 |
15 #include "base/gtest_prod_util.h" | 15 #include "base/gtest_prod_util.h" |
16 #include "base/memory/scoped_ptr.h" | 16 #include "base/memory/scoped_ptr.h" |
17 #include "base/memory/singleton.h" | 17 #include "base/memory/singleton.h" |
18 #include "base/memory/weak_ptr.h" | 18 #include "base/memory/weak_ptr.h" |
19 #include "base/message_loop.h" | 19 #include "base/message_loop.h" |
20 #include "base/platform_file.h" | 20 #include "base/platform_file.h" |
21 #include "base/timer.h" | 21 #include "base/timer.h" |
22 #include "base/synchronization/lock.h" | 22 #include "base/synchronization/lock.h" |
23 #include "base/threading/sequenced_worker_pool.h" | 23 #include "base/threading/sequenced_worker_pool.h" |
24 #include "chrome/browser/chromeos/gdata/find_entry_callback.h" | 24 #include "chrome/browser/chromeos/gdata/find_entry_callback.h" |
25 #include "chrome/browser/chromeos/gdata/gdata_cache.h" | 25 #include "chrome/browser/chromeos/gdata/gdata_cache.h" |
26 #include "chrome/browser/chromeos/gdata/gdata_documents_service.h" | 26 #include "chrome/browser/chromeos/gdata/gdata_documents_service.h" |
27 #include "chrome/browser/chromeos/gdata/gdata_files.h" | 27 #include "chrome/browser/chromeos/gdata/gdata_files.h" |
28 #include "chrome/browser/chromeos/gdata/gdata_operation_registry.h" | |
29 #include "chrome/browser/chromeos/gdata/gdata_params.h" | 28 #include "chrome/browser/chromeos/gdata/gdata_params.h" |
30 #include "chrome/browser/chromeos/gdata/gdata_parser.h" | 29 #include "chrome/browser/chromeos/gdata/gdata_parser.h" |
31 #include "chrome/browser/chromeos/gdata/gdata_uploader.h" | 30 #include "chrome/browser/chromeos/gdata/gdata_uploader.h" |
32 #include "chrome/browser/prefs/pref_change_registrar.h" | 31 #include "chrome/browser/prefs/pref_change_registrar.h" |
33 #include "chrome/browser/profiles/profile_keyed_service.h" | 32 #include "chrome/browser/profiles/profile_keyed_service.h" |
34 #include "chrome/browser/profiles/profile_keyed_service_factory.h" | 33 #include "chrome/browser/profiles/profile_keyed_service_factory.h" |
35 #include "content/public/browser/notification_observer.h" | 34 #include "content/public/browser/notification_observer.h" |
36 | 35 |
37 namespace base { | 36 namespace base { |
38 class WaitableEvent; | 37 class WaitableEvent; |
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
346 // Gets a file by the given |resource_id| from the gdata server. Used for | 345 // Gets a file by the given |resource_id| from the gdata server. Used for |
347 // fetching pinned-but-not-fetched files. | 346 // fetching pinned-but-not-fetched files. |
348 // | 347 // |
349 // Can be called from UI/IO thread. |get_file_callback| and | 348 // Can be called from UI/IO thread. |get_file_callback| and |
350 // |get_download_data_callback| are run on the calling thread. | 349 // |get_download_data_callback| are run on the calling thread. |
351 virtual void GetFileByResourceId( | 350 virtual void GetFileByResourceId( |
352 const std::string& resource_id, | 351 const std::string& resource_id, |
353 const GetFileCallback& get_file_callback, | 352 const GetFileCallback& get_file_callback, |
354 const GetDownloadDataCallback& get_download_data_callback) = 0; | 353 const GetDownloadDataCallback& get_download_data_callback) = 0; |
355 | 354 |
356 // Gets the operation registry that manages all operations performed through | |
357 // the GDataFileSystem object. | |
358 virtual GDataOperationRegistry* GetOperationRegistry() = 0; | |
359 | |
360 // Gets the cache state of file corresponding to |resource_id| and |md5| if it | 355 // Gets the cache state of file corresponding to |resource_id| and |md5| if it |
361 // exists on disk. | 356 // exists on disk. |
362 // Initializes cache if it has not been initialized. | 357 // Initializes cache if it has not been initialized. |
363 // Upon completion, |callback| is invoked on the thread where this method was | 358 // Upon completion, |callback| is invoked on the thread where this method was |
364 // called with the cache state if file exists in cache or CACHE_STATE_NONE | 359 // called with the cache state if file exists in cache or CACHE_STATE_NONE |
365 // otherwise. | 360 // otherwise. |
366 virtual void GetCacheState(const std::string& resource_id, | 361 virtual void GetCacheState(const std::string& resource_id, |
367 const std::string& md5, | 362 const std::string& md5, |
368 const GetCacheStateCallback& callback) = 0; | 363 const GetCacheStateCallback& callback) = 0; |
369 | 364 |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
509 bool is_recursive, | 504 bool is_recursive, |
510 const FileOperationCallback& callback) OVERRIDE; | 505 const FileOperationCallback& callback) OVERRIDE; |
511 virtual void GetFileByPath( | 506 virtual void GetFileByPath( |
512 const FilePath& file_path, | 507 const FilePath& file_path, |
513 const GetFileCallback& get_file_callback, | 508 const GetFileCallback& get_file_callback, |
514 const GetDownloadDataCallback& get_download_data_callback) OVERRIDE; | 509 const GetDownloadDataCallback& get_download_data_callback) OVERRIDE; |
515 virtual void GetFileByResourceId( | 510 virtual void GetFileByResourceId( |
516 const std::string& resource_id, | 511 const std::string& resource_id, |
517 const GetFileCallback& get_file_callback, | 512 const GetFileCallback& get_file_callback, |
518 const GetDownloadDataCallback& get_download_data_callback) OVERRIDE; | 513 const GetDownloadDataCallback& get_download_data_callback) OVERRIDE; |
519 virtual GDataOperationRegistry* GetOperationRegistry() OVERRIDE; | |
520 virtual void GetCacheState(const std::string& resource_id, | 514 virtual void GetCacheState(const std::string& resource_id, |
521 const std::string& md5, | 515 const std::string& md5, |
522 const GetCacheStateCallback& callback) OVERRIDE; | 516 const GetCacheStateCallback& callback) OVERRIDE; |
523 virtual void GetEntryInfoByPathAsync( | 517 virtual void GetEntryInfoByPathAsync( |
524 const FilePath& file_path, | 518 const FilePath& file_path, |
525 const GetEntryInfoCallback& callback) OVERRIDE; | 519 const GetEntryInfoCallback& callback) OVERRIDE; |
526 virtual void GetFileInfoByPathAsync( | 520 virtual void GetFileInfoByPathAsync( |
527 const FilePath& file_path, | 521 const FilePath& file_path, |
528 const GetFileInfoCallback& callback) OVERRIDE; | 522 const GetFileInfoCallback& callback) OVERRIDE; |
529 virtual void ReadDirectoryByPathAsync( | 523 virtual void ReadDirectoryByPathAsync( |
(...skipping 1034 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1564 }; | 1558 }; |
1565 | 1559 |
1566 // Sets the free disk space getter for testing. | 1560 // Sets the free disk space getter for testing. |
1567 // The existing getter is deleted. | 1561 // The existing getter is deleted. |
1568 void SetFreeDiskSpaceGetterForTesting( | 1562 void SetFreeDiskSpaceGetterForTesting( |
1569 FreeDiskSpaceGetterInterface* getter); | 1563 FreeDiskSpaceGetterInterface* getter); |
1570 | 1564 |
1571 } // namespace gdata | 1565 } // namespace gdata |
1572 | 1566 |
1573 #endif // CHROME_BROWSER_CHROMEOS_GDATA_GDATA_FILE_SYSTEM_H_ | 1567 #endif // CHROME_BROWSER_CHROMEOS_GDATA_GDATA_FILE_SYSTEM_H_ |
OLD | NEW |