OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 "android_webview/common/aw_paths.h" | 5 #include "android_webview/common/aw_paths.h" |
6 | 6 |
7 #include "base/android/path_utils.h" | 7 #include "base/android/path_utils.h" |
8 #include "base/base_paths_android.h" | 8 #include "base/base_paths_android.h" |
9 #include "base/files/file_util.h" | 9 #include "base/files/file_util.h" |
10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
11 | 11 |
12 namespace android_webview { | 12 namespace android_webview { |
13 | 13 |
14 bool PathProvider(int key, base::FilePath* result) { | 14 bool PathProvider(int key, base::FilePath* result) { |
15 base::FilePath cur; | 15 base::FilePath cur; |
16 | 16 |
17 switch (key) { | 17 switch (key) { |
18 case DIR_CRASH_DUMPS: | 18 case DIR_CRASH_DUMPS: |
19 if (!base::android::GetCacheDirectory(&cur)) | 19 if (!base::android::GetCacheDirectory(&cur)) |
20 return false; | 20 return false; |
21 cur = cur.Append(FILE_PATH_LITERAL("WebView")) | 21 cur = cur.Append(FILE_PATH_LITERAL("WebView")) |
22 .Append(FILE_PATH_LITERAL("Crash Reports")); | 22 .Append(FILE_PATH_LITERAL("Crash Reports")); |
23 break; | 23 break; |
| 24 case DIR_SAFE_BROWSING: |
| 25 if (!base::android::GetCacheDirectory(&cur)) |
| 26 return false; |
| 27 cur = cur.Append(FILE_PATH_LITERAL("WebView")) |
| 28 .Append(FILE_PATH_LITERAL("SafeBrowsing")); |
| 29 break; |
24 default: | 30 default: |
25 return false; | 31 return false; |
26 } | 32 } |
27 | 33 |
28 *result = cur; | 34 *result = cur; |
29 return true; | 35 return true; |
30 } | 36 } |
31 | 37 |
32 void RegisterPathProvider() { | 38 void RegisterPathProvider() { |
33 PathService::RegisterProvider(PathProvider, PATH_START, PATH_END); | 39 PathService::RegisterProvider(PathProvider, PATH_START, PATH_END); |
34 } | 40 } |
35 | 41 |
36 } // namespace android_webview | 42 } // namespace android_webview |
OLD | NEW |