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

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

Issue 937863003: Add AwAssets into android_webview/native/public (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Just move aw_assets to public totally 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
« no previous file with comments | « android_webview/native/aw_assets.cc ('k') | android_webview/native/public/aw_assets.h » ('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_assets.h"
9 #include "android_webview/native/aw_media_url_interceptor.h" 8 #include "android_webview/native/aw_media_url_interceptor.h"
9 #include "android_webview/native/public/aw_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, int64* offset, int64* size) const{ 16 int* fd, int64* offset, int64* size) const{
17 const std::string asset_file_prefix( 17 const std::string asset_file_prefix(
18 std::string(url::kFileScheme) + 18 std::string(url::kFileScheme) +
19 std::string(url::kStandardSchemeSeparator) + 19 std::string(url::kStandardSchemeSeparator) +
20 android_webview::kAndroidAssetPath); 20 android_webview::kAndroidAssetPath);
21 21
22 if (StartsWithASCII(url, asset_file_prefix, true)) { 22 if (StartsWithASCII(url, asset_file_prefix, true)) {
23 std::string filename(url); 23 std::string filename(url);
24 ReplaceFirstSubstringAfterOffset(&filename, 0, asset_file_prefix, ""); 24 ReplaceFirstSubstringAfterOffset(&filename, 0, asset_file_prefix, "");
25 return AwAssets::OpenAsset(filename, fd, offset, size); 25 return AwAssets::OpenAsset(filename, fd, offset, size);
26 } 26 }
27 27
28 return false; 28 return false;
29 } 29 }
30 30
31 } // namespace android_webview 31 } // namespace android_webview
32 32
OLDNEW
« no previous file with comments | « android_webview/native/aw_assets.cc ('k') | android_webview/native/public/aw_assets.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698