OLD | NEW |
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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 DCHECK(client && backend && (host_id_ != appcache::kNoHostId)); | 82 DCHECK(client && backend && (host_id_ != appcache::kNoHostId)); |
83 | 83 |
84 backend_->RegisterHost(host_id_); | 84 backend_->RegisterHost(host_id_); |
85 } | 85 } |
86 | 86 |
87 WebApplicationCacheHostImpl::~WebApplicationCacheHostImpl() { | 87 WebApplicationCacheHostImpl::~WebApplicationCacheHostImpl() { |
88 backend_->UnregisterHost(host_id_); | 88 backend_->UnregisterHost(host_id_); |
89 all_hosts()->Remove(host_id_); | 89 all_hosts()->Remove(host_id_); |
90 } | 90 } |
91 | 91 |
| 92 // HACK, should be encapsulated in WebNavigationControllerHost or something |
| 93 void WebApplicationCacheHostImpl::registerController( |
| 94 const WebKit::WebString& pattern, |
| 95 const WebKit::WebURL& controller_url) { |
| 96 backend_->RegisterController(host_id_, document_url_, pattern, controller_url)
; |
| 97 } |
| 98 |
| 99 void WebApplicationCacheHostImpl::unregisterController( |
| 100 const WebKit::WebString& pattern) { |
| 101 backend_->UnregisterController(host_id_, document_url_, pattern); |
| 102 } |
| 103 |
92 void WebApplicationCacheHostImpl::OnCacheSelected( | 104 void WebApplicationCacheHostImpl::OnCacheSelected( |
93 const appcache::AppCacheInfo& info) { | 105 const appcache::AppCacheInfo& info) { |
94 cache_info_ = info; | 106 cache_info_ = info; |
95 client_->didChangeCacheAssociation(); | 107 client_->didChangeCacheAssociation(); |
96 } | 108 } |
97 | 109 |
98 void WebApplicationCacheHostImpl::OnStatusChanged(appcache::Status status) { | 110 void WebApplicationCacheHostImpl::OnStatusChanged(appcache::Status status) { |
99 // TODO(michaeln): delete me, not used | 111 // TODO(michaeln): delete me, not used |
100 } | 112 } |
101 | 113 |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 // deleted within the script event handler. | 165 // deleted within the script event handler. |
154 const char* kFormatString = "Application Cache Error event: %s"; | 166 const char* kFormatString = "Application Cache Error event: %s"; |
155 std::string full_message = base::StringPrintf(kFormatString, | 167 std::string full_message = base::StringPrintf(kFormatString, |
156 message.c_str()); | 168 message.c_str()); |
157 OnLogMessage(appcache::LOG_ERROR, full_message); | 169 OnLogMessage(appcache::LOG_ERROR, full_message); |
158 | 170 |
159 status_ = cache_info_.is_complete ? appcache::IDLE : appcache::UNCACHED; | 171 status_ = cache_info_.is_complete ? appcache::IDLE : appcache::UNCACHED; |
160 client_->notifyEventListener(static_cast<EventID>(appcache::ERROR_EVENT)); | 172 client_->notifyEventListener(static_cast<EventID>(appcache::ERROR_EVENT)); |
161 } | 173 } |
162 | 174 |
| 175 void WebApplicationCacheHostImpl::OnControllerReady() { |
| 176 NOTIMPLEMENTED(); |
| 177 } |
| 178 |
163 void WebApplicationCacheHostImpl::willStartMainResourceRequest( | 179 void WebApplicationCacheHostImpl::willStartMainResourceRequest( |
164 WebURLRequest& request, const WebFrame* frame) { | 180 WebURLRequest& request, const WebFrame* frame) { |
165 request.setAppCacheHostID(host_id_); | 181 request.setAppCacheHostID(host_id_); |
166 | 182 |
167 original_main_resource_url_ = ClearUrlRef(request.url()); | 183 original_main_resource_url_ = ClearUrlRef(request.url()); |
168 | 184 |
169 std::string method = request.httpMethod().utf8(); | 185 std::string method = request.httpMethod().utf8(); |
170 is_get_method_ = (method == appcache::kHttpGETMethod); | 186 is_get_method_ = (method == appcache::kHttpGETMethod); |
171 DCHECK(method == StringToUpperASCII(method)); | 187 DCHECK(method == StringToUpperASCII(method)); |
172 | 188 |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
321 web_resources[i].isExplicit = resource_infos[i].is_explicit; | 337 web_resources[i].isExplicit = resource_infos[i].is_explicit; |
322 web_resources[i].isManifest = resource_infos[i].is_manifest; | 338 web_resources[i].isManifest = resource_infos[i].is_manifest; |
323 web_resources[i].isForeign = resource_infos[i].is_foreign; | 339 web_resources[i].isForeign = resource_infos[i].is_foreign; |
324 web_resources[i].isFallback = resource_infos[i].is_fallback; | 340 web_resources[i].isFallback = resource_infos[i].is_fallback; |
325 web_resources[i].url = resource_infos[i].url; | 341 web_resources[i].url = resource_infos[i].url; |
326 } | 342 } |
327 resources->swap(web_resources); | 343 resources->swap(web_resources); |
328 } | 344 } |
329 | 345 |
330 } // namespace content | 346 } // namespace content |
OLD | NEW |