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

Side by Side Diff: android_webview/native/aw_media_url_interceptor.cc

Issue 1242023005: Remove legacy StartsWithASCII function. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: y Created 5 years, 5 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 | « android_webview/native/android_protocol_handler.cc ('k') | ash/wm/lock_state_controller.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 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 <string> 5 #include <string>
6 6
7 #include "android_webview/common/url_constants.h" 7 #include "android_webview/common/url_constants.h"
8 #include "android_webview/native/aw_media_url_interceptor.h" 8 #include "android_webview/native/aw_media_url_interceptor.h"
9 #include "base/android/apk_assets.h" 9 #include "base/android/apk_assets.h"
10 #include "base/strings/string_util.h" 10 #include "base/strings/string_util.h"
11 #include "content/public/common/url_constants.h" 11 #include "content/public/common/url_constants.h"
12 12
13 namespace android_webview { 13 namespace android_webview {
14 14
15 bool AwMediaUrlInterceptor::Intercept(const std::string& url, 15 bool AwMediaUrlInterceptor::Intercept(const std::string& url,
16 int* fd, 16 int* fd,
17 int64* offset, 17 int64* offset,
18 int64* size) const{ 18 int64* size) const{
19 std::string asset_file_prefix(url::kFileScheme); 19 std::string asset_file_prefix(url::kFileScheme);
20 asset_file_prefix.append(url::kStandardSchemeSeparator); 20 asset_file_prefix.append(url::kStandardSchemeSeparator);
21 asset_file_prefix.append(android_webview::kAndroidAssetPath); 21 asset_file_prefix.append(android_webview::kAndroidAssetPath);
22 22
23 if (base::StartsWithASCII(url, asset_file_prefix, true)) { 23 if (base::StartsWith(url, asset_file_prefix, base::CompareCase::SENSITIVE)) {
24 std::string filename(url); 24 std::string filename(url);
25 base::ReplaceFirstSubstringAfterOffset( 25 base::ReplaceFirstSubstringAfterOffset(
26 &filename, 0, asset_file_prefix, "assets/"); 26 &filename, 0, asset_file_prefix, "assets/");
27 base::MemoryMappedFile::Region region = 27 base::MemoryMappedFile::Region region =
28 base::MemoryMappedFile::Region::kWholeFile; 28 base::MemoryMappedFile::Region::kWholeFile;
29 *fd = base::android::OpenApkAsset(filename, &region); 29 *fd = base::android::OpenApkAsset(filename, &region);
30 *offset = region.offset; 30 *offset = region.offset;
31 *size = region.size; 31 *size = region.size;
32 return *fd != -1; 32 return *fd != -1;
33 } 33 }
34 34
35 return false; 35 return false;
36 } 36 }
37 37
38 } // namespace android_webview 38 } // namespace android_webview
OLDNEW
« no previous file with comments | « android_webview/native/android_protocol_handler.cc ('k') | ash/wm/lock_state_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698