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

Side by Side Diff: chrome/browser/chromeos/gdata/gdata_system_service.h

Issue 10823125: Drive: add a method to clear all local cache. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: review fix (comment #12) 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 unified diff | Download patch
OLDNEW
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_SYSTEM_SERVICE_H_ 5 #ifndef CHROME_BROWSER_CHROMEOS_GDATA_GDATA_SYSTEM_SERVICE_H_
6 #define CHROME_BROWSER_CHROMEOS_GDATA_GDATA_SYSTEM_SERVICE_H_ 6 #define CHROME_BROWSER_CHROMEOS_GDATA_GDATA_SYSTEM_SERVICE_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
11 #include "base/memory/singleton.h" 11 #include "base/memory/singleton.h"
12 #include "base/memory/weak_ptr.h"
12 #include "base/threading/sequenced_worker_pool.h" 13 #include "base/threading/sequenced_worker_pool.h"
14 #include "chrome/browser/chromeos/gdata/gdata_errorcode.h"
13 #include "chrome/browser/profiles/profile_keyed_service.h" 15 #include "chrome/browser/profiles/profile_keyed_service.h"
14 #include "chrome/browser/profiles/profile_keyed_service_factory.h" 16 #include "chrome/browser/profiles/profile_keyed_service_factory.h"
15 17
16 class FilePath; 18 class FilePath;
17 19
18 namespace gdata { 20 namespace gdata {
19 21
20 class DocumentsServiceInterface; 22 class DocumentsServiceInterface;
21 class DriveWebAppsRegistry; 23 class DriveWebAppsRegistry;
22 class GDataCache; 24 class GDataCache;
(...skipping 11 matching lines...) Expand all
34 // created per-profile. 36 // created per-profile.
35 class GDataSystemService : public ProfileKeyedService { 37 class GDataSystemService : public ProfileKeyedService {
36 public: 38 public:
37 DocumentsServiceInterface* docs_service() { return documents_service_.get(); } 39 DocumentsServiceInterface* docs_service() { return documents_service_.get(); }
38 GDataCache* cache() { return cache_; } 40 GDataCache* cache() { return cache_; }
39 GDataFileSystemInterface* file_system() { return file_system_.get(); } 41 GDataFileSystemInterface* file_system() { return file_system_.get(); }
40 GDataUploader* uploader() { return uploader_.get(); } 42 GDataUploader* uploader() { return uploader_.get(); }
41 GDataContactsService* contacts_service() { return contacts_service_.get(); } 43 GDataContactsService* contacts_service() { return contacts_service_.get(); }
42 DriveWebAppsRegistry* webapps_registry() { return webapps_registry_.get(); } 44 DriveWebAppsRegistry* webapps_registry() { return webapps_registry_.get(); }
43 45
46 // Clears all the local cache files and in-memory data, and remounts the file
47 // system.
48 void ClearCacheAndRemountFileSystem(
49 const base::Callback<void(bool)>& callback);
50
44 // ProfileKeyedService override: 51 // ProfileKeyedService override:
45 virtual void Shutdown() OVERRIDE; 52 virtual void Shutdown() OVERRIDE;
46 53
47 private: 54 private:
48 explicit GDataSystemService(Profile* profile); 55 explicit GDataSystemService(Profile* profile);
49 virtual ~GDataSystemService(); 56 virtual ~GDataSystemService();
50 57
51 // Initializes the object. This function should be called before any 58 // Initializes the object. This function should be called before any
52 // other functions. 59 // other functions.
53 void Initialize(DocumentsServiceInterface* documents_service, 60 void Initialize(DocumentsServiceInterface* documents_service,
54 const FilePath& cache_root); 61 const FilePath& cache_root);
55 62
56 // Registers remote file system proxy for drive mount point. 63 // Registers remote file system proxy for drive mount point.
57 void AddDriveMountPoint(); 64 void AddDriveMountPoint();
58 // Unregisters drive mount point from File API. 65 // Unregisters drive mount point from File API.
59 void RemoveDriveMountPoint(); 66 void RemoveDriveMountPoint();
60 67
68 // Adds back the drive mount point. Used to implement ClearCache().
69 void AddBackDriveMountPoint(const base::Callback<void(bool)>& callback,
70 GDataFileError error,
71 const FilePath& file_path);
72
61 friend class GDataSystemServiceFactory; 73 friend class GDataSystemServiceFactory;
62 74
63 Profile* profile_; 75 Profile* profile_;
64 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner_; 76 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner_;
65 GDataCache* cache_; 77 GDataCache* cache_;
66 scoped_ptr<DocumentsServiceInterface> documents_service_; 78 scoped_ptr<DocumentsServiceInterface> documents_service_;
67 scoped_ptr<GDataUploader> uploader_; 79 scoped_ptr<GDataUploader> uploader_;
68 scoped_ptr<DriveWebAppsRegistry> webapps_registry_; 80 scoped_ptr<DriveWebAppsRegistry> webapps_registry_;
69 scoped_ptr<GDataFileSystemInterface> file_system_; 81 scoped_ptr<GDataFileSystemInterface> file_system_;
70 scoped_ptr<GDataDownloadObserver> download_observer_; 82 scoped_ptr<GDataDownloadObserver> download_observer_;
71 scoped_ptr<GDataSyncClient> sync_client_; 83 scoped_ptr<GDataSyncClient> sync_client_;
72 scoped_ptr<GDataContactsService> contacts_service_; 84 scoped_ptr<GDataContactsService> contacts_service_;
85 base::WeakPtrFactory<GDataSystemService> weak_ptr_factory_;
73 86
74 DISALLOW_COPY_AND_ASSIGN(GDataSystemService); 87 DISALLOW_COPY_AND_ASSIGN(GDataSystemService);
75 }; 88 };
76 89
77 // Singleton that owns all GDataSystemServices and associates them with 90 // Singleton that owns all GDataSystemServices and associates them with
78 // Profiles. 91 // Profiles.
79 class GDataSystemServiceFactory : public ProfileKeyedServiceFactory { 92 class GDataSystemServiceFactory : public ProfileKeyedServiceFactory {
80 public: 93 public:
81 // Returns the GDataSystemService for |profile|, creating it if it is not 94 // Returns the GDataSystemService for |profile|, creating it if it is not
82 // yet created. 95 // yet created.
(...skipping 26 matching lines...) Expand all
109 virtual ~GDataSystemServiceFactory(); 122 virtual ~GDataSystemServiceFactory();
110 123
111 // ProfileKeyedServiceFactory: 124 // ProfileKeyedServiceFactory:
112 virtual ProfileKeyedService* BuildServiceInstanceFor( 125 virtual ProfileKeyedService* BuildServiceInstanceFor(
113 Profile* profile) const OVERRIDE; 126 Profile* profile) const OVERRIDE;
114 }; 127 };
115 128
116 } // namespace gdata 129 } // namespace gdata
117 130
118 #endif // CHROME_BROWSER_CHROMEOS_GDATA_GDATA_SYSTEM_SERVICE_H_ 131 #endif // CHROME_BROWSER_CHROMEOS_GDATA_GDATA_SYSTEM_SERVICE_H_
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/gdata/gdata_cache_unittest.cc ('k') | chrome/browser/chromeos/gdata/gdata_system_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698