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_SYNC_CLIENT_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_GDATA_GDATA_SYNC_CLIENT_H_ |
6 #define CHROME_BROWSER_CHROMEOS_GDATA_GDATA_SYNC_CLIENT_H_ | 6 #define CHROME_BROWSER_CHROMEOS_GDATA_GDATA_SYNC_CLIENT_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <deque> | 9 #include <deque> |
10 #include <string> | 10 #include <string> |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
55 class GDataSyncClient | 55 class GDataSyncClient |
56 : public GDataSyncClientInterface, | 56 : public GDataSyncClientInterface, |
57 public GDataFileSystem::Observer, | 57 public GDataFileSystem::Observer, |
58 public chromeos::NetworkLibrary::NetworkManagerObserver, | 58 public chromeos::NetworkLibrary::NetworkManagerObserver, |
59 public content::NotificationObserver { | 59 public content::NotificationObserver { |
60 public: | 60 public: |
61 // |profile| is used to access user preferences. | 61 // |profile| is used to access user preferences. |
62 // |file_system| is used access the | 62 // |file_system| is used access the |
63 // cache (ex. store a file to the cache when the file is downloaded). | 63 // cache (ex. store a file to the cache when the file is downloaded). |
64 GDataSyncClient(Profile* profile, | 64 GDataSyncClient(Profile* profile, |
65 GDataFileSystemInterface* file_system); | 65 GDataFileSystemInterface* file_system, |
achuithb
2012/06/11 21:58:10
Why not just pass in GDataSystemService* and have
hashimoto
2012/06/12 02:00:18
I thought doing so will introduce unnecessary depe
hashimoto
2012/06/12 06:20:12
I thought this was a good thing to do, but I began
| |
66 GDataCache* cache); | |
66 virtual ~GDataSyncClient(); | 67 virtual ~GDataSyncClient(); |
67 | 68 |
68 // GDataSyncClientInterface overrides. | 69 // GDataSyncClientInterface overrides. |
69 virtual void Initialize() OVERRIDE; | 70 virtual void Initialize() OVERRIDE; |
70 | 71 |
71 // GDataFileSystem::Observer overrides. | 72 // GDataFileSystem::Observer overrides. |
72 virtual void OnCacheInitialized() OVERRIDE; | 73 virtual void OnCacheInitialized() OVERRIDE; |
73 virtual void OnFilePinned(const std::string& resource_id, | 74 virtual void OnFilePinned(const std::string& resource_id, |
74 const std::string& md5) OVERRIDE; | 75 const std::string& md5) OVERRIDE; |
75 virtual void OnFileUnpinned(const std::string& resource_id, | 76 virtual void OnFileUnpinned(const std::string& resource_id, |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
120 | 121 |
121 // chromeos::NetworkLibrary::NetworkManagerObserver override. | 122 // chromeos::NetworkLibrary::NetworkManagerObserver override. |
122 virtual void OnNetworkManagerChanged( | 123 virtual void OnNetworkManagerChanged( |
123 chromeos::NetworkLibrary* network_library) OVERRIDE; | 124 chromeos::NetworkLibrary* network_library) OVERRIDE; |
124 | 125 |
125 // content::NotificationObserver override. | 126 // content::NotificationObserver override. |
126 virtual void Observe(int type, | 127 virtual void Observe(int type, |
127 const content::NotificationSource& source, | 128 const content::NotificationSource& source, |
128 const content::NotificationDetails& details) OVERRIDE; | 129 const content::NotificationDetails& details) OVERRIDE; |
129 Profile* profile_; | 130 Profile* profile_; |
130 GDataFileSystemInterface* file_system_; | 131 GDataFileSystemInterface* file_system_; // Owned by GDataSystemService. |
132 GDataCache* cache_; // Owned by GDataSystemService. | |
131 scoped_ptr<PrefChangeRegistrar> registrar_; | 133 scoped_ptr<PrefChangeRegistrar> registrar_; |
132 | 134 |
133 // The queue of resource IDs used to fetch pinned-but-not-fetched files in | 135 // The queue of resource IDs used to fetch pinned-but-not-fetched files in |
134 // the background thread. Note that this class does not use a lock to | 136 // the background thread. Note that this class does not use a lock to |
135 // protect |queue_| as all methods touching |queue_| run on the UI thread. | 137 // protect |queue_| as all methods touching |queue_| run on the UI thread. |
136 std::deque<std::string> queue_; | 138 std::deque<std::string> queue_; |
137 | 139 |
138 // True if the fetch loop is running. | 140 // True if the fetch loop is running. |
139 bool fetch_loop_is_running_; | 141 bool fetch_loop_is_running_; |
140 | 142 |
141 base::WeakPtrFactory<GDataSyncClient> weak_ptr_factory_; | 143 base::WeakPtrFactory<GDataSyncClient> weak_ptr_factory_; |
142 | 144 |
143 DISALLOW_COPY_AND_ASSIGN(GDataSyncClient); | 145 DISALLOW_COPY_AND_ASSIGN(GDataSyncClient); |
144 }; | 146 }; |
145 | 147 |
146 } // namespace gdata | 148 } // namespace gdata |
147 | 149 |
148 #endif // CHROME_BROWSER_CHROMEOS_GDATA_GDATA_SYNC_CLIENT_H_ | 150 #endif // CHROME_BROWSER_CHROMEOS_GDATA_GDATA_SYNC_CLIENT_H_ |
OLD | NEW |