OLD | NEW |
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 "shell/android/url_response_disk_cache_delegate_impl.h" | 5 #include "shell/android/url_response_disk_cache_delegate_impl.h" |
6 | 6 |
7 #include <android/asset_manager.h> | 7 #include <android/asset_manager.h> |
8 #include <android/asset_manager_jni.h> | 8 #include <android/asset_manager_jni.h> |
9 | 9 |
10 #include "base/android/jni_android.h" | 10 #include "base/android/jni_android.h" |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 | 76 |
77 void URLResponseDiskCacheDelegateImpl::PopulateAssetsIfNeeded() { | 77 void URLResponseDiskCacheDelegateImpl::PopulateAssetsIfNeeded() { |
78 if (url_to_asset_name_.empty()) { | 78 if (url_to_asset_name_.empty()) { |
79 AAssetDir* dir = AAssetManager_openDir(asset_manager_, ""); | 79 AAssetDir* dir = AAssetManager_openDir(asset_manager_, ""); |
80 if (!dir) | 80 if (!dir) |
81 return; | 81 return; |
82 base::ScopedClosureRunner cleanup( | 82 base::ScopedClosureRunner cleanup( |
83 base::Bind(&AAssetDir_close, base::Unretained(dir))); | 83 base::Bind(&AAssetDir_close, base::Unretained(dir))); |
84 while (const char* filename = AAssetDir_getNextFileName(dir)) { | 84 while (const char* filename = AAssetDir_getNextFileName(dir)) { |
85 std::string file_name_string = filename; | 85 std::string file_name_string = filename; |
86 if (EndsWith(file_name_string, kMojoApplicationSuffix, true)) { | 86 if (base::EndsWith(file_name_string, kMojoApplicationSuffix, |
| 87 base::CompareCase::SENSITIVE)) { |
87 std::string base_name = file_name_string.substr( | 88 std::string base_name = file_name_string.substr( |
88 0, | 89 0, |
89 file_name_string.size() - (arraysize(kMojoApplicationSuffix) - 1)); | 90 file_name_string.size() - (arraysize(kMojoApplicationSuffix) - 1)); |
90 std::string url = context_->url_resolver() | 91 std::string url = context_->url_resolver() |
91 ->ResolveMojoURL(GURL("mojo:" + base_name)) | 92 ->ResolveMojoURL(GURL("mojo:" + base_name)) |
92 .spec(); | 93 .spec(); |
93 url_to_asset_name_[url] = file_name_string; | 94 url_to_asset_name_[url] = file_name_string; |
94 } | 95 } |
95 } | 96 } |
96 } | 97 } |
97 } | 98 } |
98 | 99 |
99 } // namespace shell | 100 } // namespace shell |
OLD | NEW |