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

Side by Side Diff: content/browser/media/cdm/browser_cdm_manager.cc

Issue 622793002: Group the different permission related methods in the content api. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/browser/media/cdm/browser_cdm_manager.h" 5 #include "content/browser/media/cdm/browser_cdm_manager.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/lazy_instance.h" 9 #include "base/lazy_instance.h"
10 #include "base/task_runner.h" 10 #include "base/task_runner.h"
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after
245 NOTREACHED(); 245 NOTREACHED();
246 SendSessionError(render_frame_id, cdm_id, session_id); 246 SendSessionError(render_frame_id, cdm_id, session_id);
247 return; 247 return;
248 } 248 }
249 GURL security_origin = iter->second; 249 GURL security_origin = iter->second;
250 250
251 RenderFrameHost* rfh = 251 RenderFrameHost* rfh =
252 RenderFrameHost::FromID(render_process_id_, render_frame_id); 252 RenderFrameHost::FromID(render_process_id_, render_frame_id);
253 WebContents* web_contents = WebContents::FromRenderFrameHost(rfh); 253 WebContents* web_contents = WebContents::FromRenderFrameHost(rfh);
254 DCHECK(web_contents); 254 DCHECK(web_contents);
255 255 GetContentClient()->browser()->RequestPermission(
256 base::Closure cancel_callback; 256 content::PERMISSION_PROTECTED_MEDIA,
257 GetContentClient()->browser()->RequestProtectedMediaIdentifierPermission(
258 web_contents, 257 web_contents,
258 0 /* bridge id */,
Peter Beverloo 2014/10/24 14:37:28 Please use c++ style comments: 0, // bridge_id
Miguel Garcia 2014/10/24 16:05:32 Done.
259 security_origin, 259 security_origin,
260 /* only implemented for android infobars which do not support
261 user gesture */
262 true,
Peter Beverloo 2014/10/24 14:37:28 true, // Only implemented for Android infobars wh
Miguel Garcia 2014/10/24 16:05:32 Done.
260 base::Bind(&BrowserCdmManager::CreateSessionIfPermitted, 263 base::Bind(&BrowserCdmManager::CreateSessionIfPermitted,
261 this, 264 this,
262 render_frame_id, cdm_id, session_id, 265 render_frame_id,
263 mime_type, init_data), 266 cdm_id,
264 &cancel_callback); 267 session_id,
265 268 mime_type,
266 if (cancel_callback.is_null()) 269 init_data));
267 return;
268 cdm_cancel_permission_map_[GetId(render_frame_id, cdm_id)] = cancel_callback;
269 } 270 }
270 271
271 void BrowserCdmManager::OnUpdateSession( 272 void BrowserCdmManager::OnUpdateSession(
272 int render_frame_id, 273 int render_frame_id,
273 int cdm_id, 274 int cdm_id,
274 uint32 session_id, 275 uint32 session_id,
275 const std::vector<uint8>& response) { 276 const std::vector<uint8>& response) {
276 BrowserCdm* cdm = GetCdm(render_frame_id, cdm_id); 277 BrowserCdm* cdm = GetCdm(render_frame_id, cdm_id);
277 if (!cdm) { 278 if (!cdm) {
278 DLOG(WARNING) << "No CDM found for: " << render_frame_id << ", " << cdm_id; 279 DLOG(WARNING) << "No CDM found for: " << render_frame_id << ", " << cdm_id;
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
373 DLOG(WARNING) << "No CDM found for: " << render_frame_id << ", " << cdm_id; 374 DLOG(WARNING) << "No CDM found for: " << render_frame_id << ", " << cdm_id;
374 SendSessionError(render_frame_id, cdm_id, session_id); 375 SendSessionError(render_frame_id, cdm_id, session_id);
375 return; 376 return;
376 } 377 }
377 378
378 // This could fail, in which case a SessionError will be fired. 379 // This could fail, in which case a SessionError will be fired.
379 cdm->CreateSession(session_id, content_type, &init_data[0], init_data.size()); 380 cdm->CreateSession(session_id, content_type, &init_data[0], init_data.size());
380 } 381 }
381 382
382 } // namespace content 383 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698