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

Side by Side Diff: webkit/appcache/appcache_interfaces.h

Issue 3009005: Chrome side of changes required to populate appcache resource list.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 4 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
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_INTERFACES_H_ 5 #ifndef WEBKIT_APPCACHE_APPCACHE_INTERFACES_H_
6 #define WEBKIT_APPCACHE_APPCACHE_INTERFACES_H_ 6 #define WEBKIT_APPCACHE_APPCACHE_INTERFACES_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
11 #include "base/file_path.h" 11 #include "base/file_path.h"
12 #include "base/time.h"
13 #include "googleurl/src/gurl.h"
12 14
13 class GURL;
14 class URLRequest; 15 class URLRequest;
15 16
16 namespace appcache { 17 namespace appcache {
17 18
18 // Defines constants, types, and abstract classes used in the main 19 // Defines constants, types, and abstract classes used in the main
19 // process and in child processes. 20 // process and in child processes.
20 extern const char kManifestMimeType[]; 21 extern const char kManifestMimeType[];
21 22
22 static const int kNoHostId = 0; 23 static const int kNoHostId = 0;
23 static const int64 kNoCacheId = 0; 24 static const int64 kNoCacheId = 0;
(...skipping 20 matching lines...) Expand all
44 OBSOLETE_EVENT 45 OBSOLETE_EVENT
45 }; 46 };
46 47
47 enum LogLevel { 48 enum LogLevel {
48 LOG_TIP, 49 LOG_TIP,
49 LOG_INFO, 50 LOG_INFO,
50 LOG_WARNING, 51 LOG_WARNING,
51 LOG_ERROR, 52 LOG_ERROR,
52 }; 53 };
53 54
55 struct AppCacheInfo {
56 GURL manifest_url;
57 base::Time creation_time;
58 base::Time last_update_time;
59 base::Time last_access_time;
60 int64 cache_id;
61 Status status;
62 int64 size;
63 bool is_complete;
64 AppCacheInfo() : cache_id(kNoCacheId), status(UNCACHED),
65 size(0), is_complete(false) { }
66 };
67
68 typedef std::vector<AppCacheInfo> AppCacheInfoVector;
69
70 // POD type to hold information about a single appcache resource.
71 struct AppCacheResourceInfo {
72 GURL url;
73 int64 size;
74 bool is_master;
75 bool is_manifest;
76 bool is_fallback;
77 bool is_foreign;
78 bool is_explicit;
79 };
80
54 // Interface used by backend (browser-process) to talk to frontend (renderer). 81 // Interface used by backend (browser-process) to talk to frontend (renderer).
55 class AppCacheFrontend { 82 class AppCacheFrontend {
56 public: 83 public:
57 virtual void OnCacheSelected(int host_id, int64 cache_id , 84 virtual void OnCacheSelected(
58 Status status) = 0; 85 int host_id, const appcache::AppCacheInfo& info) = 0;
59 virtual void OnStatusChanged(const std::vector<int>& host_ids, 86 virtual void OnStatusChanged(const std::vector<int>& host_ids,
60 Status status) = 0; 87 Status status) = 0;
61 virtual void OnEventRaised(const std::vector<int>& host_ids, 88 virtual void OnEventRaised(const std::vector<int>& host_ids,
62 EventID event_id) = 0; 89 EventID event_id) = 0;
63 virtual void OnProgressEventRaised(const std::vector<int>& host_ids, 90 virtual void OnProgressEventRaised(const std::vector<int>& host_ids,
64 const GURL& url, 91 const GURL& url,
65 int num_total, int num_complete) = 0; 92 int num_total, int num_complete) = 0;
66 virtual void OnErrorEventRaised(const std::vector<int>& host_ids, 93 virtual void OnErrorEventRaised(const std::vector<int>& host_ids,
67 const std::string& message) = 0; 94 const std::string& message) = 0;
68 virtual void OnContentBlocked(int host_id, 95 virtual void OnContentBlocked(int host_id,
(...skipping 17 matching lines...) Expand all
86 int parent_process_id, 113 int parent_process_id,
87 int parent_host_id) = 0; 114 int parent_host_id) = 0;
88 virtual void SelectCacheForSharedWorker( 115 virtual void SelectCacheForSharedWorker(
89 int host_id, 116 int host_id,
90 int64 appcache_id) = 0; 117 int64 appcache_id) = 0;
91 virtual void MarkAsForeignEntry(int host_id, const GURL& document_url, 118 virtual void MarkAsForeignEntry(int host_id, const GURL& document_url,
92 int64 cache_document_was_loaded_from) = 0; 119 int64 cache_document_was_loaded_from) = 0;
93 virtual Status GetStatus(int host_id) = 0; 120 virtual Status GetStatus(int host_id) = 0;
94 virtual bool StartUpdate(int host_id) = 0; 121 virtual bool StartUpdate(int host_id) = 0;
95 virtual bool SwapCache(int host_id) = 0; 122 virtual bool SwapCache(int host_id) = 0;
123 virtual void GetResourceList(
124 int host_id, std::vector<AppCacheResourceInfo>* resource_infos) = 0;
96 125
97 virtual ~AppCacheBackend() {} 126 virtual ~AppCacheBackend() {}
98 }; 127 };
99 128
100 // Useful string constants. 129 // Useful string constants.
101 // Note: These are also defined elsewhere in the chrome code base in 130 // Note: These are also defined elsewhere in the chrome code base in
102 // url_contants.h .cc, however the appcache library doesn't not have 131 // url_contants.h .cc, however the appcache library doesn't not have
103 // any dependencies on the chrome library, so we can't use them in here. 132 // any dependencies on the chrome library, so we can't use them in here.
104 extern const char kHttpScheme[]; 133 extern const char kHttpScheme[];
105 extern const char kHttpsScheme[]; 134 extern const char kHttpsScheme[];
106 extern const char kHttpGETMethod[]; 135 extern const char kHttpGETMethod[];
107 extern const char kHttpHEADMethod[]; 136 extern const char kHttpHEADMethod[];
108 137
109 bool IsSchemeSupported(const GURL& url); 138 bool IsSchemeSupported(const GURL& url);
110 bool IsMethodSupported(const std::string& method); 139 bool IsMethodSupported(const std::string& method);
111 bool IsSchemeAndMethodSupported(const URLRequest* request); 140 bool IsSchemeAndMethodSupported(const URLRequest* request);
112 141
113 extern const FilePath::CharType kAppCacheDatabaseName[]; 142 extern const FilePath::CharType kAppCacheDatabaseName[];
114 143
115 } // namespace 144 } // namespace
116 145
117 #endif // WEBKIT_APPCACHE_APPCACHE_INTERFACES_H_ 146 #endif // WEBKIT_APPCACHE_APPCACHE_INTERFACES_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698