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

Side by Side Diff: content/child/appcache/web_application_cache_host_impl.cc

Issue 161573002: Implement new willStartMainResourceRequest method of blink::WebApplicationCacheHost (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add no-op worker overload Created 6 years, 10 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 #include "content/child/appcache/web_application_cache_host_impl.h" 5 #include "content/child/appcache/web_application_cache_host_impl.h"
6 6
7 #include "base/compiler_specific.h" 7 #include "base/compiler_specific.h"
8 #include "base/id_map.h" 8 #include "base/id_map.h"
9 #include "base/strings/string_util.h" 9 #include "base/strings/string_util.h"
10 #include "base/strings/stringprintf.h" 10 #include "base/strings/stringprintf.h"
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 std::string full_message = base::StringPrintf(kFormatString, 155 std::string full_message = base::StringPrintf(kFormatString,
156 message.c_str()); 156 message.c_str());
157 OnLogMessage(appcache::LOG_ERROR, full_message); 157 OnLogMessage(appcache::LOG_ERROR, full_message);
158 158
159 status_ = cache_info_.is_complete ? appcache::IDLE : appcache::UNCACHED; 159 status_ = cache_info_.is_complete ? appcache::IDLE : appcache::UNCACHED;
160 client_->notifyEventListener(static_cast<EventID>(appcache::ERROR_EVENT)); 160 client_->notifyEventListener(static_cast<EventID>(appcache::ERROR_EVENT));
161 } 161 }
162 162
163 void WebApplicationCacheHostImpl::willStartMainResourceRequest( 163 void WebApplicationCacheHostImpl::willStartMainResourceRequest(
164 WebURLRequest& request, const WebFrame* frame) { 164 WebURLRequest& request, const WebFrame* frame) {
165 WebApplicationCacheHostImpl* spawning_host = NULL;
166 if (frame) {
167 const WebFrame* spawning_frame = frame->parent();
168 if (!spawning_frame)
169 spawning_frame = frame->opener();
170 if (!spawning_frame)
171 spawning_frame = frame;
172
173 spawning_host = FromFrame(spawning_frame);
174 }
175 willStartMainResourceRequest(request, spawning_host);
176 }
177
178 void WebApplicationCacheHostImpl::willStartMainResourceRequest(
179 WebURLRequest& request, const WebApplicationCacheHost* spawning_host) {
165 request.setAppCacheHostID(host_id_); 180 request.setAppCacheHostID(host_id_);
166 181
167 original_main_resource_url_ = ClearUrlRef(request.url()); 182 original_main_resource_url_ = ClearUrlRef(request.url());
168 183
169 std::string method = request.httpMethod().utf8(); 184 std::string method = request.httpMethod().utf8();
170 is_get_method_ = (method == appcache::kHttpGETMethod); 185 is_get_method_ = (method == appcache::kHttpGETMethod);
171 DCHECK(method == StringToUpperASCII(method)); 186 DCHECK(method == StringToUpperASCII(method));
172 187
173 if (frame) { 188 const WebApplicationCacheHostImpl* spawning_host_impl =
174 const WebFrame* spawning_frame = frame->parent(); 189 static_cast<const WebApplicationCacheHostImpl*>(spawning_host);
175 if (!spawning_frame) 190 if (spawning_host_impl && (spawning_host_impl != this) &&
176 spawning_frame = frame->opener(); 191 (spawning_host_impl->status_ != appcache::UNCACHED)) {
177 if (!spawning_frame) 192 backend_->SetSpawningHostId(host_id_, spawning_host_impl->host_id());
178 spawning_frame = frame;
179
180 WebApplicationCacheHostImpl* spawning_host = FromFrame(spawning_frame);
181 if (spawning_host && (spawning_host != this) &&
182 (spawning_host->status_ != appcache::UNCACHED)) {
183 backend_->SetSpawningHostId(host_id_, spawning_host->host_id());
184 }
185 } 193 }
186 } 194 }
187 195
188 void WebApplicationCacheHostImpl::willStartSubResourceRequest( 196 void WebApplicationCacheHostImpl::willStartSubResourceRequest(
189 WebURLRequest& request) { 197 WebURLRequest& request) {
190 request.setAppCacheHostID(host_id_); 198 request.setAppCacheHostID(host_id_);
191 } 199 }
192 200
193 void WebApplicationCacheHostImpl::selectCacheWithoutManifest() { 201 void WebApplicationCacheHostImpl::selectCacheWithoutManifest() {
194 if (was_select_cache_called_) 202 if (was_select_cache_called_)
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
321 web_resources[i].isExplicit = resource_infos[i].is_explicit; 329 web_resources[i].isExplicit = resource_infos[i].is_explicit;
322 web_resources[i].isManifest = resource_infos[i].is_manifest; 330 web_resources[i].isManifest = resource_infos[i].is_manifest;
323 web_resources[i].isForeign = resource_infos[i].is_foreign; 331 web_resources[i].isForeign = resource_infos[i].is_foreign;
324 web_resources[i].isFallback = resource_infos[i].is_fallback; 332 web_resources[i].isFallback = resource_infos[i].is_fallback;
325 web_resources[i].url = resource_infos[i].url; 333 web_resources[i].url = resource_infos[i].url;
326 } 334 }
327 resources->swap(web_resources); 335 resources->swap(web_resources);
328 } 336 }
329 337
330 } // namespace content 338 } // namespace content
OLDNEW
« no previous file with comments | « content/child/appcache/web_application_cache_host_impl.h ('k') | content/worker/worker_webapplicationcachehost_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698