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

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

Issue 10352004: gdata: Implement periodic file system update checks. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Add 2 more DCHECKs to make sure we're not starting/stopping timer when it is already started/stoppe… Created 8 years, 7 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_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/synchronization/lock.h" 22 #include "base/synchronization/lock.h"
22 #include "base/threading/sequenced_worker_pool.h" 23 #include "base/threading/sequenced_worker_pool.h"
23 #include "chrome/browser/chromeos/gdata/find_entry_delegate.h" 24 #include "chrome/browser/chromeos/gdata/find_entry_delegate.h"
24 #include "chrome/browser/chromeos/gdata/gdata_documents_service.h" 25 #include "chrome/browser/chromeos/gdata/gdata_documents_service.h"
25 #include "chrome/browser/chromeos/gdata/gdata_files.h" 26 #include "chrome/browser/chromeos/gdata/gdata_files.h"
26 #include "chrome/browser/chromeos/gdata/gdata_operation_registry.h" 27 #include "chrome/browser/chromeos/gdata/gdata_operation_registry.h"
27 #include "chrome/browser/chromeos/gdata/gdata_params.h" 28 #include "chrome/browser/chromeos/gdata/gdata_params.h"
28 #include "chrome/browser/chromeos/gdata/gdata_parser.h" 29 #include "chrome/browser/chromeos/gdata/gdata_parser.h"
29 #include "chrome/browser/chromeos/gdata/gdata_uploader.h" 30 #include "chrome/browser/chromeos/gdata/gdata_uploader.h"
30 #include "chrome/browser/prefs/pref_change_registrar.h" 31 #include "chrome/browser/prefs/pref_change_registrar.h"
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 }; 169 };
169 170
170 // Initializes the object. This function should be called before any 171 // Initializes the object. This function should be called before any
171 // other functions. 172 // other functions.
172 virtual void Initialize() = 0; 173 virtual void Initialize() = 0;
173 174
174 // Adds and removes the observer. 175 // Adds and removes the observer.
175 virtual void AddObserver(Observer* observer) = 0; 176 virtual void AddObserver(Observer* observer) = 0;
176 virtual void RemoveObserver(Observer* observer) = 0; 177 virtual void RemoveObserver(Observer* observer) = 0;
177 178
179 // Starts and stops periodic updates.
180 virtual void StartUpdates() = 0;
181 virtual void StopUpdates() = 0;
182
183 // Checks for updates on the server.
184 virtual void CheckForUpdates() = 0;
185
178 // Enum defining origin of a cached file. 186 // Enum defining origin of a cached file.
179 enum CachedFileOrigin { 187 enum CachedFileOrigin {
180 CACHED_FILE_FROM_SERVER = 0, 188 CACHED_FILE_FROM_SERVER = 0,
181 CACHED_FILE_LOCALLY_MODIFIED, 189 CACHED_FILE_LOCALLY_MODIFIED,
182 CACHED_FILE_MOUNTED, 190 CACHED_FILE_MOUNTED,
183 }; 191 };
184 192
185 // Enum defining type of file operation e.g. copy or move, etc. 193 // Enum defining type of file operation e.g. copy or move, etc.
186 // For now, it's used for StoreToCache. 194 // For now, it's used for StoreToCache.
187 enum FileOperationType { 195 enum FileOperationType {
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
393 public content::NotificationObserver { 401 public content::NotificationObserver {
394 public: 402 public:
395 GDataFileSystem(Profile* profile, 403 GDataFileSystem(Profile* profile,
396 DocumentsServiceInterface* documents_service); 404 DocumentsServiceInterface* documents_service);
397 virtual ~GDataFileSystem(); 405 virtual ~GDataFileSystem();
398 406
399 // GDataFileSystem overrides. 407 // GDataFileSystem overrides.
400 virtual void Initialize() OVERRIDE; 408 virtual void Initialize() OVERRIDE;
401 virtual void AddObserver(Observer* observer) OVERRIDE; 409 virtual void AddObserver(Observer* observer) OVERRIDE;
402 virtual void RemoveObserver(Observer* observer) OVERRIDE; 410 virtual void RemoveObserver(Observer* observer) OVERRIDE;
411 virtual void StartUpdates() OVERRIDE;
412 virtual void StopUpdates() OVERRIDE;
413 virtual void CheckForUpdates() OVERRIDE;
403 virtual void Authenticate(const AuthStatusCallback& callback) OVERRIDE; 414 virtual void Authenticate(const AuthStatusCallback& callback) OVERRIDE;
404 virtual void FindEntryByResourceIdSync(const std::string& resource_id, 415 virtual void FindEntryByResourceIdSync(const std::string& resource_id,
405 FindEntryDelegate* delegate) OVERRIDE; 416 FindEntryDelegate* delegate) OVERRIDE;
406 virtual void TransferFile(const FilePath& local_file_path, 417 virtual void TransferFile(const FilePath& local_file_path,
407 const FilePath& remote_dest_file_path, 418 const FilePath& remote_dest_file_path,
408 const FileOperationCallback& callback) OVERRIDE; 419 const FileOperationCallback& callback) OVERRIDE;
409 virtual void Copy(const FilePath& src_file_path, 420 virtual void Copy(const FilePath& src_file_path,
410 const FilePath& dest_file_path, 421 const FilePath& dest_file_path,
411 const FileOperationCallback& callback) OVERRIDE; 422 const FileOperationCallback& callback) OVERRIDE;
412 virtual void Move(const FilePath& src_file_path, 423 virtual void Move(const FilePath& src_file_path,
(...skipping 913 matching lines...) Expand 10 before | Expand all | Expand 10 after
1326 scoped_ptr<base::WaitableEvent> on_io_completed_; 1337 scoped_ptr<base::WaitableEvent> on_io_completed_;
1327 1338
1328 // True if cache initialization has started, is in progress or has completed, 1339 // True if cache initialization has started, is in progress or has completed,
1329 // we only want to initialize cache once. 1340 // we only want to initialize cache once.
1330 bool cache_initialization_started_; 1341 bool cache_initialization_started_;
1331 1342
1332 // Number of pending tasks on the blocking thread pool. 1343 // Number of pending tasks on the blocking thread pool.
1333 int num_pending_tasks_; 1344 int num_pending_tasks_;
1334 base::Lock num_pending_tasks_lock_; 1345 base::Lock num_pending_tasks_lock_;
1335 1346
1347 // Periodic timer for checking updates.
1348 base::Timer update_timer_;
1349
1336 // True if hosted documents should be hidden. 1350 // True if hosted documents should be hidden.
1337 bool hide_hosted_docs_; 1351 bool hide_hosted_docs_;
1338 1352
1339 scoped_ptr<PrefChangeRegistrar> pref_registrar_; 1353 scoped_ptr<PrefChangeRegistrar> pref_registrar_;
1340 1354
1341 // WeakPtrFactory and WeakPtr bound to the UI thread. 1355 // WeakPtrFactory and WeakPtr bound to the UI thread.
1342 scoped_ptr<base::WeakPtrFactory<GDataFileSystem> > ui_weak_ptr_factory_; 1356 scoped_ptr<base::WeakPtrFactory<GDataFileSystem> > ui_weak_ptr_factory_;
1343 base::WeakPtr<GDataFileSystem> ui_weak_ptr_; 1357 base::WeakPtr<GDataFileSystem> ui_weak_ptr_;
1344 1358
1345 ObserverList<Observer> observers_; 1359 ObserverList<Observer> observers_;
(...skipping 18 matching lines...) Expand all
1364 }; 1378 };
1365 1379
1366 // Sets the free disk space getter for testing. 1380 // Sets the free disk space getter for testing.
1367 // The existing getter is deleted. 1381 // The existing getter is deleted.
1368 void SetFreeDiskSpaceGetterForTesting( 1382 void SetFreeDiskSpaceGetterForTesting(
1369 FreeDiskSpaceGetterInterface* getter); 1383 FreeDiskSpaceGetterInterface* getter);
1370 1384
1371 } // namespace gdata 1385 } // namespace gdata
1372 1386
1373 #endif // CHROME_BROWSER_CHROMEOS_GDATA_GDATA_FILE_SYSTEM_H_ 1387 #endif // CHROME_BROWSER_CHROMEOS_GDATA_GDATA_FILE_SYSTEM_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698