OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <algorithm> | 5 #include <algorithm> |
6 #include <string> | 6 #include <string> |
7 | 7 |
8 #include "webkit/appcache/view_appcache_internals_job.h" | 8 #include "webkit/appcache/view_appcache_internals_job.h" |
9 | 9 |
10 #include "base/base64.h" | 10 #include "base/base64.h" |
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
305 GURL::Replacements replacements; | 305 GURL::Replacements replacements; |
306 replacements.ClearQuery(); | 306 replacements.ClearQuery(); |
307 return url.ReplaceComponents(replacements); | 307 return url.ReplaceComponents(replacements); |
308 } | 308 } |
309 | 309 |
310 // Simple base class for the job subclasses defined here. | 310 // Simple base class for the job subclasses defined here. |
311 class BaseInternalsJob : public net::URLRequestSimpleJob { | 311 class BaseInternalsJob : public net::URLRequestSimpleJob { |
312 protected: | 312 protected: |
313 BaseInternalsJob(net::URLRequest* request, AppCacheService* service) | 313 BaseInternalsJob(net::URLRequest* request, AppCacheService* service) |
314 : URLRequestSimpleJob(request), appcache_service_(service) {} | 314 : URLRequestSimpleJob(request), appcache_service_(service) {} |
| 315 virtual ~BaseInternalsJob() {} |
315 | 316 |
316 AppCacheService* appcache_service_; | 317 AppCacheService* appcache_service_; |
317 }; | 318 }; |
318 | 319 |
319 // Job that lists all appcaches in the system. | 320 // Job that lists all appcaches in the system. |
320 class MainPageJob : public BaseInternalsJob { | 321 class MainPageJob : public BaseInternalsJob { |
321 public: | 322 public: |
322 MainPageJob(net::URLRequest* request, AppCacheService* service) | 323 MainPageJob(net::URLRequest* request, AppCacheService* service) |
323 : BaseInternalsJob(request, service), | 324 : BaseInternalsJob(request, service), |
324 ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)) { | 325 ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)) { |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
387 std::string* charset, | 388 std::string* charset, |
388 std::string* data) const { | 389 std::string* data) const { |
389 return true; // IsRedirectResponse induces a redirect. | 390 return true; // IsRedirectResponse induces a redirect. |
390 } | 391 } |
391 | 392 |
392 virtual bool IsRedirectResponse(GURL* location, int* http_status_code) { | 393 virtual bool IsRedirectResponse(GURL* location, int* http_status_code) { |
393 *location = ClearQuery(request_->url()); | 394 *location = ClearQuery(request_->url()); |
394 *http_status_code = 307; | 395 *http_status_code = 307; |
395 return true; | 396 return true; |
396 } | 397 } |
| 398 |
| 399 protected: |
| 400 virtual ~RedirectToMainPageJob() {} |
397 }; | 401 }; |
398 | 402 |
399 // Job that removes an appcache and then redirects back to the main page. | 403 // Job that removes an appcache and then redirects back to the main page. |
400 class RemoveAppCacheJob : public RedirectToMainPageJob { | 404 class RemoveAppCacheJob : public RedirectToMainPageJob { |
401 public: | 405 public: |
402 RemoveAppCacheJob( | 406 RemoveAppCacheJob( |
403 net::URLRequest* request, AppCacheService* service, | 407 net::URLRequest* request, AppCacheService* service, |
404 const GURL& manifest_url) | 408 const GURL& manifest_url) |
405 : RedirectToMainPageJob(request, service), | 409 : RedirectToMainPageJob(request, service), |
406 manifest_url_(manifest_url), | 410 manifest_url_(manifest_url), |
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
615 return new ViewEntryJob(request, service, | 619 return new ViewEntryJob(request, service, |
616 DecodeBase64URL(tokens[0]), // manifest url | 620 DecodeBase64URL(tokens[0]), // manifest url |
617 DecodeBase64URL(tokens[1]), // entry url | 621 DecodeBase64URL(tokens[1]), // entry url |
618 response_id, group_id); | 622 response_id, group_id); |
619 } | 623 } |
620 | 624 |
621 return new RedirectToMainPageJob(request, service); | 625 return new RedirectToMainPageJob(request, service); |
622 } | 626 } |
623 | 627 |
624 } // namespace appcache | 628 } // namespace appcache |
OLD | NEW |