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 #ifndef WEBKIT_MEDIA_BUFFERED_RESOURCE_LOADER_H_ | 5 #ifndef WEBKIT_MEDIA_BUFFERED_RESOURCE_LOADER_H_ |
6 #define WEBKIT_MEDIA_BUFFERED_RESOURCE_LOADER_H_ | 6 #define WEBKIT_MEDIA_BUFFERED_RESOURCE_LOADER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 // - Connection was terminated | 58 // - Connection was terminated |
59 // | 59 // |
60 // At this point you should delete the loader. | 60 // At this point you should delete the loader. |
61 kFailed, | 61 kFailed, |
62 | 62 |
63 // The loader will never be able to satisfy the read request. Please stop, | 63 // The loader will never be able to satisfy the read request. Please stop, |
64 // delete, create a new loader, and try again. | 64 // delete, create a new loader, and try again. |
65 kCacheMiss, | 65 kCacheMiss, |
66 }; | 66 }; |
67 | 67 |
| 68 // Keep in sync with WebMediaPlayer::CORSMode. |
| 69 enum CORSMode { kUnspecified, kAnonymous, kUseCredentials }; |
| 70 |
68 // |url| - URL for the resource to be loaded. | 71 // |url| - URL for the resource to be loaded. |
| 72 // |cors_mode| - HTML media element's crossorigin attribute. |
69 // |first_byte_position| - First byte to start loading from, | 73 // |first_byte_position| - First byte to start loading from, |
70 // |kPositionNotSpecified| for not specified. | 74 // |kPositionNotSpecified| for not specified. |
71 // |last_byte_position| - Last byte to be loaded, | 75 // |last_byte_position| - Last byte to be loaded, |
72 // |kPositionNotSpecified| for not specified. | 76 // |kPositionNotSpecified| for not specified. |
73 // |strategy| is the initial loading strategy to use. | 77 // |strategy| is the initial loading strategy to use. |
74 // |bitrate| is the bitrate of the media, 0 if unknown. | 78 // |bitrate| is the bitrate of the media, 0 if unknown. |
75 // |playback_rate| is the current playback rate of the media. | 79 // |playback_rate| is the current playback rate of the media. |
76 BufferedResourceLoader(const GURL& url, | 80 BufferedResourceLoader( |
77 int64 first_byte_position, | 81 const GURL& url, |
78 int64 last_byte_position, | 82 CORSMode cors_mode, |
79 DeferStrategy strategy, | 83 int64 first_byte_position, |
80 int bitrate, | 84 int64 last_byte_position, |
81 float playback_rate, | 85 DeferStrategy strategy, |
82 media::MediaLog* media_log); | 86 int bitrate, |
| 87 float playback_rate, |
| 88 media::MediaLog* media_log); |
83 virtual ~BufferedResourceLoader(); | 89 virtual ~BufferedResourceLoader(); |
84 | 90 |
85 // Start the resource loading with the specified URL and range. | 91 // Start the resource loading with the specified URL and range. |
86 // | 92 // |
87 // |event_cb| is called to notify the client of network activity in the | 93 // |event_cb| is called to notify the client of network activity in the |
88 // following situations: | 94 // following situations: |
89 // - Data was received | 95 // - Data was received |
90 // - Reading was suspended/resumed | 96 // - Reading was suspended/resumed |
91 // - Loading completed | 97 // - Loading completed |
92 // - Loading failed | 98 // - Loading failed |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
277 // request from the cache. | 283 // request from the cache. |
278 bool might_be_reused_from_cache_in_future_; | 284 bool might_be_reused_from_cache_in_future_; |
279 | 285 |
280 // True if Range header is supported. | 286 // True if Range header is supported. |
281 bool range_supported_; | 287 bool range_supported_; |
282 | 288 |
283 // Forward capacity to reset to after an extension. | 289 // Forward capacity to reset to after an extension. |
284 size_t saved_forward_capacity_; | 290 size_t saved_forward_capacity_; |
285 | 291 |
286 GURL url_; | 292 GURL url_; |
| 293 CORSMode cors_mode_; |
287 const int64 first_byte_position_; | 294 const int64 first_byte_position_; |
288 const int64 last_byte_position_; | 295 const int64 last_byte_position_; |
289 bool single_origin_; | 296 bool single_origin_; |
290 | 297 |
291 // Closure that listens to network events. | 298 // Closure that listens to network events. |
292 base::Closure event_cb_; | 299 base::Closure event_cb_; |
293 | 300 |
294 // Members used during request start. | 301 // Members used during request start. |
295 StartCB start_cb_; | 302 StartCB start_cb_; |
296 int64 offset_; | 303 int64 offset_; |
(...skipping 22 matching lines...) Expand all Loading... |
319 float playback_rate_; | 326 float playback_rate_; |
320 | 327 |
321 scoped_refptr<media::MediaLog> media_log_; | 328 scoped_refptr<media::MediaLog> media_log_; |
322 | 329 |
323 DISALLOW_COPY_AND_ASSIGN(BufferedResourceLoader); | 330 DISALLOW_COPY_AND_ASSIGN(BufferedResourceLoader); |
324 }; | 331 }; |
325 | 332 |
326 } // namespace webkit_media | 333 } // namespace webkit_media |
327 | 334 |
328 #endif // WEBKIT_MEDIA_BUFFERED_RESOURCE_LOADER_H_ | 335 #endif // WEBKIT_MEDIA_BUFFERED_RESOURCE_LOADER_H_ |
OLD | NEW |