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

Side by Side Diff: content/browser/media/android/media_drm_credential_manager.cc

Issue 930413003: MediaDrm: Only apply Widevine security levels to the Widevine key system. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add creation and SetSecurityLevel tests. 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/browser/media/android/media_drm_credential_manager.h" 5 #include "content/browser/media/android/media_drm_credential_manager.h"
6 6
7 #include "base/android/jni_android.h" 7 #include "base/android/jni_android.h"
8 #include "base/android/scoped_java_ref.h" 8 #include "base/android/scoped_java_ref.h"
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/callback_helpers.h" 10 #include "base/callback_helpers.h"
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 if (security_level == media::MediaDrmBridge::SECURITY_LEVEL_3 && success) { 80 if (security_level == media::MediaDrmBridge::SECURITY_LEVEL_3 && success) {
81 if (ResetCredentialsInternal(media::MediaDrmBridge::SECURITY_LEVEL_1)) 81 if (ResetCredentialsInternal(media::MediaDrmBridge::SECURITY_LEVEL_1))
82 return; 82 return;
83 success = false; 83 success = false;
84 } 84 }
85 85
86 base::ResetAndReturn(&reset_credentials_cb_).Run(success); 86 base::ResetAndReturn(&reset_credentials_cb_).Run(success);
87 media_drm_bridge_.reset(); 87 media_drm_bridge_.reset();
88 } 88 }
89 89
90 // TODO(ddorwin): The key system should be passed in. http://crbug.com/459400
90 bool MediaDrmCredentialManager::ResetCredentialsInternal( 91 bool MediaDrmCredentialManager::ResetCredentialsInternal(
91 SecurityLevel security_level) { 92 SecurityLevel security_level) {
92 media_drm_bridge_ = 93 media_drm_bridge_ =
93 media::MediaDrmBridge::CreateWithoutSessionSupport(kWidevineKeySystem); 94 media::MediaDrmBridge::CreateWithoutSessionSupport(kWidevineKeySystem);
94 if (!media_drm_bridge_) 95 if (!media_drm_bridge_)
95 return false; 96 return false;
96 97
97 ResetCredentialsCB reset_credentials_cb = 98 ResetCredentialsCB reset_credentials_cb =
98 base::Bind(&MediaDrmCredentialManager::OnResetCredentialsCompleted, 99 base::Bind(&MediaDrmCredentialManager::OnResetCredentialsCompleted,
99 base::Unretained(this), security_level); 100 base::Unretained(this), security_level);
100 101
101 if (!media_drm_bridge_->SetSecurityLevel(security_level)) { 102 if (!media_drm_bridge_->SetSecurityLevel(security_level)) {
102 // No need to reset credentials for unsupported |security_level|. 103 // No need to reset credentials for unsupported |security_level|.
103 base::MessageLoopProxy::current()->PostTask( 104 base::MessageLoopProxy::current()->PostTask(
104 FROM_HERE, base::Bind(reset_credentials_cb, true)); 105 FROM_HERE, base::Bind(reset_credentials_cb, true));
105 return true; 106 return true;
106 } 107 }
107 108
108 media_drm_bridge_->ResetDeviceCredentials(reset_credentials_cb); 109 media_drm_bridge_->ResetDeviceCredentials(reset_credentials_cb);
109 return true; 110 return true;
110 } 111 }
111 112
112 // static 113 // static
113 bool MediaDrmCredentialManager::RegisterMediaDrmCredentialManager(JNIEnv* env) { 114 bool MediaDrmCredentialManager::RegisterMediaDrmCredentialManager(JNIEnv* env) {
114 return RegisterNativesImpl(env); 115 return RegisterNativesImpl(env);
115 } 116 }
116 117
117 } // namespace content 118 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698