| OLD | NEW |
| 1 // Copyright (c) 2009 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/glue/media/media_resource_loader_bridge_factory.h" | 5 #include "webkit/glue/media/media_resource_loader_bridge_factory.h" |
| 6 | 6 |
| 7 #include "base/format_macros.h" | 7 #include "base/format_macros.h" |
| 8 #include "base/string_util.h" | 8 #include "base/string_util.h" |
| 9 #include "base/stringprintf.h" |
| 9 | 10 |
| 10 namespace { | 11 namespace { |
| 11 | 12 |
| 12 // A constant for an unknown position. | 13 // A constant for an unknown position. |
| 13 const int64 kPositionNotSpecified = -1; | 14 const int64 kPositionNotSpecified = -1; |
| 14 | 15 |
| 15 } // namespace | 16 } // namespace |
| 16 | 17 |
| 17 namespace webkit_glue { | 18 namespace webkit_glue { |
| 18 | 19 |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 } | 55 } |
| 55 | 56 |
| 56 // static | 57 // static |
| 57 const std::string MediaResourceLoaderBridgeFactory::GenerateHeaders ( | 58 const std::string MediaResourceLoaderBridgeFactory::GenerateHeaders ( |
| 58 int64 first_byte_position, int64 last_byte_position) { | 59 int64 first_byte_position, int64 last_byte_position) { |
| 59 // Construct the range header. | 60 // Construct the range header. |
| 60 std::string header; | 61 std::string header; |
| 61 if (first_byte_position > kPositionNotSpecified && | 62 if (first_byte_position > kPositionNotSpecified && |
| 62 last_byte_position > kPositionNotSpecified) { | 63 last_byte_position > kPositionNotSpecified) { |
| 63 if (first_byte_position <= last_byte_position) { | 64 if (first_byte_position <= last_byte_position) { |
| 64 header = StringPrintf("Range: bytes=%" PRId64 "-%" PRId64, | 65 header = base::StringPrintf("Range: bytes=%" PRId64 "-%" PRId64, |
| 65 first_byte_position, | 66 first_byte_position, |
| 66 last_byte_position); | 67 last_byte_position); |
| 67 } | 68 } |
| 68 } else if (first_byte_position > kPositionNotSpecified) { | 69 } else if (first_byte_position > kPositionNotSpecified) { |
| 69 header = StringPrintf("Range: bytes=%" PRId64 "-", first_byte_position); | 70 header = base::StringPrintf("Range: bytes=%" PRId64 "-", |
| 71 first_byte_position); |
| 70 } else if (last_byte_position > kPositionNotSpecified) { | 72 } else if (last_byte_position > kPositionNotSpecified) { |
| 71 NOTIMPLEMENTED() << "Suffix range not implemented"; | 73 NOTIMPLEMENTED() << "Suffix range not implemented"; |
| 72 } | 74 } |
| 73 return header; | 75 return header; |
| 74 } | 76 } |
| 75 | 77 |
| 76 } // namespace webkit_glue | 78 } // namespace webkit_glue |
| OLD | NEW |