Chromium Code Reviews| Index: android_webview/native/aw_media_url_interceptor.cc |
| diff --git a/android_webview/native/aw_media_url_interceptor.cc b/android_webview/native/aw_media_url_interceptor.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..faf8fe157783ddd62a62202240f4cff19019e01f |
| --- /dev/null |
| +++ b/android_webview/native/aw_media_url_interceptor.cc |
| @@ -0,0 +1,27 @@ |
| +// Copyright (c) 2014 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#include <string> |
| + |
| +#include "android_webview/native/aw_assets.h" |
| +#include "android_webview/native/aw_media_url_interceptor.h" |
| +#include "base/strings/string_util.h" |
| + |
| +namespace android_webview { |
| + |
| + bool AwMediaUrlInterceptor::Intercept(const std::string& url, |
|
mnaganov (inactive)
2014/07/25 08:28:54
'namespace' doesn't increase indentation. This cod
Ignacio Solla
2014/07/25 11:05:48
Done.
|
| + int* fd, int64* offset, int64* size) const{ |
| + const std::string asset_file_prefix("file:///android_asset/"); |
|
mnaganov (inactive)
2014/07/25 08:28:54
Please use android_webview/common/url_constants.h
Ignacio Solla
2014/07/25 11:05:48
Done.
|
| + |
| + if (StartsWithASCII(url, asset_file_prefix, true)) { |
| + std::string filename(url); |
| + ReplaceFirstSubstringAfterOffset(&filename, 0, asset_file_prefix, ""); |
| + return AwAssets::OpenAsset(filename, fd, offset, size); |
| + } |
| + |
| + return false; |
| + } |
| + |
| +} // namespace android_webview |
| + |