[email protected] | e7bee399 | 2012-09-27 18:36:26 | [diff] [blame] | 1 | // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | #include "android_webview/common/url_constants.h" |
| 6 | |
mnaganov | b58eaaa | 2015-08-13 16:33:32 | [diff] [blame] | 7 | #include "base/strings/string_util.h" |
| 8 | |
[email protected] | e7bee399 | 2012-09-27 18:36:26 | [diff] [blame] | 9 | namespace android_webview { |
| 10 | |
[email protected] | e7bee399 | 2012-09-27 18:36:26 | [diff] [blame] | 11 | // These are special paths used with the file: scheme to access application |
| 12 | // assets and resources. |
| 13 | // See http://developer.android.com/reference/android/webkit/WebSettings.html |
| 14 | const char kAndroidAssetPath[] = "/android_asset/"; |
| 15 | const char kAndroidResourcePath[] = "/android_res/"; |
| 16 | |
[email protected] | 81778daf | 2013-10-21 16:19:52 | [diff] [blame] | 17 | // This scheme is used to display a default HTML5 video poster. |
| 18 | const char kAndroidWebViewVideoPosterScheme[] = "android-webview-video-poster"; |
| 19 | |
mnaganov | b58eaaa | 2015-08-13 16:33:32 | [diff] [blame] | 20 | bool IsAndroidSpecialFileUrl(const GURL& url) { |
| 21 | if (!url.is_valid() || !url.SchemeIsFile() || !url.has_path()) |
| 22 | return false; |
| 23 | return base::StartsWith(url.path(), kAndroidAssetPath, |
| 24 | base::CompareCase::SENSITIVE) || |
| 25 | base::StartsWith(url.path(), kAndroidResourcePath, |
| 26 | base::CompareCase::SENSITIVE); |
| 27 | } |
| 28 | |
[email protected] | e7bee399 | 2012-09-27 18:36:26 | [diff] [blame] | 29 | } // namespace android_webview |