OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/simple_data_source.h" | 5 #include "webkit/glue/media/simple_data_source.h" |
6 | 6 |
7 #include "base/message_loop.h" | 7 #include "base/message_loop.h" |
8 #include "base/process_util.h" | 8 #include "base/process_util.h" |
9 #include "media/base/filter_host.h" | 9 #include "media/base/filter_host.h" |
| 10 #include "media/base/media_log.h" |
10 #include "net/base/data_url.h" | 11 #include "net/base/data_url.h" |
11 #include "net/base/load_flags.h" | 12 #include "net/base/load_flags.h" |
12 #include "net/http/http_request_headers.h" | 13 #include "net/http/http_request_headers.h" |
13 #include "net/url_request/url_request_status.h" | 14 #include "net/url_request/url_request_status.h" |
14 #include "third_party/WebKit/Source/WebKit/chromium/public/WebKit.h" | 15 #include "third_party/WebKit/Source/WebKit/chromium/public/WebKit.h" |
15 #include "third_party/WebKit/Source/WebKit/chromium/public/WebKitClient.h" | 16 #include "third_party/WebKit/Source/WebKit/chromium/public/WebKitClient.h" |
16 #include "third_party/WebKit/Source/WebKit/chromium/public/WebString.h" | 17 #include "third_party/WebKit/Source/WebKit/chromium/public/WebString.h" |
17 #include "third_party/WebKit/Source/WebKit/chromium/public/WebURLLoaderOptions.h
" | 18 #include "third_party/WebKit/Source/WebKit/chromium/public/WebURLLoaderOptions.h
" |
18 #include "webkit/glue/media/web_data_source_factory.h" | 19 #include "webkit/glue/media/web_data_source_factory.h" |
19 #include "webkit/glue/webkit_glue.h" | 20 #include "webkit/glue/webkit_glue.h" |
20 | 21 |
21 using WebKit::WebString; | 22 using WebKit::WebString; |
22 using WebKit::WebURLLoaderOptions; | 23 using WebKit::WebURLLoaderOptions; |
23 | 24 |
24 namespace webkit_glue { | 25 namespace webkit_glue { |
25 | 26 |
26 static const char kDataScheme[] = "data"; | 27 static const char kDataScheme[] = "data"; |
27 | 28 |
28 static WebDataSource* NewSimpleDataSource(MessageLoop* render_loop, | 29 static WebDataSource* NewSimpleDataSource(MessageLoop* render_loop, |
29 WebKit::WebFrame* frame) { | 30 WebKit::WebFrame* frame, |
| 31 media::MediaLog* media_log) { |
30 return new SimpleDataSource(render_loop, frame); | 32 return new SimpleDataSource(render_loop, frame); |
31 } | 33 } |
32 | 34 |
33 // static | 35 // static |
34 media::DataSourceFactory* SimpleDataSource::CreateFactory( | 36 media::DataSourceFactory* SimpleDataSource::CreateFactory( |
35 MessageLoop* render_loop, | 37 MessageLoop* render_loop, |
36 WebKit::WebFrame* frame, | 38 WebKit::WebFrame* frame, |
| 39 media::MediaLog* media_log, |
37 WebDataSourceBuildObserverHack* build_observer) { | 40 WebDataSourceBuildObserverHack* build_observer) { |
38 return new WebDataSourceFactory(render_loop, frame, &NewSimpleDataSource, | 41 return new WebDataSourceFactory(render_loop, frame, media_log, |
39 build_observer); | 42 &NewSimpleDataSource, build_observer); |
40 } | 43 } |
41 | 44 |
42 SimpleDataSource::SimpleDataSource( | 45 SimpleDataSource::SimpleDataSource( |
43 MessageLoop* render_loop, | 46 MessageLoop* render_loop, |
44 WebKit::WebFrame* frame) | 47 WebKit::WebFrame* frame) |
45 : render_loop_(render_loop), | 48 : render_loop_(render_loop), |
46 frame_(frame), | 49 frame_(frame), |
47 size_(-1), | 50 size_(-1), |
48 single_origin_(true), | 51 single_origin_(true), |
49 state_(UNINITIALIZED), | 52 state_(UNINITIALIZED), |
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
349 void SimpleDataSource::UpdateHostState() { | 352 void SimpleDataSource::UpdateHostState() { |
350 if (host()) { | 353 if (host()) { |
351 host()->SetTotalBytes(size_); | 354 host()->SetTotalBytes(size_); |
352 host()->SetBufferedBytes(size_); | 355 host()->SetBufferedBytes(size_); |
353 // If scheme is file or data, say we are loaded. | 356 // If scheme is file or data, say we are loaded. |
354 host()->SetLoaded(url_.SchemeIsFile() || url_.SchemeIs(kDataScheme)); | 357 host()->SetLoaded(url_.SchemeIsFile() || url_.SchemeIs(kDataScheme)); |
355 } | 358 } |
356 } | 359 } |
357 | 360 |
358 } // namespace webkit_glue | 361 } // namespace webkit_glue |
OLD | NEW |