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 3 // found in the LICENSE file. 4 5 #ifndef MEDIA_BLINK_CACHE_UTIL_H_ 6 #define MEDIA_BLINK_CACHE_UTIL_H_ 7 8 #include <vector> 9 10 #include "base/basictypes.h" 11 #include "media/base/media_export.h" 12 13 namespace blink { 14 class WebURLResponse; 15 } 16 17 namespace media { 18 19 // Reasons that a cached WebURLResponse will *not* prevent a future request to 20 // the server. Reported via UMA, so don't change/reuse previously-existing 21 // values. 22 enum UncacheableReason { 23 kNoData = 1 << 0, // Not 200 or 206. 24 kPre11PartialResponse = 1 << 1, // 206 but HTTP version < 1.1. 25 kNoStrongValidatorOnPartialResponse = 1 << 2, // 206, no strong validator. 26 kShortMaxAge = 1 << 3, // Max age less than 1h (arbitrary value). 27 kExpiresTooSoon = 1 << 4, // Expires in less than 1h (arbitrary value). 28 kHasMustRevalidate = 1 << 5, // Response asks for revalidation. 29 kNoCache = 1 << 6, // Response included a no-cache header. 30 kNoStore = 1 << 7, // Response included a no-store header. 31 kMaxReason // Needs to be one more than max legitimate reason. 32 }; 33 34 // Return the logical OR of the reasons "response" cannot be used for a future 35 // request (using the disk cache), or 0 if it might be useful. 36 uint32 MEDIA_EXPORT GetReasonsForUncacheability( 37 const blink::WebURLResponse& response); 38 39 } // namespace media 40 41 #endif // MEDIA_BLINK_CACHE_UTIL_H_ 42