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_FILEAPI_SANDBOX_QUOTA_OBSERVER_H_ | 5 #ifndef WEBKIT_FILEAPI_SANDBOX_QUOTA_OBSERVER_H_ |
6 #define WEBKIT_FILEAPI_SANDBOX_QUOTA_OBSERVER_H_ | 6 #define WEBKIT_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" |
(...skipping 15 matching lines...) Expand all Loading... |
26 | 26 |
27 namespace fileapi { | 27 namespace fileapi { |
28 | 28 |
29 class FileSystemURL; | 29 class FileSystemURL; |
30 class ObfuscatedFileUtil; | 30 class ObfuscatedFileUtil; |
31 | 31 |
32 class SandboxQuotaObserver | 32 class SandboxQuotaObserver |
33 : public FileUpdateObserver, | 33 : public FileUpdateObserver, |
34 public FileAccessObserver { | 34 public FileAccessObserver { |
35 public: | 35 public: |
36 typedef std::map<FilePath, int64> PendingUpdateNotificationMap; | 36 typedef std::map<base::FilePath, int64> PendingUpdateNotificationMap; |
37 | 37 |
38 SandboxQuotaObserver( | 38 SandboxQuotaObserver( |
39 quota::QuotaManagerProxy* quota_manager_proxy, | 39 quota::QuotaManagerProxy* quota_manager_proxy, |
40 base::SequencedTaskRunner* update_notify_runner, | 40 base::SequencedTaskRunner* update_notify_runner, |
41 ObfuscatedFileUtil* sandbox_file_util); | 41 ObfuscatedFileUtil* sandbox_file_util); |
42 virtual ~SandboxQuotaObserver(); | 42 virtual ~SandboxQuotaObserver(); |
43 | 43 |
44 // FileUpdateObserver overrides. | 44 // FileUpdateObserver overrides. |
45 virtual void OnStartUpdate(const FileSystemURL& url) OVERRIDE; | 45 virtual void OnStartUpdate(const FileSystemURL& url) OVERRIDE; |
46 virtual void OnUpdate(const FileSystemURL& url, int64 delta) OVERRIDE; | 46 virtual void OnUpdate(const FileSystemURL& url, int64 delta) OVERRIDE; |
47 virtual void OnEndUpdate(const FileSystemURL& url) OVERRIDE; | 47 virtual void OnEndUpdate(const FileSystemURL& url) OVERRIDE; |
48 | 48 |
49 // FileAccessObserver overrides. | 49 // FileAccessObserver overrides. |
50 virtual void OnAccess(const FileSystemURL& url) OVERRIDE; | 50 virtual void OnAccess(const FileSystemURL& url) OVERRIDE; |
51 | 51 |
52 private: | 52 private: |
53 void ApplyPendingUsageUpdate(); | 53 void ApplyPendingUsageUpdate(); |
54 void UpdateUsageCacheFile(const FilePath& usage_file_path, int64 delta); | 54 void UpdateUsageCacheFile(const base::FilePath& usage_file_path, int64 delta); |
55 | 55 |
56 FilePath GetUsageCachePath(const FileSystemURL& url); | 56 base::FilePath GetUsageCachePath(const FileSystemURL& url); |
57 | 57 |
58 scoped_refptr<quota::QuotaManagerProxy> quota_manager_proxy_; | 58 scoped_refptr<quota::QuotaManagerProxy> quota_manager_proxy_; |
59 scoped_refptr<base::SequencedTaskRunner> update_notify_runner_; | 59 scoped_refptr<base::SequencedTaskRunner> update_notify_runner_; |
60 | 60 |
61 // Not owned; sandbox_file_util_ should have identical lifetime with this. | 61 // Not owned; sandbox_file_util_ should have identical lifetime with this. |
62 ObfuscatedFileUtil* sandbox_file_util_; | 62 ObfuscatedFileUtil* sandbox_file_util_; |
63 | 63 |
64 PendingUpdateNotificationMap pending_update_notification_; | 64 PendingUpdateNotificationMap pending_update_notification_; |
65 bool running_delayed_cache_update_; | 65 bool running_delayed_cache_update_; |
66 | 66 |
67 base::WeakPtrFactory<SandboxQuotaObserver> weak_factory_; | 67 base::WeakPtrFactory<SandboxQuotaObserver> weak_factory_; |
68 | 68 |
69 DISALLOW_COPY_AND_ASSIGN(SandboxQuotaObserver); | 69 DISALLOW_COPY_AND_ASSIGN(SandboxQuotaObserver); |
70 }; | 70 }; |
71 | 71 |
72 } // namespace fileapi | 72 } // namespace fileapi |
73 | 73 |
74 #endif // WEBKIT_FILEAPI_SANDBOX_QUOTA_OBSERVER_H_ | 74 #endif // WEBKIT_FILEAPI_SANDBOX_QUOTA_OBSERVER_H_ |
OLD | NEW |