summaryrefslogtreecommitdiffstats
path: root/webkit/appcache
diff options
context:
space:
mode:
authorkkanetkar@chromium.org <kkanetkar@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-07-28 03:14:37 +0000
committerkkanetkar@chromium.org <kkanetkar@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-07-28 03:14:37 +0000
commitec5c192817606b55ad99edb256997b70eea41b85 (patch)
tree16e863d9b1fa02f029c050b028177b7c984da6eb /webkit/appcache
parent16d35b25ec19b82c13dc7cd24f744951cc12fad0 (diff)
downloadchromium_src-ec5c192817606b55ad99edb256997b70eea41b85.zip
chromium_src-ec5c192817606b55ad99edb256997b70eea41b85.tar.gz
chromium_src-ec5c192817606b55ad99edb256997b70eea41b85.tar.bz2
Chrome side of changes required to populate appcache resource list.
BUG = 2821005 TEST = Manually navigate. Review URL: http://codereview.chromium.org/3009005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@53902 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/appcache')
-rw-r--r--webkit/appcache/appcache.cc7
-rw-r--r--webkit/appcache/appcache.h5
-rw-r--r--webkit/appcache/appcache_backend_impl.cc9
-rw-r--r--webkit/appcache/appcache_backend_impl.h2
-rw-r--r--webkit/appcache/appcache_frontend_impl.cc6
-rw-r--r--webkit/appcache/appcache_frontend_impl.h5
-rw-r--r--webkit/appcache/appcache_group.h4
-rw-r--r--webkit/appcache/appcache_group_unittest.cc11
-rw-r--r--webkit/appcache/appcache_host.cc36
-rw-r--r--webkit/appcache/appcache_host.h3
-rw-r--r--webkit/appcache/appcache_host_unittest.cc8
-rw-r--r--webkit/appcache/appcache_interfaces.h35
-rw-r--r--webkit/appcache/appcache_request_handler_unittest.cc4
-rw-r--r--webkit/appcache/appcache_service.h24
-rw-r--r--webkit/appcache/appcache_storage_impl.cc21
-rw-r--r--webkit/appcache/appcache_update_job_unittest.cc4
-rw-r--r--webkit/appcache/web_application_cache_host_impl.cc41
-rw-r--r--webkit/appcache/web_application_cache_host_impl.h10
18 files changed, 170 insertions, 65 deletions
diff --git a/webkit/appcache/appcache.cc b/webkit/appcache/appcache.cc
index e1819d4..4bc7294 100644
--- a/webkit/appcache/appcache.cc
+++ b/webkit/appcache/appcache.cc
@@ -21,6 +21,7 @@ AppCache::AppCache(AppCacheService *service, int64 cache_id)
owning_group_(NULL),
online_whitelist_all_(false),
is_complete_(false),
+ cache_size_(0),
service_(service) {
service_->storage()->working_set()->AddCache(this);
}
@@ -51,7 +52,8 @@ bool AppCache::AddOrModifyEntry(const GURL& url, const AppCacheEntry& entry) {
// Entry already exists. Merge the types of the new and existing entries.
if (!ret.second)
ret.first->second.add_types(entry.types());
-
+ else
+ cache_size_ += entry.response_size(); // New entry. Add to cache size.
return ret.second;
}
@@ -61,12 +63,10 @@ AppCacheEntry* AppCache::GetEntry(const GURL& url) {
}
namespace {
-
bool SortByLength(
const FallbackNamespace& lhs, const FallbackNamespace& rhs) {
return lhs.first.spec().length() > rhs.first.spec().length();
}
-
}
void AppCache::InitializeWithManifest(Manifest* manifest) {
@@ -162,7 +162,6 @@ void AppCache::ToDatabaseRecords(
}
}
-
bool AppCache::FindResponseForRequest(const GURL& url,
AppCacheEntry* found_entry, AppCacheEntry* found_fallback_entry,
GURL* found_fallback_namespace, bool* found_network_namespace) {
diff --git a/webkit/appcache/appcache.h b/webkit/appcache/appcache.h
index 325c5113..eab23bb 100644
--- a/webkit/appcache/appcache.h
+++ b/webkit/appcache/appcache.h
@@ -72,6 +72,9 @@ class AppCache : public base::RefCounted<AppCache> {
}
base::Time update_time() const { return update_time_; }
+
+ int64 cache_size() const { return cache_size_; }
+
void set_update_time(base::Time ticks) { update_time_ = ticks; }
// Initializes the cache with information in the manifest.
@@ -135,6 +138,8 @@ class AppCache : public base::RefCounted<AppCache> {
// when this cache was last updated
base::Time update_time_;
+ int64 cache_size_;
+
// to notify service when cache is deleted
AppCacheService* service_;
diff --git a/webkit/appcache/appcache_backend_impl.cc b/webkit/appcache/appcache_backend_impl.cc
index 6bacc26..e077a33 100644
--- a/webkit/appcache/appcache_backend_impl.cc
+++ b/webkit/appcache/appcache_backend_impl.cc
@@ -123,4 +123,13 @@ bool AppCacheBackendImpl::SwapCacheWithCallback(
return true;
}
+void AppCacheBackendImpl::GetResourceList(
+ int host_id, std::vector<appcache::AppCacheResourceInfo>* resource_infos) {
+ AppCacheHost* host = GetHost(host_id);
+ if (!host)
+ return;
+
+ host->GetResourceList(resource_infos);
+}
+
} // namespace appcache
diff --git a/webkit/appcache/appcache_backend_impl.h b/webkit/appcache/appcache_backend_impl.h
index b957ae3..d299641 100644
--- a/webkit/appcache/appcache_backend_impl.h
+++ b/webkit/appcache/appcache_backend_impl.h
@@ -32,6 +32,8 @@ class AppCacheBackendImpl {
const GURL& document_url,
const int64 cache_document_was_loaded_from,
const GURL& manifest_url);
+ void GetResourceList(
+ int host_id, std::vector<AppCacheResourceInfo>* resource_infos);
bool SelectCacheForWorker(int host_id, int parent_process_id,
int parent_host_id);
bool SelectCacheForSharedWorker(int host_id, int64 appcache_id);
diff --git a/webkit/appcache/appcache_frontend_impl.cc b/webkit/appcache/appcache_frontend_impl.cc
index 812ae69..f39cbd2 100644
--- a/webkit/appcache/appcache_frontend_impl.cc
+++ b/webkit/appcache/appcache_frontend_impl.cc
@@ -14,11 +14,11 @@ inline WebApplicationCacheHostImpl* GetHost(int id) {
return WebApplicationCacheHostImpl::FromId(id);
}
-void AppCacheFrontendImpl::OnCacheSelected(int host_id, int64 cache_id ,
- Status status) {
+void AppCacheFrontendImpl::OnCacheSelected(
+ int host_id, const AppCacheInfo& info) {
WebApplicationCacheHostImpl* host = GetHost(host_id);
if (host)
- host->OnCacheSelected(cache_id, status);
+ host->OnCacheSelected(info);
}
void AppCacheFrontendImpl::OnStatusChanged(const std::vector<int>& host_ids,
diff --git a/webkit/appcache/appcache_frontend_impl.h b/webkit/appcache/appcache_frontend_impl.h
index e05dcb7..159cbec 100644
--- a/webkit/appcache/appcache_frontend_impl.h
+++ b/webkit/appcache/appcache_frontend_impl.h
@@ -5,6 +5,7 @@
#ifndef WEBKIT_APPCACHE_APPCACHE_FRONTEND_IMPL_H_
#define WEBKIT_APPCACHE_APPCACHE_FRONTEND_IMPL_H_
+#include <string>
#include <vector>
#include "webkit/appcache/appcache_interfaces.h"
@@ -12,8 +13,8 @@ namespace appcache {
class AppCacheFrontendImpl : public AppCacheFrontend {
public:
- virtual void OnCacheSelected(int host_id, int64 cache_id,
- Status status);
+ virtual void OnCacheSelected(
+ int host_id, const appcache::AppCacheInfo& info);
virtual void OnStatusChanged(const std::vector<int>& host_ids,
Status status);
virtual void OnEventRaised(const std::vector<int>& host_ids,
diff --git a/webkit/appcache/appcache_group.h b/webkit/appcache/appcache_group.h
index a811337..efcec48 100644
--- a/webkit/appcache/appcache_group.h
+++ b/webkit/appcache/appcache_group.h
@@ -54,7 +54,8 @@ class AppCacheGroup : public base::RefCounted<AppCacheGroup> {
int64 group_id() const { return group_id_; }
const GURL& manifest_url() const { return manifest_url_; }
-
+ const base::Time& creation_time() const { return creation_time_; }
+ void set_creation_time(const base::Time& time) { creation_time_ = time; }
bool is_obsolete() const { return is_obsolete_; }
void set_obsolete(bool value) { is_obsolete_ = value; }
@@ -122,6 +123,7 @@ class AppCacheGroup : public base::RefCounted<AppCacheGroup> {
const int64 group_id_;
const GURL manifest_url_;
+ base::Time creation_time_;
UpdateStatus update_status_;
bool is_obsolete_;
bool is_being_deleted_;
diff --git a/webkit/appcache/appcache_group_unittest.cc b/webkit/appcache/appcache_group_unittest.cc
index 2c6ed14..128fbc7 100644
--- a/webkit/appcache/appcache_group_unittest.cc
+++ b/webkit/appcache/appcache_group_unittest.cc
@@ -2,12 +2,15 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include <string>
+
#include "testing/gtest/include/gtest/gtest.h"
#include "webkit/appcache/appcache.h"
#include "webkit/appcache/appcache_group.h"
#include "webkit/appcache/appcache_host.h"
#include "webkit/appcache/mock_appcache_service.h"
#include "webkit/appcache/appcache_update_job.h"
+#include "webkit/appcache/appcache_interfaces.h"
namespace {
@@ -18,11 +21,11 @@ class TestAppCacheFrontend : public appcache::AppCacheFrontend {
last_status_(appcache::OBSOLETE) {
}
- virtual void OnCacheSelected(int host_id, int64 cache_id ,
- appcache::Status status) {
+ virtual void OnCacheSelected(
+ int host_id, const appcache::AppCacheInfo& info) {
last_host_id_ = host_id;
- last_cache_id_ = cache_id;
- last_status_ = status;
+ last_cache_id_ = info.cache_id;
+ last_status_ = info.status;
}
virtual void OnStatusChanged(const std::vector<int>& host_ids,
diff --git a/webkit/appcache/appcache_host.cc b/webkit/appcache/appcache_host.cc
index c4e8b62..66cf2a8 100644
--- a/webkit/appcache/appcache_host.cc
+++ b/webkit/appcache/appcache_host.cc
@@ -252,6 +252,25 @@ AppCacheRequestHandler* AppCacheHost::CreateRequestHandler(
return NULL;
}
+void AppCacheHost::GetResourceList(
+ std::vector<AppCacheResourceInfo>* resource_infos) {
+ if (associated_cache_.get() && associated_cache_->is_complete()) {
+ for (AppCache::EntryMap::const_iterator it =
+ associated_cache_->entries().begin();
+ it != associated_cache_->entries().end(); ++it) {
+ AppCacheResourceInfo info;
+ info.url = it->first;
+ info.is_master = it->second.IsMaster();
+ info.is_manifest = it->second.IsManifest();
+ info.is_fallback = it->second.IsFallback();
+ info.is_foreign = it->second.IsForeign();
+ info.is_explicit = it->second.IsExplicit();
+ info.size = it->second.response_size();
+ resource_infos->push_back(info);
+ }
+ }
+}
+
Status AppCacheHost::GetStatus() {
// 6.9.8 Application cache API
AppCache* cache = associated_cache();
@@ -417,12 +436,23 @@ void AppCacheHost::AssociateCache(AppCache* cache) {
associated_cache_ = cache;
SetSwappableCache(cache ? cache->owning_group() : NULL);
-
+ AppCacheInfo info;
if (cache) {
cache->AssociateHost(this);
- frontend_->OnCacheSelected(host_id_, cache->cache_id(), GetStatus());
+ info.cache_id = cache->cache_id();
+ info.status = GetStatus();
+ info.is_complete = cache->is_complete();
+ if (cache->is_complete()) {
+ // TODO(kkanetkar): Get manifest URL info for NULL owning_group().
+ info.manifest_url = cache->owning_group()->manifest_url();
+ info.last_update_time = cache->update_time();
+ info.creation_time = cache->owning_group()->creation_time();
+ info.size = cache->cache_size();
+ }
+ frontend_->OnCacheSelected(host_id_, info);
} else {
- frontend_->OnCacheSelected(host_id_, kNoCacheId, UNCACHED);
+ // No Cache.
+ frontend_->OnCacheSelected(host_id_, info);
}
}
diff --git a/webkit/appcache/appcache_host.h b/webkit/appcache/appcache_host.h
index 7701f95..ff87b5f 100644
--- a/webkit/appcache/appcache_host.h
+++ b/webkit/appcache/appcache_host.h
@@ -74,6 +74,9 @@ class AppCacheHost : public AppCacheStorage::Delegate,
AppCacheRequestHandler* CreateRequestHandler(
URLRequest* request, ResourceType::Type resource_type);
+ // Support for devtools inspecting appcache resources.
+ void GetResourceList(std::vector<AppCacheResourceInfo>* resource_infos);
+
// Establishes an association between this host and a cache. 'cache' may be
// NULL to break any existing association. Associations are established
// either thru the cache selection algorithm implemented (in this class),
diff --git a/webkit/appcache/appcache_host_unittest.cc b/webkit/appcache/appcache_host_unittest.cc
index 0671eb7..4f83928 100644
--- a/webkit/appcache/appcache_host_unittest.cc
+++ b/webkit/appcache/appcache_host_unittest.cc
@@ -34,11 +34,11 @@ class AppCacheHostTest : public testing::Test {
last_event_id_(appcache::OBSOLETE_EVENT) {
}
- virtual void OnCacheSelected(int host_id, int64 cache_id ,
- appcache::Status status) {
+ virtual void OnCacheSelected(
+ int host_id, const appcache::AppCacheInfo& info) {
last_host_id_ = host_id;
- last_cache_id_ = cache_id;
- last_status_ = status;
+ last_cache_id_ = info.cache_id;
+ last_status_ = info.status;
}
virtual void OnStatusChanged(const std::vector<int>& host_ids,
diff --git a/webkit/appcache/appcache_interfaces.h b/webkit/appcache/appcache_interfaces.h
index 1956135..1dfd326 100644
--- a/webkit/appcache/appcache_interfaces.h
+++ b/webkit/appcache/appcache_interfaces.h
@@ -9,8 +9,9 @@
#include <vector>
#include "base/basictypes.h"
#include "base/file_path.h"
+#include "base/time.h"
+#include "googleurl/src/gurl.h"
-class GURL;
class URLRequest;
namespace appcache {
@@ -51,11 +52,37 @@ enum LogLevel {
LOG_ERROR,
};
+struct AppCacheInfo {
+ GURL manifest_url;
+ base::Time creation_time;
+ base::Time last_update_time;
+ base::Time last_access_time;
+ int64 cache_id;
+ Status status;
+ int64 size;
+ bool is_complete;
+ AppCacheInfo() : cache_id(kNoCacheId), status(UNCACHED),
+ size(0), is_complete(false) { }
+};
+
+typedef std::vector<AppCacheInfo> AppCacheInfoVector;
+
+// POD type to hold information about a single appcache resource.
+struct AppCacheResourceInfo {
+ GURL url;
+ int64 size;
+ bool is_master;
+ bool is_manifest;
+ bool is_fallback;
+ bool is_foreign;
+ bool is_explicit;
+};
+
// Interface used by backend (browser-process) to talk to frontend (renderer).
class AppCacheFrontend {
public:
- virtual void OnCacheSelected(int host_id, int64 cache_id ,
- Status status) = 0;
+ virtual void OnCacheSelected(
+ int host_id, const appcache::AppCacheInfo& info) = 0;
virtual void OnStatusChanged(const std::vector<int>& host_ids,
Status status) = 0;
virtual void OnEventRaised(const std::vector<int>& host_ids,
@@ -93,6 +120,8 @@ class AppCacheBackend {
virtual Status GetStatus(int host_id) = 0;
virtual bool StartUpdate(int host_id) = 0;
virtual bool SwapCache(int host_id) = 0;
+ virtual void GetResourceList(
+ int host_id, std::vector<AppCacheResourceInfo>* resource_infos) = 0;
virtual ~AppCacheBackend() {}
};
diff --git a/webkit/appcache/appcache_request_handler_unittest.cc b/webkit/appcache/appcache_request_handler_unittest.cc
index a857be6..8d22a49 100644
--- a/webkit/appcache/appcache_request_handler_unittest.cc
+++ b/webkit/appcache/appcache_request_handler_unittest.cc
@@ -27,8 +27,8 @@ class AppCacheRequestHandlerTest : public testing::Test {
public:
class MockFrontend : public AppCacheFrontend {
public:
- virtual void OnCacheSelected(int host_id, int64 cache_id ,
- appcache::Status status) {}
+ virtual void OnCacheSelected(
+ int host_id, const appcache::AppCacheInfo& info) {}
virtual void OnStatusChanged(const std::vector<int>& host_ids,
appcache::Status status) {}
diff --git a/webkit/appcache/appcache_service.h b/webkit/appcache/appcache_service.h
index ac5aa4a..6ba04c8 100644
--- a/webkit/appcache/appcache_service.h
+++ b/webkit/appcache/appcache_service.h
@@ -15,6 +15,7 @@
#include "net/base/completion_callback.h"
#include "net/base/net_errors.h"
#include "testing/gtest/include/gtest/gtest_prod.h"
+#include "webkit/appcache/appcache_interfaces.h"
#include "webkit/appcache/appcache_storage.h"
class URLRequestContext;
@@ -28,29 +29,6 @@ namespace appcache {
class AppCacheBackendImpl;
class AppCachePolicy;
-// Structure that contains basic info about an appcache.
-struct AppCacheInfo {
- AppCacheInfo() {}
- AppCacheInfo(const GURL& manifest_url,
- int64 size,
- base::Time creation_time,
- base::Time last_access_time,
- base::Time last_update_time)
- : manifest_url(manifest_url),
- size(size),
- creation_time(creation_time),
- last_access_time(last_access_time),
- last_update_time(last_update_time) {
- }
- GURL manifest_url;
- int64 size;
- base::Time creation_time;
- base::Time last_access_time;
- base::Time last_update_time;
-};
-
-typedef std::vector<AppCacheInfo> AppCacheInfoVector;
-
// Refcounted container to avoid copying the collection in callbacks.
struct AppCacheInfoCollection
: public base::RefCountedThreadSafe<AppCacheInfoCollection> {
diff --git a/webkit/appcache/appcache_storage_impl.cc b/webkit/appcache/appcache_storage_impl.cc
index 265ff30..3f9ba1a 100644
--- a/webkit/appcache/appcache_storage_impl.cc
+++ b/webkit/appcache/appcache_storage_impl.cc
@@ -221,11 +221,15 @@ void AppCacheStorageImpl::GetAllInfoTask::Run() {
group != groups.end(); ++group) {
AppCacheDatabase::CacheRecord cache_record;
database_->FindCacheForGroup(group->group_id, &cache_record);
- infos.push_back(
- AppCacheInfo(
- group->manifest_url, cache_record.cache_size,
- group->creation_time, group->last_access_time,
- cache_record.update_time));
+ AppCacheInfo info;
+ info.manifest_url = group->manifest_url;
+ info.creation_time = group->creation_time;
+ info.size = cache_record.cache_size;
+ info.last_access_time = group->last_access_time;
+ info.last_update_time = cache_record.update_time;
+ info.cache_id = cache_record.cache_id;
+ info.is_complete = true;
+ infos.push_back(info);
}
}
}
@@ -282,6 +286,7 @@ void AppCacheStorageImpl::StoreOrLoadTask::CreateCacheAndGroupFromRecords(
(*group) = new AppCacheGroup(
storage_->service_, group_record_.manifest_url,
group_record_.group_id);
+ group->get()->set_creation_time(group_record_.creation_time);
group->get()->AddCache(cache->get());
}
DCHECK(group->get()->newest_complete_cache() == cache->get());
@@ -376,8 +381,7 @@ void AppCacheStorageImpl::GroupLoadTask::RunCompleted() {
CreateCacheAndGroupFromRecords(&cache, &group);
} else {
group = new AppCacheGroup(
- storage_->service_, manifest_url_,
- storage_->NewGroupId());
+ storage_->service_, manifest_url_, storage_->NewGroupId());
}
}
FOR_EACH_DELEGATE(delegates_, OnGroupLoaded(group, manifest_url_));
@@ -483,6 +487,7 @@ void AppCacheStorageImpl::StoreGroupAndCacheTask::Run() {
void AppCacheStorageImpl::StoreGroupAndCacheTask::RunCompleted() {
if (success_) {
+ // TODO(kkanetkar): Add to creation time when that's enabled.
storage_->origins_with_groups_.insert(group_->manifest_url().GetOrigin());
if (cache_ != group_->newest_complete_cache()) {
cache_->set_complete(true);
@@ -536,13 +541,11 @@ class AppCacheStorageImpl::FindMainResponseTask : public DatabaseTask {
};
namespace {
-
bool SortByLength(
const AppCacheDatabase::FallbackNameSpaceRecord& lhs,
const AppCacheDatabase::FallbackNameSpaceRecord& rhs) {
return lhs.namespace_url.spec().length() > rhs.namespace_url.spec().length();
}
-
}
void AppCacheStorageImpl::FindMainResponseTask::Run() {
diff --git a/webkit/appcache/appcache_update_job_unittest.cc b/webkit/appcache/appcache_update_job_unittest.cc
index 0bcda2c..46dce34 100644
--- a/webkit/appcache/appcache_update_job_unittest.cc
+++ b/webkit/appcache/appcache_update_job_unittest.cc
@@ -167,8 +167,8 @@ class MockFrontend : public AppCacheFrontend {
start_update_trigger_(CHECKING_EVENT), update_(NULL) {
}
- virtual void OnCacheSelected(int host_id, int64 cache_id,
- Status status) {
+ virtual void OnCacheSelected(
+ int host_id, const appcache::AppCacheInfo& info) {
}
virtual void OnStatusChanged(const std::vector<int>& host_ids,
diff --git a/webkit/appcache/web_application_cache_host_impl.cc b/webkit/appcache/web_application_cache_host_impl.cc
index 042a06f..82f8eb3 100644
--- a/webkit/appcache/web_application_cache_host_impl.cc
+++ b/webkit/appcache/web_application_cache_host_impl.cc
@@ -21,6 +21,7 @@ using WebKit::WebFrame;
using WebKit::WebURLRequest;
using WebKit::WebURL;
using WebKit::WebURLResponse;
+using WebKit::WebVector;
namespace appcache {
@@ -87,10 +88,12 @@ WebApplicationCacheHostImpl::~WebApplicationCacheHostImpl() {
all_hosts()->Remove(host_id_);
}
-void WebApplicationCacheHostImpl::OnCacheSelected(int64 selected_cache_id,
- appcache::Status status) {
- status_ = status;
+void WebApplicationCacheHostImpl::OnCacheSelected(
+ const appcache::AppCacheInfo& info) {
+ status_ = info.status;
has_status_ = true;
+ cache_info_ = info;
+ client_->didChangeCacheAssociation();
}
void WebApplicationCacheHostImpl::OnStatusChanged(appcache::Status status) {
@@ -169,6 +172,38 @@ void WebApplicationCacheHostImpl::selectCacheWithoutManifest() {
GURL());
}
+void WebApplicationCacheHostImpl::getAssociatedCacheInfo(
+ WebApplicationCacheHost::CacheInfo* info) {
+ if (!cache_info_.is_complete)
+ return;
+ info->manifestURL = cache_info_.manifest_url;
+ info->creationTime = cache_info_.creation_time.ToDoubleT();
+ info->updateTime = cache_info_.last_update_time.ToDoubleT();
+ info->totalSize = cache_info_.size;
+}
+
+void WebApplicationCacheHostImpl::getResourceList(
+ WebVector<ResourceInfo>* resources) {
+ if (!cache_info_.is_complete)
+ return;
+ std::vector<AppCacheResourceInfo> resource_infos;
+ backend_->GetResourceList(host_id_, &resource_infos);
+
+ WebVector<ResourceInfo> web_resources(resource_infos.size());
+ // Convert resource_infos to WebKit API.
+ for (size_t i = 0; i < resource_infos.size(); ++i) {
+ web_resources[i].size = resource_infos[i].size;
+ web_resources[i].isMaster = resource_infos[i].is_master;
+ web_resources[i].isExplicit = resource_infos[i].is_explicit;
+ web_resources[i].isManifest = resource_infos[i].is_manifest;
+ web_resources[i].isForeign = resource_infos[i].is_foreign;
+ web_resources[i].isFallback = resource_infos[i].is_fallback;
+ web_resources[i].url = resource_infos[i].url;
+ }
+
+ resources->swap(web_resources);
+}
+
bool WebApplicationCacheHostImpl::selectCacheWithManifest(
const WebURL& manifest_url) {
// Reset any previous status values we've received from the backend
diff --git a/webkit/appcache/web_application_cache_host_impl.h b/webkit/appcache/web_application_cache_host_impl.h
index f71398f..cdb812a 100644
--- a/webkit/appcache/web_application_cache_host_impl.h
+++ b/webkit/appcache/web_application_cache_host_impl.h
@@ -5,9 +5,12 @@
#ifndef WEBKIT_APPCACHE_WEB_APPLICATION_CACHE_HOST_IMPL_H_
#define WEBKIT_APPCACHE_WEB_APPLICATION_CACHE_HOST_IMPL_H_
+#include <string>
+#include "base/time.h"
#include "googleurl/src/gurl.h"
#include "third_party/WebKit/WebKit/chromium/public/WebApplicationCacheHostClient.h"
#include "third_party/WebKit/WebKit/chromium/public/WebURLResponse.h"
+#include "third_party/WebKit/WebKit/chromium/public/WebVector.h"
#include "webkit/appcache/appcache_interfaces.h"
namespace WebKit {
@@ -32,14 +35,13 @@ class WebApplicationCacheHostImpl : public WebKit::WebApplicationCacheHost {
AppCacheBackend* backend() const { return backend_; }
WebKit::WebApplicationCacheHostClient* client() const { return client_; }
+ virtual void OnCacheSelected(const appcache::AppCacheInfo& info);
void OnStatusChanged(appcache::Status);
void OnEventRaised(appcache::EventID);
void OnProgressEventRaised(const GURL& url, int num_total, int num_complete);
void OnErrorEventRaised(const std::string& message);
virtual void OnLogMessage(LogLevel log_level, const std::string& message) {}
virtual void OnContentBlocked(const GURL& manifest_url) {}
- virtual void OnCacheSelected(int64 selected_cache_id,
- appcache::Status status);
// WebApplicationCacheHost methods
virtual void willStartMainResourceRequest(WebKit::WebURLRequest&);
@@ -52,6 +54,8 @@ class WebApplicationCacheHostImpl : public WebKit::WebApplicationCacheHost {
virtual WebKit::WebApplicationCacheHost::Status status();
virtual bool startUpdate();
virtual bool swapCache();
+ virtual void getResourceList(WebKit::WebVector<ResourceInfo>* resources);
+ virtual void getAssociatedCacheInfo(CacheInfo* info);
private:
enum IsNewMasterEntry {
@@ -72,9 +76,11 @@ class WebApplicationCacheHostImpl : public WebKit::WebApplicationCacheHost {
bool is_scheme_supported_;
bool is_get_method_;
IsNewMasterEntry is_new_master_entry_;
+ appcache::AppCacheInfo cache_info_;
GURL original_main_resource_url_; // Used to detect redirection.
};
} // namespace
#endif // WEBKIT_APPCACHE_WEB_APPLICATION_CACHE_HOST_IMPL_H_
+