OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "webkit/appcache/appcache_interfaces.h" | 5 #include "webkit/appcache/appcache_interfaces.h" |
6 | 6 |
7 #include "googleurl/src/gurl.h" | 7 #include "googleurl/src/gurl.h" |
8 #include "net/url_request/url_request.h" | 8 #include "net/url_request/url_request.h" |
9 #include "third_party/WebKit/WebKit/chromium/public/WebApplicationCacheHost.h" | 9 #include "third_party/WebKit/WebKit/chromium/public/WebApplicationCacheHost.h" |
10 #include "third_party/WebKit/WebKit/chromium/public/WebConsoleMessage.h" | 10 #include "third_party/WebKit/WebKit/chromium/public/WebConsoleMessage.h" |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 | 45 |
46 AppCacheResourceInfo::~AppCacheResourceInfo() { | 46 AppCacheResourceInfo::~AppCacheResourceInfo() { |
47 } | 47 } |
48 | 48 |
49 bool IsSchemeSupported(const GURL& url) { | 49 bool IsSchemeSupported(const GURL& url) { |
50 bool supported = url.SchemeIs(kHttpScheme) || url.SchemeIs(kHttpsScheme); | 50 bool supported = url.SchemeIs(kHttpScheme) || url.SchemeIs(kHttpsScheme); |
51 #ifndef NDEBUG | 51 #ifndef NDEBUG |
52 // TODO(michaeln): It would be really nice if this could optionally work for | 52 // TODO(michaeln): It would be really nice if this could optionally work for |
53 // file urls too to help web developers experiment and test their apps, | 53 // file urls too to help web developers experiment and test their apps, |
54 // perhaps enabled via a cmd line flag or some other developer tool setting. | 54 // perhaps enabled via a cmd line flag or some other developer tool setting. |
55 // Unfortunately file scheme URLRequest don't produce the same signalling | 55 // Unfortunately file scheme net::URLRequest don't produce the same signalling |
56 // (200 response codes, headers) as http URLRequests, so this doesn't work | 56 // (200 response codes, headers) as http URLRequests, so this doesn't work |
57 // just yet. | 57 // just yet. |
58 // supported |= url.SchemeIsFile(); | 58 // supported |= url.SchemeIsFile(); |
59 #endif | 59 #endif |
60 return supported; | 60 return supported; |
61 } | 61 } |
62 | 62 |
63 bool IsMethodSupported(const std::string& method) { | 63 bool IsMethodSupported(const std::string& method) { |
64 return (method == kHttpGETMethod) || (method == kHttpHEADMethod); | 64 return (method == kHttpGETMethod) || (method == kHttpHEADMethod); |
65 } | 65 } |
66 | 66 |
67 bool IsSchemeAndMethodSupported(const URLRequest* request) { | 67 bool IsSchemeAndMethodSupported(const net::URLRequest* request) { |
68 return IsSchemeSupported(request->url()) && | 68 return IsSchemeSupported(request->url()) && |
69 IsMethodSupported(request->method()); | 69 IsMethodSupported(request->method()); |
70 } | 70 } |
71 | 71 |
72 // Ensure that enum values never get out of sync with the | 72 // Ensure that enum values never get out of sync with the |
73 // ones declared for use within the WebKit api | 73 // ones declared for use within the WebKit api |
74 COMPILE_ASSERT((int)WebApplicationCacheHost::Uncached == | 74 COMPILE_ASSERT((int)WebApplicationCacheHost::Uncached == |
75 (int)UNCACHED, Uncached); | 75 (int)UNCACHED, Uncached); |
76 COMPILE_ASSERT((int)WebApplicationCacheHost::Idle == | 76 COMPILE_ASSERT((int)WebApplicationCacheHost::Idle == |
77 (int)IDLE, Idle); | 77 (int)IDLE, Idle); |
(...skipping 24 matching lines...) Expand all Loading... |
102 COMPILE_ASSERT((int)WebConsoleMessage::LevelTip == | 102 COMPILE_ASSERT((int)WebConsoleMessage::LevelTip == |
103 (int)LOG_TIP, LevelTip); | 103 (int)LOG_TIP, LevelTip); |
104 COMPILE_ASSERT((int)WebConsoleMessage::LevelLog == | 104 COMPILE_ASSERT((int)WebConsoleMessage::LevelLog == |
105 (int)LOG_INFO, LevelLog); | 105 (int)LOG_INFO, LevelLog); |
106 COMPILE_ASSERT((int)WebConsoleMessage::LevelWarning == | 106 COMPILE_ASSERT((int)WebConsoleMessage::LevelWarning == |
107 (int)LOG_WARNING, LevelWarning); | 107 (int)LOG_WARNING, LevelWarning); |
108 COMPILE_ASSERT((int)WebConsoleMessage::LevelError == | 108 COMPILE_ASSERT((int)WebConsoleMessage::LevelError == |
109 (int)LOG_ERROR, LevelError); | 109 (int)LOG_ERROR, LevelError); |
110 | 110 |
111 } // namespace appcache | 111 } // namespace appcache |
OLD | NEW |