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

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

Issue 330053004: Rename some appcache types in preparation for moving to content namespace (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 backend_->UnregisterHost(host_id_); 75 backend_->UnregisterHost(host_id_);
76 all_hosts()->Remove(host_id_); 76 all_hosts()->Remove(host_id_);
77 } 77 }
78 78
79 void WebApplicationCacheHostImpl::OnCacheSelected( 79 void WebApplicationCacheHostImpl::OnCacheSelected(
80 const appcache::AppCacheInfo& info) { 80 const appcache::AppCacheInfo& info) {
81 cache_info_ = info; 81 cache_info_ = info;
82 client_->didChangeCacheAssociation(); 82 client_->didChangeCacheAssociation();
83 } 83 }
84 84
85 void WebApplicationCacheHostImpl::OnStatusChanged(appcache::Status status) { 85 void WebApplicationCacheHostImpl::OnStatusChanged(
86 appcache::AppCacheStatus status) {
86 // TODO(michaeln): delete me, not used 87 // TODO(michaeln): delete me, not used
87 } 88 }
88 89
89 void WebApplicationCacheHostImpl::OnEventRaised(appcache::EventID event_id) { 90 void WebApplicationCacheHostImpl::OnEventRaised(
91 appcache::AppCacheEventID event_id) {
90 DCHECK(event_id != appcache::PROGRESS_EVENT); // See OnProgressEventRaised. 92 DCHECK(event_id != appcache::PROGRESS_EVENT); // See OnProgressEventRaised.
91 DCHECK(event_id != appcache::ERROR_EVENT); // See OnErrorEventRaised. 93 DCHECK(event_id != appcache::ERROR_EVENT); // See OnErrorEventRaised.
92 94
93 // Emit logging output prior to calling out to script as we can get 95 // Emit logging output prior to calling out to script as we can get
94 // deleted within the script event handler. 96 // deleted within the script event handler.
95 const char* kFormatString = "Application Cache %s event"; 97 const char* kFormatString = "Application Cache %s event";
96 std::string message = base::StringPrintf(kFormatString, 98 std::string message = base::StringPrintf(kFormatString,
97 kEventNames[event_id]); 99 kEventNames[event_id]);
98 OnLogMessage(appcache::LOG_INFO, message); 100 OnLogMessage(appcache::LOG_INFO, message);
99 101
(...skipping 28 matching lines...) Expand all
128 // deleted within the script event handler. 130 // deleted within the script event handler.
129 const char* kFormatString = "Application Cache Progress event (%d of %d) %s"; 131 const char* kFormatString = "Application Cache Progress event (%d of %d) %s";
130 std::string message = base::StringPrintf(kFormatString, num_complete, 132 std::string message = base::StringPrintf(kFormatString, num_complete,
131 num_total, url.spec().c_str()); 133 num_total, url.spec().c_str());
132 OnLogMessage(appcache::LOG_INFO, message); 134 OnLogMessage(appcache::LOG_INFO, message);
133 status_ = appcache::DOWNLOADING; 135 status_ = appcache::DOWNLOADING;
134 client_->notifyProgressEventListener(url, num_total, num_complete); 136 client_->notifyProgressEventListener(url, num_total, num_complete);
135 } 137 }
136 138
137 void WebApplicationCacheHostImpl::OnErrorEventRaised( 139 void WebApplicationCacheHostImpl::OnErrorEventRaised(
138 const appcache::ErrorDetails& details) { 140 const appcache::AppCacheErrorDetails& details) {
139 // Emit logging output prior to calling out to script as we can get 141 // Emit logging output prior to calling out to script as we can get
140 // deleted within the script event handler. 142 // deleted within the script event handler.
141 const char* kFormatString = "Application Cache Error event: %s"; 143 const char* kFormatString = "Application Cache Error event: %s";
142 std::string full_message = 144 std::string full_message =
143 base::StringPrintf(kFormatString, details.message.c_str()); 145 base::StringPrintf(kFormatString, details.message.c_str());
144 OnLogMessage(appcache::LOG_ERROR, full_message); 146 OnLogMessage(appcache::LOG_ERROR, full_message);
145 147
146 status_ = cache_info_.is_complete ? appcache::IDLE : appcache::UNCACHED; 148 status_ = cache_info_.is_complete ? appcache::IDLE : appcache::UNCACHED;
147 if (details.is_cross_origin) { 149 if (details.is_cross_origin) {
148 // Don't leak detailed information to script for cross-origin resources. 150 // Don't leak detailed information to script for cross-origin resources.
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
311 web_resources[i].isExplicit = resource_infos[i].is_explicit; 313 web_resources[i].isExplicit = resource_infos[i].is_explicit;
312 web_resources[i].isManifest = resource_infos[i].is_manifest; 314 web_resources[i].isManifest = resource_infos[i].is_manifest;
313 web_resources[i].isForeign = resource_infos[i].is_foreign; 315 web_resources[i].isForeign = resource_infos[i].is_foreign;
314 web_resources[i].isFallback = resource_infos[i].is_fallback; 316 web_resources[i].isFallback = resource_infos[i].is_fallback;
315 web_resources[i].url = resource_infos[i].url; 317 web_resources[i].url = resource_infos[i].url;
316 } 318 }
317 resources->swap(web_resources); 319 resources->swap(web_resources);
318 } 320 }
319 321
320 } // namespace content 322 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698