OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/browser/appcache/view_appcache_internals_job.h" | 5 #include "content/browser/appcache/view_appcache_internals_job.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/base64.h" | 10 #include "base/base64.h" |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 | 103 |
104 void EmitCommandAnchor(const char* label, | 104 void EmitCommandAnchor(const char* label, |
105 const GURL& base_url, | 105 const GURL& base_url, |
106 const char* command, | 106 const char* command, |
107 const char* param, | 107 const char* param, |
108 std::string* out) { | 108 std::string* out) { |
109 std::string query(command); | 109 std::string query(command); |
110 query.push_back('='); | 110 query.push_back('='); |
111 query.append(param); | 111 query.append(param); |
112 GURL::Replacements replacements; | 112 GURL::Replacements replacements; |
113 replacements.SetQuery(query.data(), | 113 replacements.SetQuery(query.data(), url::Component(0, query.length())); |
114 url_parse::Component(0, query.length())); | |
115 GURL command_url = base_url.ReplaceComponents(replacements); | 114 GURL command_url = base_url.ReplaceComponents(replacements); |
116 EmitAnchor(command_url.spec(), label, out); | 115 EmitAnchor(command_url.spec(), label, out); |
117 } | 116 } |
118 | 117 |
119 void EmitAppCacheInfo(const GURL& base_url, | 118 void EmitAppCacheInfo(const GURL& base_url, |
120 AppCacheService* service, | 119 AppCacheService* service, |
121 const AppCacheInfo* info, | 120 const AppCacheInfo* info, |
122 std::string* out) { | 121 std::string* out) { |
123 std::string manifest_url_base64; | 122 std::string manifest_url_base64; |
124 base::Base64Encode(info->manifest_url.spec(), &manifest_url_base64); | 123 base::Base64Encode(info->manifest_url.spec(), &manifest_url_base64); |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
218 query.push_back('='); | 217 query.push_back('='); |
219 query.append(manifest_url_base64); | 218 query.append(manifest_url_base64); |
220 query.push_back('|'); | 219 query.push_back('|'); |
221 query.append(entry_url_base64); | 220 query.append(entry_url_base64); |
222 query.push_back('|'); | 221 query.push_back('|'); |
223 query.append(response_id_string); | 222 query.append(response_id_string); |
224 query.push_back('|'); | 223 query.push_back('|'); |
225 query.append(group_id_string); | 224 query.append(group_id_string); |
226 | 225 |
227 GURL::Replacements replacements; | 226 GURL::Replacements replacements; |
228 replacements.SetQuery(query.data(), | 227 replacements.SetQuery(query.data(), url::Component(0, query.length())); |
229 url_parse::Component(0, query.length())); | |
230 GURL view_entry_url = base_url.ReplaceComponents(replacements); | 228 GURL view_entry_url = base_url.ReplaceComponents(replacements); |
231 | 229 |
232 std::string anchor; | 230 std::string anchor; |
233 EmitAnchor(view_entry_url.spec(), entry_url.spec(), &anchor); | 231 EmitAnchor(view_entry_url.spec(), entry_url.spec(), &anchor); |
234 return anchor; | 232 return anchor; |
235 } | 233 } |
236 | 234 |
237 void EmitAppCacheResourceInfoVector( | 235 void EmitAppCacheResourceInfoVector( |
238 const GURL& base_url, | 236 const GURL& base_url, |
239 const GURL& manifest_url, | 237 const GURL& manifest_url, |
(...skipping 434 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
674 return new ViewEntryJob(request, network_delegate, service, | 672 return new ViewEntryJob(request, network_delegate, service, |
675 DecodeBase64URL(tokens[0]), // manifest url | 673 DecodeBase64URL(tokens[0]), // manifest url |
676 DecodeBase64URL(tokens[1]), // entry url | 674 DecodeBase64URL(tokens[1]), // entry url |
677 response_id, group_id); | 675 response_id, group_id); |
678 } | 676 } |
679 | 677 |
680 return new RedirectToMainPageJob(request, network_delegate, service); | 678 return new RedirectToMainPageJob(request, network_delegate, service); |
681 } | 679 } |
682 | 680 |
683 } // namespace content | 681 } // namespace content |
OLD | NEW |