| 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_APPCACHE_APPCACHE_UPDATE_JOB_H_ | 5 #ifndef CONTENT_BROWSER_APPCACHE_APPCACHE_UPDATE_JOB_H_ |
| 6 #define WEBKIT_BROWSER_APPCACHE_APPCACHE_UPDATE_JOB_H_ | 6 #define CONTENT_BROWSER_APPCACHE_APPCACHE_UPDATE_JOB_H_ |
| 7 | 7 |
| 8 #include <deque> | 8 #include <deque> |
| 9 #include <map> | 9 #include <map> |
| 10 #include <set> | 10 #include <set> |
| 11 #include <string> | 11 #include <string> |
| 12 #include <vector> | 12 #include <vector> |
| 13 | 13 |
| 14 #include "base/gtest_prod_util.h" | 14 #include "base/gtest_prod_util.h" |
| 15 #include "base/memory/ref_counted.h" | 15 #include "base/memory/ref_counted.h" |
| 16 #include "base/time/time.h" | 16 #include "base/time/time.h" |
| 17 #include "content/browser/appcache/appcache.h" |
| 18 #include "content/browser/appcache/appcache_host.h" |
| 19 #include "content/browser/appcache/appcache_response.h" |
| 20 #include "content/browser/appcache/appcache_service_impl.h" |
| 21 #include "content/browser/appcache/appcache_storage.h" |
| 22 #include "content/common/appcache_interfaces.h" |
| 23 #include "content/common/content_export.h" |
| 17 #include "net/base/completion_callback.h" | 24 #include "net/base/completion_callback.h" |
| 18 #include "net/http/http_response_headers.h" | 25 #include "net/http/http_response_headers.h" |
| 19 #include "net/url_request/url_request.h" | 26 #include "net/url_request/url_request.h" |
| 20 #include "url/gurl.h" | 27 #include "url/gurl.h" |
| 21 #include "webkit/browser/appcache/appcache.h" | |
| 22 #include "webkit/browser/appcache/appcache_host.h" | |
| 23 #include "webkit/browser/appcache/appcache_response.h" | |
| 24 #include "webkit/browser/appcache/appcache_service_impl.h" | |
| 25 #include "webkit/browser/appcache/appcache_storage.h" | |
| 26 #include "webkit/browser/webkit_storage_browser_export.h" | |
| 27 #include "webkit/common/appcache/appcache_interfaces.h" | |
| 28 | 28 |
| 29 namespace content { | 29 namespace content { |
| 30 FORWARD_DECLARE_TEST(AppCacheGroupTest, QueueUpdate); | 30 FORWARD_DECLARE_TEST(AppCacheGroupTest, QueueUpdate); |
| 31 class AppCacheGroupTest; | 31 class AppCacheGroupTest; |
| 32 class AppCacheUpdateJobTest; | 32 class AppCacheUpdateJobTest; |
| 33 } | 33 } |
| 34 | 34 |
| 35 namespace appcache { | 35 namespace content { |
| 36 | 36 |
| 37 class HostNotifier; | 37 class HostNotifier; |
| 38 | 38 |
| 39 // Application cache Update algorithm and state. | 39 // Application cache Update algorithm and state. |
| 40 class WEBKIT_STORAGE_BROWSER_EXPORT AppCacheUpdateJob | 40 class CONTENT_EXPORT AppCacheUpdateJob |
| 41 : public AppCacheStorage::Delegate, | 41 : public AppCacheStorage::Delegate, |
| 42 public AppCacheHost::Observer, | 42 public AppCacheHost::Observer, |
| 43 public AppCacheServiceImpl::Observer { | 43 public AppCacheServiceImpl::Observer { |
| 44 public: | 44 public: |
| 45 // Used for uma stats only for now, so new values are append only. | 45 // Used for uma stats only for now, so new values are append only. |
| 46 enum ResultType { | 46 enum ResultType { |
| 47 UPDATE_OK, DB_ERROR, DISKCACHE_ERROR, APPCACHE_QUOTA_ERROR, REDIRECT_ERROR, | 47 UPDATE_OK, DB_ERROR, DISKCACHE_ERROR, QUOTA_ERROR, REDIRECT_ERROR, |
| 48 APPCACHE_MANIFEST_ERROR, NETWORK_ERROR, SERVER_ERROR, CANCELLED_ERROR, | 48 MANIFEST_ERROR, NETWORK_ERROR, SERVER_ERROR, CANCELLED_ERROR, |
| 49 NUM_UPDATE_JOB_RESULT_TYPES | 49 NUM_UPDATE_JOB_RESULT_TYPES |
| 50 }; | 50 }; |
| 51 | 51 |
| 52 AppCacheUpdateJob(AppCacheServiceImpl* service, AppCacheGroup* group); | 52 AppCacheUpdateJob(AppCacheServiceImpl* service, AppCacheGroup* group); |
| 53 virtual ~AppCacheUpdateJob(); | 53 virtual ~AppCacheUpdateJob(); |
| 54 | 54 |
| 55 // Triggers the update process or adds more info if this update is already | 55 // Triggers the update process or adds more info if this update is already |
| 56 // in progress. | 56 // in progress. |
| 57 void StartUpdate(AppCacheHost* host, const GURL& new_master_resource); | 57 void StartUpdate(AppCacheHost* host, const GURL& new_master_resource); |
| 58 | 58 |
| (...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 340 // Whether we've stored the resulting group/cache yet. | 340 // Whether we've stored the resulting group/cache yet. |
| 341 StoredState stored_state_; | 341 StoredState stored_state_; |
| 342 | 342 |
| 343 AppCacheStorage* storage_; | 343 AppCacheStorage* storage_; |
| 344 | 344 |
| 345 FRIEND_TEST_ALL_PREFIXES(content::AppCacheGroupTest, QueueUpdate); | 345 FRIEND_TEST_ALL_PREFIXES(content::AppCacheGroupTest, QueueUpdate); |
| 346 | 346 |
| 347 DISALLOW_COPY_AND_ASSIGN(AppCacheUpdateJob); | 347 DISALLOW_COPY_AND_ASSIGN(AppCacheUpdateJob); |
| 348 }; | 348 }; |
| 349 | 349 |
| 350 } // namespace appcache | 350 } // namespace content |
| 351 | 351 |
| 352 #endif // WEBKIT_BROWSER_APPCACHE_APPCACHE_UPDATE_JOB_H_ | 352 #endif // CONTENT_BROWSER_APPCACHE_APPCACHE_UPDATE_JOB_H_ |
| OLD | NEW |