| Index: media/cdm/json_web_key.cc
|
| diff --git a/media/cdm/json_web_key.cc b/media/cdm/json_web_key.cc
|
| index 850c44c8bc62658fc14d85f590c0742ccfdd4d83..aec7273a1d88dfb77596e8356acd7af37e7e9df8 100644
|
| --- a/media/cdm/json_web_key.cc
|
| +++ b/media/cdm/json_web_key.cc
|
| @@ -6,13 +6,14 @@
|
|
|
| #include <stddef.h>
|
|
|
| +#include <memory>
|
| +
|
| #include "base/base64url.h"
|
| #include "base/json/json_reader.h"
|
| #include "base/json/json_string_value_serializer.h"
|
| #include "base/json/string_escape.h"
|
| #include "base/logging.h"
|
| #include "base/macros.h"
|
| -#include "base/memory/scoped_ptr.h"
|
| #include "base/strings/string_number_conversions.h"
|
| #include "base/strings/string_piece.h"
|
| #include "base/strings/string_util.h"
|
| @@ -46,7 +47,7 @@ static std::string ShortenTo64Characters(const std::string& input) {
|
| return escaped_str.substr(0, 61).append("...");
|
| }
|
|
|
| -static scoped_ptr<base::DictionaryValue> CreateJSONDictionary(
|
| +static std::unique_ptr<base::DictionaryValue> CreateJSONDictionary(
|
| const uint8_t* key,
|
| int key_length,
|
| const uint8_t* key_id,
|
| @@ -59,7 +60,7 @@ static scoped_ptr<base::DictionaryValue> CreateJSONDictionary(
|
| base::StringPiece(reinterpret_cast<const char*>(key_id), key_id_length),
|
| base::Base64UrlEncodePolicy::OMIT_PADDING, &key_id_string);
|
|
|
| - scoped_ptr<base::DictionaryValue> jwk(new base::DictionaryValue());
|
| + std::unique_ptr<base::DictionaryValue> jwk(new base::DictionaryValue());
|
| jwk->SetString(kKeyTypeTag, kKeyTypeOct);
|
| jwk->SetString(kKeyTag, key_string);
|
| jwk->SetString(kKeyIdTag, key_id_string);
|
| @@ -71,7 +72,7 @@ std::string GenerateJWKSet(const uint8_t* key,
|
| const uint8_t* key_id,
|
| int key_id_length) {
|
| // Create the JWK, and wrap it into a JWK Set.
|
| - scoped_ptr<base::ListValue> list(new base::ListValue());
|
| + std::unique_ptr<base::ListValue> list(new base::ListValue());
|
| list->Append(
|
| CreateJSONDictionary(key, key_length, key_id, key_id_length).release());
|
| base::DictionaryValue jwk_set;
|
| @@ -86,7 +87,7 @@ std::string GenerateJWKSet(const uint8_t* key,
|
|
|
| std::string GenerateJWKSet(const KeyIdAndKeyPairs& keys,
|
| MediaKeys::SessionType session_type) {
|
| - scoped_ptr<base::ListValue> list(new base::ListValue());
|
| + std::unique_ptr<base::ListValue> list(new base::ListValue());
|
| for (const auto& key_pair : keys) {
|
| list->Append(CreateJSONDictionary(
|
| reinterpret_cast<const uint8_t*>(key_pair.second.data()),
|
| @@ -171,7 +172,7 @@ bool ExtractKeysFromJWKSet(const std::string& jwk_set,
|
| return false;
|
| }
|
|
|
| - scoped_ptr<base::Value> root(base::JSONReader().ReadToValue(jwk_set));
|
| + std::unique_ptr<base::Value> root(base::JSONReader().ReadToValue(jwk_set));
|
| if (!root.get() || root->GetType() != base::Value::TYPE_DICTIONARY) {
|
| DVLOG(1) << "Not valid JSON: " << jwk_set << ", root: " << root.get();
|
| return false;
|
| @@ -240,7 +241,7 @@ bool ExtractKeyIdsFromKeyIdsInitData(const std::string& input,
|
| return false;
|
| }
|
|
|
| - scoped_ptr<base::Value> root(base::JSONReader().ReadToValue(input));
|
| + std::unique_ptr<base::Value> root(base::JSONReader().ReadToValue(input));
|
| if (!root.get() || root->GetType() != base::Value::TYPE_DICTIONARY) {
|
| error_message->assign("Not valid JSON: ");
|
| error_message->append(ShortenTo64Characters(input));
|
| @@ -302,8 +303,8 @@ void CreateLicenseRequest(const KeyIdList& key_ids,
|
| MediaKeys::SessionType session_type,
|
| std::vector<uint8_t>* license) {
|
| // Create the license request.
|
| - scoped_ptr<base::DictionaryValue> request(new base::DictionaryValue());
|
| - scoped_ptr<base::ListValue> list(new base::ListValue());
|
| + std::unique_ptr<base::DictionaryValue> request(new base::DictionaryValue());
|
| + std::unique_ptr<base::ListValue> list(new base::ListValue());
|
| for (const auto& key_id : key_ids) {
|
| std::string key_id_string;
|
| base::Base64UrlEncode(
|
| @@ -340,8 +341,9 @@ void CreateLicenseRequest(const KeyIdList& key_ids,
|
| void CreateKeyIdsInitData(const KeyIdList& key_ids,
|
| std::vector<uint8_t>* init_data) {
|
| // Create the init_data.
|
| - scoped_ptr<base::DictionaryValue> dictionary(new base::DictionaryValue());
|
| - scoped_ptr<base::ListValue> list(new base::ListValue());
|
| + std::unique_ptr<base::DictionaryValue> dictionary(
|
| + new base::DictionaryValue());
|
| + std::unique_ptr<base::ListValue> list(new base::ListValue());
|
| for (const auto& key_id : key_ids) {
|
| std::string key_id_string;
|
| base::Base64UrlEncode(
|
| @@ -373,7 +375,8 @@ bool ExtractFirstKeyIdFromLicenseRequest(const std::vector<uint8_t>& license,
|
| return false;
|
| }
|
|
|
| - scoped_ptr<base::Value> root(base::JSONReader().ReadToValue(license_as_str));
|
| + std::unique_ptr<base::Value> root(
|
| + base::JSONReader().ReadToValue(license_as_str));
|
| if (!root.get() || root->GetType() != base::Value::TYPE_DICTIONARY) {
|
| DVLOG(1) << "Not valid JSON: " << license_as_str;
|
| return false;
|
|
|