Chromium Code Reviews| 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 #include "chrome/browser/media/android/cdm/media_drm_credential_manager.h" | 5 #include "chrome/browser/media/android/cdm/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 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 87 } | 87 } |
| 88 | 88 |
| 89 // TODO(ddorwin): The key system should be passed in. http://crbug.com/459400 | 89 // TODO(ddorwin): The key system should be passed in. http://crbug.com/459400 |
| 90 void MediaDrmCredentialManager::ResetCredentialsInternal( | 90 void MediaDrmCredentialManager::ResetCredentialsInternal( |
| 91 SecurityLevel security_level) { | 91 SecurityLevel security_level) { |
| 92 // Create provision fetcher for the default browser http request context. | 92 // Create provision fetcher for the default browser http request context. |
| 93 media::CreateFetcherCB create_fetcher_cb = | 93 media::CreateFetcherCB create_fetcher_cb = |
| 94 base::Bind(&content::CreateProvisionFetcher, | 94 base::Bind(&content::CreateProvisionFetcher, |
| 95 g_browser_process->system_request_context()); | 95 g_browser_process->system_request_context()); |
| 96 | 96 |
| 97 ResetCredentialsCB reset_credentials_cb = | 97 media::MediaDrmBridge::CreateWithoutSessionSupport( |
| 98 base::Bind(&MediaDrmCredentialManager::OnResetCredentialsCompleted, | 98 kWidevineKeySystem, security_level, create_fetcher_cb, |
| 99 base::Unretained(this), security_level); | 99 base::BindOnce( |
| 100 &MediaDrmCredentialManager::OnMediaDrmCreated, base::Unretained(this), | |
|
xhwang
2017/05/03 06:00:55
This is not new code. But I wonder how is base::Un
yucliu1
2017/05/03 06:33:49
I don't know actually. I'm just copying the old be
yucliu1
2017/05/10 20:41:38
It's safe because it's a singleton.
| |
| 101 base::Bind(&MediaDrmCredentialManager::OnResetCredentialsCompleted, | |
| 102 base::Unretained(this), security_level))); | |
| 103 } | |
| 100 | 104 |
| 101 media_drm_bridge_ = media::MediaDrmBridge::CreateWithoutSessionSupport( | 105 void MediaDrmCredentialManager::OnMediaDrmCreated( |
| 102 kWidevineKeySystem, security_level, create_fetcher_cb); | 106 const ResetCredentialsCB& reset_credentials_cb, |
| 103 | 107 scoped_refptr<media::MediaDrmBridge> cdm) { |
|
xhwang
2017/05/03 06:00:55
Do you need to set media_drm_bridge_ here? e.g.
me
yucliu1
2017/05/03 06:33:49
Yes. Good catch.
yucliu1
2017/05/10 20:41:38
Done.
| |
| 104 // No need to reset credentials for unsupported |security_level|. | 108 // No need to reset credentials for unsupported |security_level|. |
| 105 if (!media_drm_bridge_) { | 109 if (!media_drm_bridge_) { |
| 106 base::ThreadTaskRunnerHandle::Get()->PostTask( | 110 base::ThreadTaskRunnerHandle::Get()->PostTask( |
| 107 FROM_HERE, base::Bind(reset_credentials_cb, true)); | 111 FROM_HERE, base::Bind(reset_credentials_cb, true)); |
| 108 return; | 112 return; |
| 109 } | 113 } |
| 110 | 114 |
| 111 media_drm_bridge_->ResetDeviceCredentials(reset_credentials_cb); | 115 media_drm_bridge_->ResetDeviceCredentials(reset_credentials_cb); |
| 112 } | 116 } |
| 113 | 117 |
| 114 // static | 118 // static |
| 115 bool MediaDrmCredentialManager::RegisterMediaDrmCredentialManager(JNIEnv* env) { | 119 bool MediaDrmCredentialManager::RegisterMediaDrmCredentialManager(JNIEnv* env) { |
| 116 return RegisterNativesImpl(env); | 120 return RegisterNativesImpl(env); |
| 117 } | 121 } |
| OLD | NEW |