| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_APPCACHE_APPCACHE_GROUP_H_ | 5 #ifndef WEBKIT_APPCACHE_APPCACHE_GROUP_H_ |
| 6 #define WEBKIT_APPCACHE_APPCACHE_GROUP_H_ | 6 #define WEBKIT_APPCACHE_APPCACHE_GROUP_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 class AppCacheUpdateJob; | 23 class AppCacheUpdateJob; |
| 24 class HostObserver; | 24 class HostObserver; |
| 25 | 25 |
| 26 // Collection of application caches identified by the same manifest URL. | 26 // Collection of application caches identified by the same manifest URL. |
| 27 // A group exists as long as it is in use by a host or is being updated. | 27 // A group exists as long as it is in use by a host or is being updated. |
| 28 class AppCacheGroup : public base::RefCounted<AppCacheGroup> { | 28 class AppCacheGroup : public base::RefCounted<AppCacheGroup> { |
| 29 public: | 29 public: |
| 30 | 30 |
| 31 class UpdateObserver { | 31 class UpdateObserver { |
| 32 public: | 32 public: |
| 33 // Called if access to the appcache was blocked by a policy. |
| 34 virtual void OnContentBlocked(AppCacheGroup* group) = 0; |
| 35 |
| 33 // Called just after an appcache update has completed. | 36 // Called just after an appcache update has completed. |
| 34 virtual void OnUpdateComplete(AppCacheGroup* group) = 0; | 37 virtual void OnUpdateComplete(AppCacheGroup* group) = 0; |
| 35 virtual ~UpdateObserver() { } | 38 virtual ~UpdateObserver() {} |
| 36 }; | 39 }; |
| 37 | 40 |
| 38 enum UpdateStatus { | 41 enum UpdateStatus { |
| 39 IDLE, | 42 IDLE, |
| 40 CHECKING, | 43 CHECKING, |
| 41 DOWNLOADING, | 44 DOWNLOADING, |
| 42 }; | 45 }; |
| 43 | 46 |
| 44 AppCacheGroup(AppCacheService* service, const GURL& manifest_url, | 47 AppCacheGroup(AppCacheService* service, const GURL& manifest_url, |
| 45 int64 group_id); | 48 int64 group_id); |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 ~AppCacheGroup(); | 101 ~AppCacheGroup(); |
| 99 | 102 |
| 100 typedef std::vector<AppCache*> Caches; | 103 typedef std::vector<AppCache*> Caches; |
| 101 typedef std::map<AppCacheHost*, GURL> QueuedUpdates; | 104 typedef std::map<AppCacheHost*, GURL> QueuedUpdates; |
| 102 | 105 |
| 103 static const int kUpdateRestartDelayMs = 1000; | 106 static const int kUpdateRestartDelayMs = 1000; |
| 104 | 107 |
| 105 AppCacheUpdateJob* update_job() { return update_job_; } | 108 AppCacheUpdateJob* update_job() { return update_job_; } |
| 106 void SetUpdateStatus(UpdateStatus status); | 109 void SetUpdateStatus(UpdateStatus status); |
| 107 | 110 |
| 111 void NotifyContentBlocked(); |
| 112 |
| 108 const Caches& old_caches() const { return old_caches_; } | 113 const Caches& old_caches() const { return old_caches_; } |
| 109 | 114 |
| 110 // Update cannot be processed at this time. Queue it for a later run. | 115 // Update cannot be processed at this time. Queue it for a later run. |
| 111 void QueueUpdate(AppCacheHost* host, const GURL& new_master_resource); | 116 void QueueUpdate(AppCacheHost* host, const GURL& new_master_resource); |
| 112 void RunQueuedUpdates(); | 117 void RunQueuedUpdates(); |
| 113 bool FindObserver(UpdateObserver* find_me, | 118 bool FindObserver(UpdateObserver* find_me, |
| 114 const ObserverList<UpdateObserver>& observer_list); | 119 const ObserverList<UpdateObserver>& observer_list); |
| 115 void ScheduleUpdateRestart(int delay_ms); | 120 void ScheduleUpdateRestart(int delay_ms); |
| 116 void HostDestructionImminent(AppCacheHost* host); | 121 void HostDestructionImminent(AppCacheHost* host); |
| 117 | 122 |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 FRIEND_TEST(AppCacheGroupTest, CancelUpdate); | 155 FRIEND_TEST(AppCacheGroupTest, CancelUpdate); |
| 151 FRIEND_TEST(AppCacheGroupTest, QueueUpdate); | 156 FRIEND_TEST(AppCacheGroupTest, QueueUpdate); |
| 152 FRIEND_TEST(AppCacheUpdateJobTest, AlreadyChecking); | 157 FRIEND_TEST(AppCacheUpdateJobTest, AlreadyChecking); |
| 153 FRIEND_TEST(AppCacheUpdateJobTest, AlreadyDownloading); | 158 FRIEND_TEST(AppCacheUpdateJobTest, AlreadyDownloading); |
| 154 DISALLOW_COPY_AND_ASSIGN(AppCacheGroup); | 159 DISALLOW_COPY_AND_ASSIGN(AppCacheGroup); |
| 155 }; | 160 }; |
| 156 | 161 |
| 157 } // namespace appcache | 162 } // namespace appcache |
| 158 | 163 |
| 159 #endif // WEBKIT_APPCACHE_APPCACHE_GROUP_H_ | 164 #endif // WEBKIT_APPCACHE_APPCACHE_GROUP_H_ |
| OLD | NEW |