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

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

Issue 10805034: Fix flakiness in RemoteFileSystemExtensionApiTests (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years, 5 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 (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 "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/memory/singleton.h" 9 #include "base/memory/singleton.h"
10 #include "base/threading/sequenced_worker_pool.h" 10 #include "base/threading/sequenced_worker_pool.h"
11 #include "chrome/browser/profiles/profile_keyed_service.h" 11 #include "chrome/browser/profiles/profile_keyed_service.h"
12 #include "chrome/browser/profiles/profile_keyed_service_factory.h" 12 #include "chrome/browser/profiles/profile_keyed_service_factory.h"
13 13
14 class FilePath;
15
14 namespace gdata { 16 namespace gdata {
15 17
16 class DocumentsServiceInterface; 18 class DocumentsServiceInterface;
17 class DriveWebAppsRegistry; 19 class DriveWebAppsRegistry;
18 class GDataCache; 20 class GDataCache;
19 class GDataDownloadObserver; 21 class GDataDownloadObserver;
20 class GDataFileSystemInterface; 22 class GDataFileSystemInterface;
21 class GDataSyncClient; 23 class GDataSyncClient;
22 class GDataUploader; 24 class GDataUploader;
23 25
(...skipping 22 matching lines...) Expand all
46 48
47 // ProfileKeyedService override: 49 // ProfileKeyedService override:
48 virtual void Shutdown() OVERRIDE; 50 virtual void Shutdown() OVERRIDE;
49 51
50 private: 52 private:
51 explicit GDataSystemService(Profile* profile); 53 explicit GDataSystemService(Profile* profile);
52 virtual ~GDataSystemService(); 54 virtual ~GDataSystemService();
53 55
54 // Initializes the object. This function should be called before any 56 // Initializes the object. This function should be called before any
55 // other functions. 57 // other functions.
56 void Initialize(DocumentsServiceInterface* documents_service); 58 void Initialize(DocumentsServiceInterface* documents_service,
59 const FilePath& cache_root);
57 60
58 // Registers remote file system proxy for drive mount point. 61 // Registers remote file system proxy for drive mount point.
59 void AddDriveMountPoint(); 62 void AddDriveMountPoint();
60 // Unregisters drive mount point from File API. 63 // Unregisters drive mount point from File API.
61 void RemoveDriveMountPoint(); 64 void RemoveDriveMountPoint();
62 65
63 friend class GDataSystemServiceFactory; 66 friend class GDataSystemServiceFactory;
64 67
65 Profile* profile_; 68 Profile* profile_;
66 const base::SequencedWorkerPool::SequenceToken sequence_token_; 69 const base::SequencedWorkerPool::SequenceToken sequence_token_;
(...skipping 15 matching lines...) Expand all
82 // Returns the GDataSystemService for |profile|, creating it if it is not 85 // Returns the GDataSystemService for |profile|, creating it if it is not
83 // yet created. 86 // yet created.
84 static GDataSystemService* GetForProfile(Profile* profile); 87 static GDataSystemService* GetForProfile(Profile* profile);
85 // Returns the GDataSystemService that is already associated with |profile|, 88 // Returns the GDataSystemService that is already associated with |profile|,
86 // if it is not yet created it will return NULL. 89 // if it is not yet created it will return NULL.
87 static GDataSystemService* FindForProfile(Profile* profile); 90 static GDataSystemService* FindForProfile(Profile* profile);
88 91
89 // Returns the GDataSystemServiceFactory instance. 92 // Returns the GDataSystemServiceFactory instance.
90 static GDataSystemServiceFactory* GetInstance(); 93 static GDataSystemServiceFactory* GetInstance();
91 94
92 // Just creates a new instance without initializing most of the fields. 95 // Sets documents service that should be used to initialize file system in
93 // This is useful for tests such as injecting mocks. 96 // test. Should be called before the service is created.
94 static ProfileKeyedService* CreateInstance(Profile* profile); 97 // Please, make sure |documents_service| gets deleted if no system service is
98 // created (e.g. by calling this method with NULL).
99 static void set_documents_service_for_test(
100 DocumentsServiceInterface* documents_service);
95 101
96 // Returns GDataSystemService for testing, with |documents_service| injected 102 // Sets root path for the cache used in test. Should be called before the
97 // to GDataFileSystem. 103 // service is created.
98 GDataSystemService* GetWithCustomDocumentsServiceForTesting( 104 // If |cache_root| is not empty, new string object will be created. Please,
99 Profile* profile, 105 // make sure it gets deleted if no system service is created (e.g. by calling
100 DocumentsServiceInterface* documents_service); 106 // this method with empty string).
107 static void set_cache_root_for_test(const std::string& cache_root);
101 108
102 private: 109 private:
103 friend struct DefaultSingletonTraits<GDataSystemServiceFactory>; 110 friend struct DefaultSingletonTraits<GDataSystemServiceFactory>;
104 111
105 GDataSystemServiceFactory(); 112 GDataSystemServiceFactory();
106 virtual ~GDataSystemServiceFactory(); 113 virtual ~GDataSystemServiceFactory();
107 114
108 // ProfileKeyedServiceFactory: 115 // ProfileKeyedServiceFactory:
109 virtual ProfileKeyedService* BuildServiceInstanceFor( 116 virtual ProfileKeyedService* BuildServiceInstanceFor(
110 Profile* profile) const OVERRIDE; 117 Profile* profile) const OVERRIDE;
111 }; 118 };
112 119
113 } // namespace gdata 120 } // namespace gdata
114 121
115 #endif // CHROME_BROWSER_CHROMEOS_GDATA_GDATA_SYSTEM_SERVICE_H_ 122 #endif // CHROME_BROWSER_CHROMEOS_GDATA_GDATA_SYSTEM_SERVICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698