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_VIEW_APPCACHE_INTERNALS_JOB_H_ | 5 #ifndef WEBKIT_APPCACHE_VIEW_APPCACHE_INTERNALS_JOB_H_ |
6 #define WEBKIT_APPCACHE_VIEW_APPCACHE_INTERNALS_JOB_H_ | 6 #define WEBKIT_APPCACHE_VIEW_APPCACHE_INTERNALS_JOB_H_ |
7 | 7 |
8 #include <string> | 8 #include "base/basictypes.h" |
9 | |
10 #include "net/url_request/url_request_simple_job.h" | |
11 #include "webkit/appcache/appcache_service.h" | |
12 | 9 |
13 namespace net { | 10 namespace net { |
14 class URLRequest; | 11 class URLRequest; |
15 } // namespace net | 12 class URLRequestJob; |
| 13 } |
16 | 14 |
17 namespace appcache { | 15 namespace appcache { |
18 | 16 |
19 // A job subclass that implements a protocol to inspect the internal | 17 class AppCacheService; |
20 // state of appcache service. | 18 |
21 class ViewAppCacheInternalsJob : public net::URLRequestSimpleJob { | 19 class ViewAppCacheInternalsJobFactory { |
22 public: | 20 public: |
23 // Stores handle to appcache service for getting information. | 21 static net::URLRequestJob* CreateJobForRequest( |
24 ViewAppCacheInternalsJob(net::URLRequest* request, AppCacheService* service); | 22 net::URLRequest* request, AppCacheService* service); |
25 | |
26 // Fetches the AppCache Info and calls StartAsync after it is done. | |
27 virtual void Start(); | |
28 | |
29 virtual bool GetData(std::string* mime_type, | |
30 std::string* charset, | |
31 std::string* data) const; | |
32 | |
33 // Overridden method from net::URLRequestJob. | |
34 virtual bool IsRedirectResponse(GURL* location, int* http_status_code); | |
35 | 23 |
36 private: | 24 private: |
37 virtual ~ViewAppCacheInternalsJob(); | 25 DISALLOW_IMPLICIT_CONSTRUCTORS(ViewAppCacheInternalsJobFactory); |
38 | |
39 void AppCacheDone(int rv); | |
40 | |
41 // Adds HTML from appcache information to out. | |
42 void GenerateHTMLAppCacheInfo(std::string* out) const; | |
43 void GetAppCacheInfoAsync(); | |
44 void RemoveAppCacheInfoAsync(const std::string& manifest_url_spec); | |
45 | |
46 // This is a common callback for both remove and getinfo for appcache. | |
47 scoped_refptr<net::CancelableCompletionCallback<ViewAppCacheInternalsJob> > | |
48 appcache_done_callback_; | |
49 | |
50 scoped_refptr<AppCacheInfoCollection> info_collection_; | |
51 // Not owned. | |
52 AppCacheService* appcache_service_; | |
53 | |
54 DISALLOW_COPY_AND_ASSIGN(ViewAppCacheInternalsJob); | |
55 }; | 26 }; |
56 | 27 |
57 } // namespace appcache | 28 } // namespace appcache |
58 | 29 |
59 #endif // WEBKIT_APPCACHE_VIEW_APPCACHE_INTERNALS_JOB_H_ | 30 #endif // WEBKIT_APPCACHE_VIEW_APPCACHE_INTERNALS_JOB_H_ |
OLD | NEW |