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

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 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 resets cache-related information in
47 // the memory.
48 void ClearCacheAndResetOnUIThread();
satorux1 2012/08/01 21:56:31 Please rename it to ClearCache(). This should suff
yoshiki 2012/08/01 23:07:59 Done.
49
44 // ProfileKeyedService override: 50 // ProfileKeyedService override:
45 virtual void Shutdown() OVERRIDE; 51 virtual void Shutdown() OVERRIDE;
46 52
47 private: 53 private:
48 explicit GDataSystemService(Profile* profile); 54 explicit GDataSystemService(Profile* profile);
49 virtual ~GDataSystemService(); 55 virtual ~GDataSystemService();
50 56
51 // Initializes the object. This function should be called before any 57 // Initializes the object. This function should be called before any
52 // other functions. 58 // other functions.
53 void Initialize(DocumentsServiceInterface* documents_service, 59 void Initialize(DocumentsServiceInterface* documents_service,
54 const FilePath& cache_root); 60 const FilePath& cache_root);
55 61
56 // Registers remote file system proxy for drive mount point. 62 // Registers remote file system proxy for drive mount point.
57 void AddDriveMountPoint(); 63 void AddDriveMountPoint();
58 // Unregisters drive mount point from File API. 64 // Unregisters drive mount point from File API.
59 void RemoveDriveMountPoint(); 65 void RemoveDriveMountPoint();
60 66
67 // Used to implement ClearCacheAndResetOnUIThread().
satorux1 2012/08/01 21:56:31 Please write some more, like: // Adds back the dr
yoshiki 2012/08/01 23:07:59 Done.
68 void AddBackDrivemountPoint(GDataFileError error, const FilePath& file_path);
satorux1 2012/08/01 21:56:31 Drivemount -> DriveMount
yoshiki 2012/08/01 23:07:59 Done.
69
61 friend class GDataSystemServiceFactory; 70 friend class GDataSystemServiceFactory;
62 71
63 Profile* profile_; 72 Profile* profile_;
64 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner_; 73 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner_;
65 GDataCache* cache_; 74 GDataCache* cache_;
66 scoped_ptr<DocumentsServiceInterface> documents_service_; 75 scoped_ptr<DocumentsServiceInterface> documents_service_;
67 scoped_ptr<GDataUploader> uploader_; 76 scoped_ptr<GDataUploader> uploader_;
68 scoped_ptr<DriveWebAppsRegistry> webapps_registry_; 77 scoped_ptr<DriveWebAppsRegistry> webapps_registry_;
69 scoped_ptr<GDataFileSystemInterface> file_system_; 78 scoped_ptr<GDataFileSystemInterface> file_system_;
70 scoped_ptr<GDataDownloadObserver> download_observer_; 79 scoped_ptr<GDataDownloadObserver> download_observer_;
71 scoped_ptr<GDataSyncClient> sync_client_; 80 scoped_ptr<GDataSyncClient> sync_client_;
72 scoped_ptr<GDataContactsService> contacts_service_; 81 scoped_ptr<GDataContactsService> contacts_service_;
82 base::WeakPtrFactory<GDataSystemService> weak_ptr_factory_;
73 83
74 DISALLOW_COPY_AND_ASSIGN(GDataSystemService); 84 DISALLOW_COPY_AND_ASSIGN(GDataSystemService);
75 }; 85 };
76 86
77 // Singleton that owns all GDataSystemServices and associates them with 87 // Singleton that owns all GDataSystemServices and associates them with
78 // Profiles. 88 // Profiles.
79 class GDataSystemServiceFactory : public ProfileKeyedServiceFactory { 89 class GDataSystemServiceFactory : public ProfileKeyedServiceFactory {
80 public: 90 public:
81 // Returns the GDataSystemService for |profile|, creating it if it is not 91 // Returns the GDataSystemService for |profile|, creating it if it is not
82 // yet created. 92 // yet created.
(...skipping 26 matching lines...) Expand all
109 virtual ~GDataSystemServiceFactory(); 119 virtual ~GDataSystemServiceFactory();
110 120
111 // ProfileKeyedServiceFactory: 121 // ProfileKeyedServiceFactory:
112 virtual ProfileKeyedService* BuildServiceInstanceFor( 122 virtual ProfileKeyedService* BuildServiceInstanceFor(
113 Profile* profile) const OVERRIDE; 123 Profile* profile) const OVERRIDE;
114 }; 124 };
115 125
116 } // namespace gdata 126 } // namespace gdata
117 127
118 #endif // CHROME_BROWSER_CHROMEOS_GDATA_GDATA_SYSTEM_SERVICE_H_ 128 #endif // CHROME_BROWSER_CHROMEOS_GDATA_GDATA_SYSTEM_SERVICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698