|
@@ -61,6 +61,21 @@ bool GetAsString(const base::Value* val,
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
+#if defined(OS_WIN)
|
|
|
+bool GetAsString(const base::Value* val,
|
|
|
+ base::FilePath::StringPieceType path,
|
|
|
+ std::u16string* out) {
|
|
|
+ if (val) {
|
|
|
+ auto* found = val->FindKeyOfType(path, base::Value::Type::STRING);
|
|
|
+ if (found) {
|
|
|
+ *out = base::UTF8ToWide(found->GetString());
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return false;
|
|
|
+}
|
|
|
+#endif
|
|
|
+
|
|
|
bool GetAsInteger(const base::Value* val, base::StringPiece path, int* out) {
|
|
|
if (val) {
|
|
|
auto* found = val->FindKey(path);
|
|
@@ -246,6 +261,12 @@ bool WebContentsPreferences::GetPreloadPath(base::FilePath* path) const {
|
|
|
} else if (GetAsString(&preference_, options::kPreloadURL, &preload_path)) {
|
|
|
// Translate to file path if there is "preload-url" option.
|
|
|
base::FilePath preload;
|
|
|
+ GURL preload_url;
|
|
|
+#if defined(OS_WIN)
|
|
|
+ preload_url = GURL(base::WideToUTF8(preload_path));
|
|
|
+#else
|
|
|
+ preload_url = GURL(preload_path);
|
|
|
+#endif
|
|
|
if (net::FileURLToFilePath(GURL(preload_path), &preload)) {
|
|
|
*path = std::move(preload);
|
|
|
return true;
|