| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 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 CONTENT_RENDERER_MEDIA_ANDROID_MEDIA_INFO_LOADER_H_ | 5 #ifndef CONTENT_RENDERER_MEDIA_ANDROID_MEDIA_INFO_LOADER_H_ |
| 6 #define CONTENT_RENDERER_MEDIA_ANDROID_MEDIA_INFO_LOADER_H_ | 6 #define CONTENT_RENDERER_MEDIA_ANDROID_MEDIA_INFO_LOADER_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| 11 #include <string> | 11 #include <string> |
| 12 | 12 |
| 13 #include "base/callback.h" | 13 #include "base/callback.h" |
| 14 #include "base/macros.h" | 14 #include "base/macros.h" |
| 15 #include "base/time/time.h" | 15 #include "base/time/time.h" |
| 16 #include "content/common/content_export.h" | 16 #include "content/common/content_export.h" |
| 17 #include "media/blink/active_loader.h" | 17 #include "media/blink/active_loader.h" |
| 18 #include "third_party/WebKit/public/platform/WebMediaPlayer.h" | 18 #include "third_party/WebKit/public/platform/WebMediaPlayer.h" |
| 19 #include "third_party/WebKit/public/web/WebAssociatedURLLoaderClient.h" | 19 #include "third_party/WebKit/public/web/WebAssociatedURLLoaderClient.h" |
| 20 #include "third_party/WebKit/public/web/WebDocument.h" | 20 #include "third_party/WebKit/public/web/WebDocument.h" |
| 21 #include "url/gurl.h" | 21 #include "url/gurl.h" |
| 22 | 22 |
| 23 namespace blink { | 23 namespace blink { |
| 24 class WebAssociatedURLLoader; | 24 class WebAssociatedURLLoader; |
| 25 class WebFrame; | 25 class WebLocalFrame; |
| 26 class WebURLRequest; | 26 class WebURLRequest; |
| 27 } | 27 } |
| 28 | 28 |
| 29 namespace content { | 29 namespace content { |
| 30 | 30 |
| 31 // This class provides additional information about a media URL. Currently it | 31 // This class provides additional information about a media URL. Currently it |
| 32 // can be used to determine if a media URL has a single security origin and | 32 // can be used to determine if a media URL has a single security origin and |
| 33 // whether the URL passes a CORS access check. | 33 // whether the URL passes a CORS access check. |
| 34 class CONTENT_EXPORT MediaInfoLoader | 34 class CONTENT_EXPORT MediaInfoLoader |
| 35 : private blink::WebAssociatedURLLoaderClient { | 35 : private blink::WebAssociatedURLLoaderClient { |
| (...skipping 23 matching lines...) Expand all Loading... |
| 59 // |url| - URL for the media resource to be loaded. | 59 // |url| - URL for the media resource to be loaded. |
| 60 // |cors_mode| - HTML media element's crossorigin attribute. | 60 // |cors_mode| - HTML media element's crossorigin attribute. |
| 61 // |ready_cb| - Called when media info has finished or failed loading. | 61 // |ready_cb| - Called when media info has finished or failed loading. |
| 62 MediaInfoLoader( | 62 MediaInfoLoader( |
| 63 const GURL& url, | 63 const GURL& url, |
| 64 blink::WebMediaPlayer::CORSMode cors_mode, | 64 blink::WebMediaPlayer::CORSMode cors_mode, |
| 65 const ReadyCB& ready_cb); | 65 const ReadyCB& ready_cb); |
| 66 ~MediaInfoLoader() override; | 66 ~MediaInfoLoader() override; |
| 67 | 67 |
| 68 // Start loading media info. | 68 // Start loading media info. |
| 69 void Start(blink::WebFrame* frame); | 69 void Start(blink::WebLocalFrame* frame); |
| 70 | 70 |
| 71 // Returns true if the media resource has a single origin, false otherwise. | 71 // Returns true if the media resource has a single origin, false otherwise. |
| 72 // Only valid to call after the loader becomes ready. | 72 // Only valid to call after the loader becomes ready. |
| 73 bool HasSingleOrigin() const; | 73 bool HasSingleOrigin() const; |
| 74 | 74 |
| 75 // Returns true if the media resource passed a CORS access control check. | 75 // Returns true if the media resource passed a CORS access control check. |
| 76 // Only valid to call after the loader becomes ready. | 76 // Only valid to call after the loader becomes ready. |
| 77 bool DidPassCORSAccessCheck() const; | 77 bool DidPassCORSAccessCheck() const; |
| 78 | 78 |
| 79 private: | 79 private: |
| (...skipping 29 matching lines...) Expand all Loading... |
| 109 | 109 |
| 110 ReadyCB ready_cb_; | 110 ReadyCB ready_cb_; |
| 111 base::TimeTicks start_time_; | 111 base::TimeTicks start_time_; |
| 112 | 112 |
| 113 DISALLOW_COPY_AND_ASSIGN(MediaInfoLoader); | 113 DISALLOW_COPY_AND_ASSIGN(MediaInfoLoader); |
| 114 }; | 114 }; |
| 115 | 115 |
| 116 } // namespace content | 116 } // namespace content |
| 117 | 117 |
| 118 #endif // CONTENT_RENDERER_MEDIA_ANDROID_MEDIA_INFO_LOADER_H_ | 118 #endif // CONTENT_RENDERER_MEDIA_ANDROID_MEDIA_INFO_LOADER_H_ |
| OLD | NEW |