| 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 #include "webkit/appcache/web_application_cache_host_impl.h" | 5 #include "webkit/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/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
| 10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 const char* kFormatString = "Application Cache Error event: %s"; | 149 const char* kFormatString = "Application Cache Error event: %s"; |
| 150 std::string full_message = base::StringPrintf(kFormatString, | 150 std::string full_message = base::StringPrintf(kFormatString, |
| 151 message.c_str()); | 151 message.c_str()); |
| 152 OnLogMessage(LOG_ERROR, full_message); | 152 OnLogMessage(LOG_ERROR, full_message); |
| 153 | 153 |
| 154 status_ = cache_info_.is_complete ? IDLE : UNCACHED; | 154 status_ = cache_info_.is_complete ? IDLE : UNCACHED; |
| 155 client_->notifyEventListener(static_cast<EventID>(ERROR_EVENT)); | 155 client_->notifyEventListener(static_cast<EventID>(ERROR_EVENT)); |
| 156 } | 156 } |
| 157 | 157 |
| 158 void WebApplicationCacheHostImpl::willStartMainResourceRequest( | 158 void WebApplicationCacheHostImpl::willStartMainResourceRequest( |
| 159 WebURLRequest& request) { | 159 WebURLRequest& request, const WebFrame* frame) { |
| 160 request.setAppCacheHostID(host_id_); | 160 request.setAppCacheHostID(host_id_); |
| 161 | 161 |
| 162 original_main_resource_url_ = ClearUrlRef(request.url()); | 162 original_main_resource_url_ = ClearUrlRef(request.url()); |
| 163 | 163 |
| 164 std::string method = request.httpMethod().utf8(); | 164 std::string method = request.httpMethod().utf8(); |
| 165 is_get_method_ = (method == kHttpGETMethod); | 165 is_get_method_ = (method == kHttpGETMethod); |
| 166 DCHECK(method == StringToUpperASCII(method)); | 166 DCHECK(method == StringToUpperASCII(method)); |
| 167 |
| 168 CHECK(frame); // just to see if this holds true or not on try bots? |
| 169 |
| 170 if (frame) { |
| 171 if (WebApplicationCacheHostImpl* parent = FromFrame(frame->parent())) |
| 172 backend_->SetSpawningHostId(host_id_, parent->host_id()); |
| 173 else if (WebApplicationCacheHostImpl* opener = FromFrame(frame->opener())) |
| 174 backend_->SetSpawningHostId(host_id_, opener->host_id()); |
| 175 } |
| 167 } | 176 } |
| 168 | 177 |
| 169 void WebApplicationCacheHostImpl::willStartSubResourceRequest( | 178 void WebApplicationCacheHostImpl::willStartSubResourceRequest( |
| 170 WebURLRequest& request) { | 179 WebURLRequest& request) { |
| 171 request.setAppCacheHostID(host_id_); | 180 request.setAppCacheHostID(host_id_); |
| 172 } | 181 } |
| 173 | 182 |
| 174 void WebApplicationCacheHostImpl::selectCacheWithoutManifest() { | 183 void WebApplicationCacheHostImpl::selectCacheWithoutManifest() { |
| 175 if (was_select_cache_called_) | 184 if (was_select_cache_called_) |
| 176 return; | 185 return; |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 302 web_resources[i].isExplicit = resource_infos[i].is_explicit; | 311 web_resources[i].isExplicit = resource_infos[i].is_explicit; |
| 303 web_resources[i].isManifest = resource_infos[i].is_manifest; | 312 web_resources[i].isManifest = resource_infos[i].is_manifest; |
| 304 web_resources[i].isForeign = resource_infos[i].is_foreign; | 313 web_resources[i].isForeign = resource_infos[i].is_foreign; |
| 305 web_resources[i].isFallback = resource_infos[i].is_fallback; | 314 web_resources[i].isFallback = resource_infos[i].is_fallback; |
| 306 web_resources[i].url = resource_infos[i].url; | 315 web_resources[i].url = resource_infos[i].url; |
| 307 } | 316 } |
| 308 resources->swap(web_resources); | 317 resources->swap(web_resources); |
| 309 } | 318 } |
| 310 | 319 |
| 311 } // appcache namespace | 320 } // appcache namespace |
| OLD | NEW |