1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
android_webview / common / aw_paths.cc [blame]
// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "android_webview/common/aw_paths.h"
#include "base/android/path_utils.h"
#include "base/base_paths_android.h"
#include "base/files/file_util.h"
#include "base/path_service.h"
namespace android_webview {
bool PathProvider(int key, base::FilePath* result) {
base::FilePath cur;
switch (key) {
case DIR_CRASH_DUMPS:
if (!base::android::GetCacheDirectory(&cur))
return false;
cur = cur.Append(FILE_PATH_LITERAL("Crashpad"));
break;
case DIR_COMPONENTS_ROOT:
if (!base::android::GetDataDirectory(&cur))
return false;
cur = cur.Append(FILE_PATH_LITERAL("components"))
.Append(FILE_PATH_LITERAL("cus"));
break;
case DIR_COMPONENTS_TEMP:
if (!base::android::GetCacheDirectory(&cur))
return false;
cur = cur.Append(FILE_PATH_LITERAL("components"))
.Append(FILE_PATH_LITERAL("cus"));
break;
case DIR_SAFE_BROWSING:
if (!base::android::GetCacheDirectory(&cur))
return false;
cur = cur.Append(FILE_PATH_LITERAL("SafeBrowsing"));
break;
case DIR_LOCAL_TRACES:
if (!base::android::GetCacheDirectory(&cur)) {
return false;
}
cur = cur.Append(FILE_PATH_LITERAL("Local Traces"));
break;
default:
return false;
}
*result = cur;
return true;
}
void RegisterPathProvider() {
base::PathService::RegisterProvider(PathProvider, PATH_START, PATH_END);
}
} // namespace android_webview