| 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" |
| 11 #include "base/bind.h" | 11 #include "base/bind.h" |
| 12 #include "base/format_macros.h" | 12 #include "base/format_macros.h" |
| 13 #include "base/i18n/time_formatting.h" | 13 #include "base/i18n/time_formatting.h" |
| 14 #include "base/logging.h" | 14 #include "base/logging.h" |
| 15 #include "base/memory/weak_ptr.h" | 15 #include "base/memory/weak_ptr.h" |
| 16 #include "base/string_number_conversions.h" | 16 #include "base/string_number_conversions.h" |
| 17 #include "base/string_util.h" | 17 #include "base/string_util.h" |
| 18 #include "base/stringprintf.h" | 18 #include "base/stringprintf.h" |
| 19 #include "base/utf_string_conversions.h" | 19 #include "base/utf_string_conversions.h" |
| 20 #include "net/base/escape.h" | 20 #include "net/base/escape.h" |
| 21 #include "net/base/io_buffer.h" | 21 #include "net/base/io_buffer.h" |
| 22 #include "net/base/net_errors.h" | 22 #include "net/base/net_errors.h" |
| 23 #include "net/http/http_response_headers.h" | 23 #include "net/http/http_response_headers.h" |
| 24 #include "net/url_request/url_request.h" | 24 #include "net/url_request/url_request.h" |
| 25 #include "net/url_request/url_request_context.h" |
| 25 #include "net/url_request/url_request_simple_job.h" | 26 #include "net/url_request/url_request_simple_job.h" |
| 26 #include "net/url_request/view_cache_helper.h" | 27 #include "net/url_request/view_cache_helper.h" |
| 27 #include "webkit/appcache/appcache.h" | 28 #include "webkit/appcache/appcache.h" |
| 28 #include "webkit/appcache/appcache_group.h" | 29 #include "webkit/appcache/appcache_group.h" |
| 29 #include "webkit/appcache/appcache_policy.h" | 30 #include "webkit/appcache/appcache_policy.h" |
| 30 #include "webkit/appcache/appcache_response.h" | 31 #include "webkit/appcache/appcache_response.h" |
| 31 #include "webkit/appcache/appcache_service.h" | 32 #include "webkit/appcache/appcache_service.h" |
| 32 | 33 |
| 33 namespace appcache { | 34 namespace appcache { |
| 34 namespace { | 35 namespace { |
| (...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 305 GURL ClearQuery(const GURL& url) { | 306 GURL ClearQuery(const GURL& url) { |
| 306 GURL::Replacements replacements; | 307 GURL::Replacements replacements; |
| 307 replacements.ClearQuery(); | 308 replacements.ClearQuery(); |
| 308 return url.ReplaceComponents(replacements); | 309 return url.ReplaceComponents(replacements); |
| 309 } | 310 } |
| 310 | 311 |
| 311 // Simple base class for the job subclasses defined here. | 312 // Simple base class for the job subclasses defined here. |
| 312 class BaseInternalsJob : public net::URLRequestSimpleJob { | 313 class BaseInternalsJob : public net::URLRequestSimpleJob { |
| 313 protected: | 314 protected: |
| 314 BaseInternalsJob(net::URLRequest* request, AppCacheService* service) | 315 BaseInternalsJob(net::URLRequest* request, AppCacheService* service) |
| 315 : URLRequestSimpleJob(request), appcache_service_(service) {} | 316 : URLRequestSimpleJob(request, request->context()->network_delegate()), |
| 317 appcache_service_(service) {} |
| 316 virtual ~BaseInternalsJob() {} | 318 virtual ~BaseInternalsJob() {} |
| 317 | 319 |
| 318 AppCacheService* appcache_service_; | 320 AppCacheService* appcache_service_; |
| 319 }; | 321 }; |
| 320 | 322 |
| 321 // Job that lists all appcaches in the system. | 323 // Job that lists all appcaches in the system. |
| 322 class MainPageJob : public BaseInternalsJob { | 324 class MainPageJob : public BaseInternalsJob { |
| 323 public: | 325 public: |
| 324 MainPageJob(net::URLRequest* request, AppCacheService* service) | 326 MainPageJob(net::URLRequest* request, AppCacheService* service) |
| 325 : BaseInternalsJob(request, service), | 327 : BaseInternalsJob(request, service), |
| (...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 624 return new ViewEntryJob(request, service, | 626 return new ViewEntryJob(request, service, |
| 625 DecodeBase64URL(tokens[0]), // manifest url | 627 DecodeBase64URL(tokens[0]), // manifest url |
| 626 DecodeBase64URL(tokens[1]), // entry url | 628 DecodeBase64URL(tokens[1]), // entry url |
| 627 response_id, group_id); | 629 response_id, group_id); |
| 628 } | 630 } |
| 629 | 631 |
| 630 return new RedirectToMainPageJob(request, service); | 632 return new RedirectToMainPageJob(request, service); |
| 631 } | 633 } |
| 632 | 634 |
| 633 } // namespace appcache | 635 } // namespace appcache |
| OLD | NEW |