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

Side by Side Diff: content/renderer/media/android/webmediaplayer_android.cc

Issue 887873003: media: Add DefaultMediaPermission. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase only Created 5 years, 10 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
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 #include "content/renderer/media/android/webmediaplayer_android.h" 5 #include "content/renderer/media/android/webmediaplayer_android.h"
6 6
7 #include <limits> 7 #include <limits>
8 8
9 #include "base/android/build_info.h" 9 #include "base/android/build_info.h"
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 } // namespace 140 } // namespace
141 141
142 namespace content { 142 namespace content {
143 143
144 WebMediaPlayerAndroid::WebMediaPlayerAndroid( 144 WebMediaPlayerAndroid::WebMediaPlayerAndroid(
145 blink::WebFrame* frame, 145 blink::WebFrame* frame,
146 blink::WebMediaPlayerClient* client, 146 blink::WebMediaPlayerClient* client,
147 base::WeakPtr<media::WebMediaPlayerDelegate> delegate, 147 base::WeakPtr<media::WebMediaPlayerDelegate> delegate,
148 RendererMediaPlayerManager* player_manager, 148 RendererMediaPlayerManager* player_manager,
149 RendererCdmManager* cdm_manager, 149 RendererCdmManager* cdm_manager,
150 media::MediaPermission* media_permission,
150 blink::WebContentDecryptionModule* initial_cdm, 151 blink::WebContentDecryptionModule* initial_cdm,
151 scoped_refptr<StreamTextureFactory> factory, 152 scoped_refptr<StreamTextureFactory> factory,
152 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner, 153 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner,
153 media::MediaLog* media_log) 154 media::MediaLog* media_log)
154 : RenderFrameObserver(RenderFrame::FromWebFrame(frame)), 155 : RenderFrameObserver(RenderFrame::FromWebFrame(frame)),
155 frame_(frame), 156 frame_(frame),
156 client_(client), 157 client_(client),
157 delegate_(delegate), 158 delegate_(delegate),
158 buffered_(static_cast<size_t>(1)), 159 buffered_(static_cast<size_t>(1)),
159 media_task_runner_(task_runner), 160 media_task_runner_(task_runner),
160 ignore_metadata_duration_change_(false), 161 ignore_metadata_duration_change_(false),
161 pending_seek_(false), 162 pending_seek_(false),
162 seeking_(false), 163 seeking_(false),
163 did_loading_progress_(false), 164 did_loading_progress_(false),
164 player_manager_(player_manager), 165 player_manager_(player_manager),
165 cdm_manager_(cdm_manager), 166 cdm_manager_(cdm_manager),
167 media_permission_(media_permission),
166 network_state_(WebMediaPlayer::NetworkStateEmpty), 168 network_state_(WebMediaPlayer::NetworkStateEmpty),
167 ready_state_(WebMediaPlayer::ReadyStateHaveNothing), 169 ready_state_(WebMediaPlayer::ReadyStateHaveNothing),
168 texture_id_(0), 170 texture_id_(0),
169 stream_id_(0), 171 stream_id_(0),
170 is_player_initialized_(false), 172 is_player_initialized_(false),
171 is_playing_(false), 173 is_playing_(false),
172 needs_establish_peer_(true), 174 needs_establish_peer_(true),
173 has_size_info_(false), 175 has_size_info_(false),
174 // Compositor thread does not exist in layout tests. 176 // Compositor thread does not exist in layout tests.
175 compositor_loop_( 177 compositor_loop_(
(...skipping 1327 matching lines...) Expand 10 before | Expand all | Expand 10 after
1503 const std::string& key_system, 1505 const std::string& key_system,
1504 const unsigned char* init_data, 1506 const unsigned char* init_data,
1505 unsigned init_data_length) { 1507 unsigned init_data_length) {
1506 if (!IsKeySystemSupported(key_system)) 1508 if (!IsKeySystemSupported(key_system))
1507 return WebMediaPlayer::MediaKeyExceptionKeySystemNotSupported; 1509 return WebMediaPlayer::MediaKeyExceptionKeySystemNotSupported;
1508 1510
1509 // We do not support run-time switching between key systems for now. 1511 // We do not support run-time switching between key systems for now.
1510 if (current_key_system_.empty()) { 1512 if (current_key_system_.empty()) {
1511 if (!proxy_decryptor_) { 1513 if (!proxy_decryptor_) {
1512 proxy_decryptor_.reset(new media::ProxyDecryptor( 1514 proxy_decryptor_.reset(new media::ProxyDecryptor(
1515 media_permission_,
1513 base::Bind(&WebMediaPlayerAndroid::OnKeyAdded, 1516 base::Bind(&WebMediaPlayerAndroid::OnKeyAdded,
1514 weak_factory_.GetWeakPtr()), 1517 weak_factory_.GetWeakPtr()),
1515 base::Bind(&WebMediaPlayerAndroid::OnKeyError, 1518 base::Bind(&WebMediaPlayerAndroid::OnKeyError,
1516 weak_factory_.GetWeakPtr()), 1519 weak_factory_.GetWeakPtr()),
1517 base::Bind(&WebMediaPlayerAndroid::OnKeyMessage, 1520 base::Bind(&WebMediaPlayerAndroid::OnKeyMessage,
1518 weak_factory_.GetWeakPtr()))); 1521 weak_factory_.GetWeakPtr())));
1519 } 1522 }
1520 1523
1521 GURL security_origin(frame_->document().securityOrigin().toString()); 1524 GURL security_origin(frame_->document().securityOrigin().toString());
1522 RenderCdmFactory cdm_factory(cdm_manager_); 1525 RenderCdmFactory cdm_factory(cdm_manager_);
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after
1819 1822
1820 bool WebMediaPlayerAndroid::IsHLSStream() const { 1823 bool WebMediaPlayerAndroid::IsHLSStream() const {
1821 std::string mime; 1824 std::string mime;
1822 GURL url = redirected_url_.is_empty() ? url_ : redirected_url_; 1825 GURL url = redirected_url_.is_empty() ? url_ : redirected_url_;
1823 if (!net::GetMimeTypeFromFile(base::FilePath(url.path()), &mime)) 1826 if (!net::GetMimeTypeFromFile(base::FilePath(url.path()), &mime))
1824 return false; 1827 return false;
1825 return !mime.compare("application/x-mpegurl"); 1828 return !mime.compare("application/x-mpegurl");
1826 } 1829 }
1827 1830
1828 } // namespace content 1831 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/media/android/webmediaplayer_android.h ('k') | content/renderer/render_frame_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698