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

Side by Side Diff: android_webview/browser/aw_media_client_android.cc

Issue 1197243004: Replace some Tokenize calls with SplitString. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix android Created 5 years, 6 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
« no previous file with comments | « no previous file | ash/display/display_info.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "android_webview/browser/aw_media_client_android.h" 5 #include "android_webview/browser/aw_media_client_android.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/stl_util.h" 10 #include "base/stl_util.h"
11 #include "base/strings/string_number_conversions.h" 11 #include "base/strings/string_number_conversions.h"
12 #include "base/strings/string_split.h"
12 #include "base/strings/string_util.h" 13 #include "base/strings/string_util.h"
13 14
14 namespace android_webview { 15 namespace android_webview {
15 16
16 namespace { 17 namespace {
17 18
18 const size_t kGUIDLength = 36U; 19 const size_t kGUIDLength = 36U;
19 20
20 #define RCHECK(x) \ 21 #define RCHECK(x) \
21 if (!(x)) { \ 22 if (!(x)) { \
22 LOG(ERROR) << "Can't parse key-system mapping: " \ 23 LOG(ERROR) << "Can't parse key-system mapping: " \
23 << key_system_uuid_mapping; \ 24 << key_system_uuid_mapping; \
24 return std::make_pair("", uuid); \ 25 return std::make_pair("", uuid); \
25 } 26 }
26 27
27 media::MediaClientAndroid::KeySystemUuidMap::value_type CreateMappingFromString( 28 media::MediaClientAndroid::KeySystemUuidMap::value_type CreateMappingFromString(
28 const std::string& key_system_uuid_mapping) { 29 const std::string& key_system_uuid_mapping) {
29 std::vector<uint8_t> uuid; 30 std::vector<uint8_t> uuid;
30 31
31 std::vector<std::string> tokens; 32 std::vector<std::string> tokens =
32 Tokenize(key_system_uuid_mapping, ",", &tokens); 33 base::SplitString(key_system_uuid_mapping, ",", base::KEEP_WHITESPACE,
34 base::SPLIT_WANT_NONEMPTY);
33 RCHECK(tokens.size() == 2); 35 RCHECK(tokens.size() == 2);
34 36
35 std::string key_system; 37 std::string key_system;
36 base::TrimWhitespaceASCII(tokens[0], base::TRIM_ALL, &key_system); 38 base::TrimWhitespaceASCII(tokens[0], base::TRIM_ALL, &key_system);
37 39
38 std::string guid(tokens[1]); 40 std::string guid(tokens[1]);
39 RCHECK(guid.length() == kGUIDLength); 41 RCHECK(guid.length() == kGUIDLength);
40 base::RemoveChars(guid, "-", &guid); 42 base::RemoveChars(guid, "-", &guid);
41 RCHECK(base::HexStringToBytes(guid, &uuid)); 43 RCHECK(base::HexStringToBytes(guid, &uuid));
42 44
(...skipping 19 matching lines...) Expand all
62 } 64 }
63 65
64 media::MediaDrmBridgeDelegate* AwMediaClientAndroid::GetMediaDrmBridgeDelegate( 66 media::MediaDrmBridgeDelegate* AwMediaClientAndroid::GetMediaDrmBridgeDelegate(
65 const media::UUID& scheme_uuid) { 67 const media::UUID& scheme_uuid) {
66 if (scheme_uuid == widevine_delegate_.GetUUID()) 68 if (scheme_uuid == widevine_delegate_.GetUUID())
67 return &widevine_delegate_; 69 return &widevine_delegate_;
68 return nullptr; 70 return nullptr;
69 } 71 }
70 72
71 } // namespace android_webview 73 } // namespace android_webview
OLDNEW
« no previous file with comments | « no previous file | ash/display/display_info.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698