Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(88)

Side by Side Diff: content/renderer/media/android/media_info_loader.h

Issue 408873004: Fix for cross-origin video check for webgl on android (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: addressing kbr's comments Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 <string> 8 #include <string>
9 9
10 #include "base/callback.h" 10 #include "base/callback.h"
11 #include "base/memory/scoped_ptr.h" 11 #include "base/memory/scoped_ptr.h"
12 #include "base/time/time.h" 12 #include "base/time/time.h"
13 #include "content/common/content_export.h" 13 #include "content/common/content_export.h"
14 #include "content/renderer/media/active_loader.h" 14 #include "content/renderer/media/active_loader.h"
15 #include "third_party/WebKit/public/platform/WebMediaPlayer.h" 15 #include "third_party/WebKit/public/platform/WebMediaPlayer.h"
16 #include "third_party/WebKit/public/platform/WebURLLoaderClient.h" 16 #include "third_party/WebKit/public/platform/WebURLLoaderClient.h"
17 #include "third_party/WebKit/public/web/WebDocument.h"
17 #include "url/gurl.h" 18 #include "url/gurl.h"
18 19
19 namespace blink { 20 namespace blink {
20 class WebFrame; 21 class WebFrame;
21 class WebURLLoader; 22 class WebURLLoader;
22 class WebURLRequest; 23 class WebURLRequest;
23 } 24 }
24 25
25 namespace content { 26 namespace content {
26 27
(...skipping 10 matching lines...) Expand all
37 // - The response was invalid 38 // - The response was invalid
38 // - Connection was terminated 39 // - Connection was terminated
39 // 40 //
40 // At this point you should delete the loader. 41 // At this point you should delete the loader.
41 kFailed, 42 kFailed,
42 43
43 // Everything went as planned. 44 // Everything went as planned.
44 kOk, 45 kOk,
45 }; 46 };
46 47
48 // Callback when MediaInfoLoader finishes loading the url. Args: whether URL
49 // is successfully loaded, the final URL destination following all the
50 // redirect, the first party URL for the final destination, and whether
51 // credentials needs to be sent to the final destination.
palmer 2014/07/31 00:06:48 Typo: "credentials need"
52 typedef base::Callback<void(Status, const GURL&, const GURL&, bool)> ReadyCB;
53
47 // Start loading information about the given media URL. 54 // Start loading information about the given media URL.
48 // |url| - URL for the media resource to be loaded. 55 // |url| - URL for the media resource to be loaded.
49 // |cors_mode| - HTML media element's crossorigin attribute. 56 // |cors_mode| - HTML media element's crossorigin attribute.
50 // |ready_cb| - Called when media info has finished or failed loading. 57 // |ready_cb| - Called when media info has finished or failed loading.
51 typedef base::Callback<void(Status)> ReadyCB;
52 MediaInfoLoader( 58 MediaInfoLoader(
53 const GURL& url, 59 const GURL& url,
54 blink::WebMediaPlayer::CORSMode cors_mode, 60 blink::WebMediaPlayer::CORSMode cors_mode,
55 const ReadyCB& ready_cb); 61 const ReadyCB& ready_cb);
56 virtual ~MediaInfoLoader(); 62 virtual ~MediaInfoLoader();
57 63
58 // Start loading media info. 64 // Start loading media info.
59 void Start(blink::WebFrame* frame); 65 void Start(blink::WebFrame* frame);
60 66
61 // Returns true if the media resource has a single origin, false otherwise. 67 // Returns true if the media resource has a single origin, false otherwise.
62 // Only valid to call after the loader becomes ready. 68 // Only valid to call after the loader becomes ready.
63 bool HasSingleOrigin() const; 69 bool HasSingleOrigin() const;
64 70
65 // Returns true if the media resource passed a CORS access control check. 71 // Returns true if the media resource passed a CORS access control check.
66 // Only valid to call after the loader becomes ready. 72 // Only valid to call after the loader becomes ready.
67 bool DidPassCORSAccessCheck() const; 73 bool DidPassCORSAccessCheck() const;
68 74
69 void set_single_origin(bool single_origin) {
70 single_origin_ = single_origin;
71 }
72
73 private: 75 private:
74 friend class MediaInfoLoaderTest; 76 friend class MediaInfoLoaderTest;
75 77
76 // blink::WebURLLoaderClient implementation. 78 // blink::WebURLLoaderClient implementation.
77 virtual void willSendRequest( 79 virtual void willSendRequest(
78 blink::WebURLLoader* loader, 80 blink::WebURLLoader* loader,
79 blink::WebURLRequest& newRequest, 81 blink::WebURLRequest& newRequest,
80 const blink::WebURLResponse& redirectResponse); 82 const blink::WebURLResponse& redirectResponse);
81 virtual void didSendData( 83 virtual void didSendData(
82 blink::WebURLLoader* loader, 84 blink::WebURLLoader* loader,
(...skipping 25 matching lines...) Expand all
108 void DidBecomeReady(Status status); 110 void DidBecomeReady(Status status);
109 111
110 // Injected WebURLLoader instance for testing purposes. 112 // Injected WebURLLoader instance for testing purposes.
111 scoped_ptr<blink::WebURLLoader> test_loader_; 113 scoped_ptr<blink::WebURLLoader> test_loader_;
112 114
113 // Keeps track of an active WebURLLoader and associated state. 115 // Keeps track of an active WebURLLoader and associated state.
114 scoped_ptr<ActiveLoader> active_loader_; 116 scoped_ptr<ActiveLoader> active_loader_;
115 117
116 bool loader_failed_; 118 bool loader_failed_;
117 GURL url_; 119 GURL url_;
120 GURL first_party_url_;
121 bool allow_stored_credentials_;
118 blink::WebMediaPlayer::CORSMode cors_mode_; 122 blink::WebMediaPlayer::CORSMode cors_mode_;
119 bool single_origin_; 123 bool single_origin_;
120 124
121 ReadyCB ready_cb_; 125 ReadyCB ready_cb_;
122 base::TimeTicks start_time_; 126 base::TimeTicks start_time_;
123 127
124 DISALLOW_COPY_AND_ASSIGN(MediaInfoLoader); 128 DISALLOW_COPY_AND_ASSIGN(MediaInfoLoader);
125 }; 129 };
126 130
127 } // namespace content 131 } // namespace content
128 132
129 #endif // CONTENT_RENDERER_MEDIA_ANDROID_MEDIA_INFO_LOADER_H_ 133 #endif // CONTENT_RENDERER_MEDIA_ANDROID_MEDIA_INFO_LOADER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698