summaryrefslogtreecommitdiffstats
path: root/webkit/appcache
diff options
context:
space:
mode:
authormichaeln@google.com <michaeln@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-03-21 22:11:42 +0000
committermichaeln@google.com <michaeln@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-03-21 22:11:42 +0000
commite16b8af74c13f79282c608042d92fc1000fb5e62 (patch)
tree98d6594941193b24caaf66bd956fc1ea9eef0b58 /webkit/appcache
parent778574e9b16cb9438b5edb364e45bd88b02b2483 (diff)
downloadchromium_src-e16b8af74c13f79282c608042d92fc1000fb5e62.zip
chromium_src-e16b8af74c13f79282c608042d92fc1000fb5e62.tar.gz
chromium_src-e16b8af74c13f79282c608042d92fc1000fb5e62.tar.bz2
Plumbing to support loading from the "most appropriate" appcache.
BUG=68479 Review URL: http://codereview.chromium.org/6667057 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@78934 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/appcache')
-rw-r--r--webkit/appcache/appcache_backend_impl.cc13
-rw-r--r--webkit/appcache/appcache_backend_impl.h3
-rw-r--r--webkit/appcache/appcache_interfaces.h3
-rw-r--r--webkit/appcache/web_application_cache_host_impl.cc11
-rw-r--r--webkit/appcache/web_application_cache_host_impl.h5
5 files changed, 28 insertions, 7 deletions
diff --git a/webkit/appcache/appcache_backend_impl.cc b/webkit/appcache/appcache_backend_impl.cc
index a9349fa..8ada332 100644
--- a/webkit/appcache/appcache_backend_impl.cc
+++ b/webkit/appcache/appcache_backend_impl.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -53,6 +53,17 @@ bool AppCacheBackendImpl::UnregisterHost(int id) {
return true;
}
+bool AppCacheBackendImpl::SetSpawningHostId(
+ int host_id,
+ int spawning_host_id) {
+ AppCacheHost* host = GetHost(host_id);
+ if (!host)
+ return false;
+ // TODO(michaeln): Write me, see the bug for details.
+ // http://code.google.com/p/chromium/issues/detail?id=68479
+ return true;
+}
+
bool AppCacheBackendImpl::SelectCache(
int host_id,
const GURL& document_url,
diff --git a/webkit/appcache/appcache_backend_impl.h b/webkit/appcache/appcache_backend_impl.h
index ac563ff..9a0e1ae 100644
--- a/webkit/appcache/appcache_backend_impl.h
+++ b/webkit/appcache/appcache_backend_impl.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -28,6 +28,7 @@ class AppCacheBackendImpl {
// by the backend impl.
bool RegisterHost(int host_id);
bool UnregisterHost(int host_id);
+ bool SetSpawningHostId(int host_id, int spawning_host_id);
bool SelectCache(int host_id,
const GURL& document_url,
const int64 cache_document_was_loaded_from,
diff --git a/webkit/appcache/appcache_interfaces.h b/webkit/appcache/appcache_interfaces.h
index d29acd6..a251e21 100644
--- a/webkit/appcache/appcache_interfaces.h
+++ b/webkit/appcache/appcache_interfaces.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -110,6 +110,7 @@ class AppCacheBackend {
public:
virtual void RegisterHost(int host_id) = 0;
virtual void UnregisterHost(int host_id) = 0;
+ virtual void SetSpawningHostId(int host_id, int spawning_host_id) = 0;
virtual void SelectCache(int host_id,
const GURL& document_url,
const int64 cache_document_was_loaded_from,
diff --git a/webkit/appcache/web_application_cache_host_impl.cc b/webkit/appcache/web_application_cache_host_impl.cc
index 0bdc11f..981894d 100644
--- a/webkit/appcache/web_application_cache_host_impl.cc
+++ b/webkit/appcache/web_application_cache_host_impl.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -156,7 +156,7 @@ void WebApplicationCacheHostImpl::OnErrorEventRaised(
}
void WebApplicationCacheHostImpl::willStartMainResourceRequest(
- WebURLRequest& request) {
+ WebURLRequest& request, const WebFrame* frame) {
request.setAppCacheHostID(host_id_);
original_main_resource_url_ = ClearUrlRef(request.url());
@@ -164,6 +164,13 @@ void WebApplicationCacheHostImpl::willStartMainResourceRequest(
std::string method = request.httpMethod().utf8();
is_get_method_ = (method == kHttpGETMethod);
DCHECK(method == StringToUpperASCII(method));
+
+ if (frame) {
+ if (WebApplicationCacheHostImpl* parent = FromFrame(frame->parent()))
+ backend_->SetSpawningHostId(host_id_, parent->host_id());
+ else if (WebApplicationCacheHostImpl* opener = FromFrame(frame->opener()))
+ backend_->SetSpawningHostId(host_id_, opener->host_id());
+ }
}
void WebApplicationCacheHostImpl::willStartSubResourceRequest(
diff --git a/webkit/appcache/web_application_cache_host_impl.h b/webkit/appcache/web_application_cache_host_impl.h
index c7af54a..03020f0 100644
--- a/webkit/appcache/web_application_cache_host_impl.h
+++ b/webkit/appcache/web_application_cache_host_impl.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -44,7 +44,8 @@ class WebApplicationCacheHostImpl : public WebKit::WebApplicationCacheHost {
virtual void OnContentBlocked(const GURL& manifest_url) {}
// WebApplicationCacheHost methods
- virtual void willStartMainResourceRequest(WebKit::WebURLRequest&);
+ virtual void willStartMainResourceRequest(WebKit::WebURLRequest&,
+ const WebKit::WebFrame*);
virtual void willStartSubResourceRequest(WebKit::WebURLRequest&);
virtual void selectCacheWithoutManifest();
virtual bool selectCacheWithManifest(const WebKit::WebURL& manifestURL);