| 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 WEBKIT_BROWSER_FILEAPI_SANDBOX_QUOTA_OBSERVER_H_ | 5 #ifndef WEBKIT_BROWSER_FILEAPI_SANDBOX_QUOTA_OBSERVER_H_ |
| 6 #define WEBKIT_BROWSER_FILEAPI_SANDBOX_QUOTA_OBSERVER_H_ | 6 #define WEBKIT_BROWSER_FILEAPI_SANDBOX_QUOTA_OBSERVER_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| 11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
| 12 #include "base/files/file_path.h" | 12 #include "base/files/file_path.h" |
| 13 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
| 14 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
| 15 #include "base/memory/weak_ptr.h" | 15 #include "base/memory/weak_ptr.h" |
| 16 #include "webkit/browser/fileapi/file_observers.h" | 16 #include "storage/browser/fileapi/file_observers.h" |
| 17 #include "webkit/browser/fileapi/file_system_url.h" | 17 #include "storage/browser/fileapi/file_system_url.h" |
| 18 | 18 |
| 19 namespace base { | 19 namespace base { |
| 20 class SequencedTaskRunner; | 20 class SequencedTaskRunner; |
| 21 } | 21 } |
| 22 | 22 |
| 23 namespace quota { | 23 namespace quota { |
| 24 class QuotaManagerProxy; | 24 class QuotaManagerProxy; |
| 25 } | 25 } |
| 26 | 26 |
| 27 namespace fileapi { | 27 namespace storage { |
| 28 | 28 |
| 29 class FileSystemUsageCache; | 29 class FileSystemUsageCache; |
| 30 class FileSystemURL; | 30 class FileSystemURL; |
| 31 class TimedTaskHelper; | 31 class TimedTaskHelper; |
| 32 class ObfuscatedFileUtil; | 32 class ObfuscatedFileUtil; |
| 33 | 33 |
| 34 class SandboxQuotaObserver | 34 class SandboxQuotaObserver : public FileUpdateObserver, |
| 35 : public FileUpdateObserver, | 35 public FileAccessObserver { |
| 36 public FileAccessObserver { | |
| 37 public: | 36 public: |
| 38 typedef std::map<base::FilePath, int64> PendingUpdateNotificationMap; | 37 typedef std::map<base::FilePath, int64> PendingUpdateNotificationMap; |
| 39 | 38 |
| 40 SandboxQuotaObserver( | 39 SandboxQuotaObserver(quota::QuotaManagerProxy* quota_manager_proxy, |
| 41 quota::QuotaManagerProxy* quota_manager_proxy, | 40 base::SequencedTaskRunner* update_notify_runner, |
| 42 base::SequencedTaskRunner* update_notify_runner, | 41 ObfuscatedFileUtil* sandbox_file_util, |
| 43 ObfuscatedFileUtil* sandbox_file_util, | 42 FileSystemUsageCache* file_system_usage_cache_); |
| 44 FileSystemUsageCache* file_system_usage_cache_); | |
| 45 virtual ~SandboxQuotaObserver(); | 43 virtual ~SandboxQuotaObserver(); |
| 46 | 44 |
| 47 // FileUpdateObserver overrides. | 45 // FileUpdateObserver overrides. |
| 48 virtual void OnStartUpdate(const FileSystemURL& url) OVERRIDE; | 46 virtual void OnStartUpdate(const FileSystemURL& url) OVERRIDE; |
| 49 virtual void OnUpdate(const FileSystemURL& url, int64 delta) OVERRIDE; | 47 virtual void OnUpdate(const FileSystemURL& url, int64 delta) OVERRIDE; |
| 50 virtual void OnEndUpdate(const FileSystemURL& url) OVERRIDE; | 48 virtual void OnEndUpdate(const FileSystemURL& url) OVERRIDE; |
| 51 | 49 |
| 52 // FileAccessObserver overrides. | 50 // FileAccessObserver overrides. |
| 53 virtual void OnAccess(const FileSystemURL& url) OVERRIDE; | 51 virtual void OnAccess(const FileSystemURL& url) OVERRIDE; |
| 54 | 52 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 70 | 68 |
| 71 // Not owned; file_system_usage_cache_ should have longer lifetime than this. | 69 // Not owned; file_system_usage_cache_ should have longer lifetime than this. |
| 72 FileSystemUsageCache* file_system_usage_cache_; | 70 FileSystemUsageCache* file_system_usage_cache_; |
| 73 | 71 |
| 74 PendingUpdateNotificationMap pending_update_notification_; | 72 PendingUpdateNotificationMap pending_update_notification_; |
| 75 scoped_ptr<TimedTaskHelper> delayed_cache_update_helper_; | 73 scoped_ptr<TimedTaskHelper> delayed_cache_update_helper_; |
| 76 | 74 |
| 77 DISALLOW_COPY_AND_ASSIGN(SandboxQuotaObserver); | 75 DISALLOW_COPY_AND_ASSIGN(SandboxQuotaObserver); |
| 78 }; | 76 }; |
| 79 | 77 |
| 80 } // namespace fileapi | 78 } // namespace storage |
| 81 | 79 |
| 82 #endif // WEBKIT_BROWSER_FILEAPI_SANDBOX_QUOTA_OBSERVER_H_ | 80 #endif // WEBKIT_BROWSER_FILEAPI_SANDBOX_QUOTA_OBSERVER_H_ |
| OLD | NEW |