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

Side by Side Diff: webkit/fileapi/sandbox_quota_observer.h

Issue 15442002: Move FileAPI sandboxed filesystem related code from webkit/fileapi to webkit/browser/fileapi (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebased Created 7 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 | Annotate | Revision Log
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef WEBKIT_FILEAPI_SANDBOX_QUOTA_OBSERVER_H_
6 #define WEBKIT_FILEAPI_SANDBOX_QUOTA_OBSERVER_H_
7
8 #include <map>
9
10 #include "base/basictypes.h"
11 #include "base/compiler_specific.h"
12 #include "base/files/file_path.h"
13 #include "base/memory/ref_counted.h"
14 #include "base/memory/scoped_ptr.h"
15 #include "base/memory/weak_ptr.h"
16 #include "webkit/fileapi/file_observers.h"
17 #include "webkit/fileapi/file_system_url.h"
18
19 namespace base {
20 class SequencedTaskRunner;
21 }
22
23 namespace quota {
24 class QuotaManagerProxy;
25 }
26
27 namespace fileapi {
28
29 class FileSystemUsageCache;
30 class FileSystemURL;
31 class ObfuscatedFileUtil;
32
33 class SandboxQuotaObserver
34 : public FileUpdateObserver,
35 public FileAccessObserver {
36 public:
37 typedef std::map<base::FilePath, int64> PendingUpdateNotificationMap;
38
39 SandboxQuotaObserver(
40 quota::QuotaManagerProxy* quota_manager_proxy,
41 base::SequencedTaskRunner* update_notify_runner,
42 ObfuscatedFileUtil* sandbox_file_util,
43 FileSystemUsageCache* file_system_usage_cache_);
44 virtual ~SandboxQuotaObserver();
45
46 // FileUpdateObserver overrides.
47 virtual void OnStartUpdate(const FileSystemURL& url) OVERRIDE;
48 virtual void OnUpdate(const FileSystemURL& url, int64 delta) OVERRIDE;
49 virtual void OnEndUpdate(const FileSystemURL& url) OVERRIDE;
50
51 // FileAccessObserver overrides.
52 virtual void OnAccess(const FileSystemURL& url) OVERRIDE;
53
54 void SetUsageCacheEnabled(const GURL& origin,
55 FileSystemType type,
56 bool enabled);
57
58 private:
59 void ApplyPendingUsageUpdate();
60 void UpdateUsageCacheFile(const base::FilePath& usage_file_path, int64 delta);
61
62 base::FilePath GetUsageCachePath(const FileSystemURL& url);
63
64 scoped_refptr<quota::QuotaManagerProxy> quota_manager_proxy_;
65 scoped_refptr<base::SequencedTaskRunner> update_notify_runner_;
66
67 // Not owned; sandbox_file_util_ should have identical lifetime with this.
68 ObfuscatedFileUtil* sandbox_file_util_;
69
70 // Not owned; file_system_usage_cache_ should have longer lifetime than this.
71 FileSystemUsageCache* file_system_usage_cache_;
72
73 PendingUpdateNotificationMap pending_update_notification_;
74 bool running_delayed_cache_update_;
75
76 base::WeakPtrFactory<SandboxQuotaObserver> weak_factory_;
77
78 DISALLOW_COPY_AND_ASSIGN(SandboxQuotaObserver);
79 };
80
81 } // namespace fileapi
82
83 #endif // WEBKIT_FILEAPI_SANDBOX_QUOTA_OBSERVER_H_
OLDNEW
« no previous file with comments | « webkit/fileapi/sandbox_origin_database_unittest.cc ('k') | webkit/fileapi/sandbox_quota_observer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698