undo changes to WebContentsPreferences::GetPreloadPath to fix mac build
This commit is contained in:
parent
2d3c65beca
commit
deeb2de14b
1 changed files with 4 additions and 10 deletions
|
@ -235,24 +235,18 @@ bool WebContentsPreferences::GetPreference(base::StringPiece name,
|
||||||
bool WebContentsPreferences::GetPreloadPath(base::FilePath* path) const {
|
bool WebContentsPreferences::GetPreloadPath(base::FilePath* path) const {
|
||||||
DCHECK(path);
|
DCHECK(path);
|
||||||
base::FilePath::StringType preload_path;
|
base::FilePath::StringType preload_path;
|
||||||
std::u16string preload_path_str;
|
if (GetAsString(&preference_, options::kPreloadScript, &preload_path)) {
|
||||||
if (GetAsString(&preference_, options::kPreloadScript, &preload_path_str)) {
|
base::FilePath preload(preload_path);
|
||||||
#if defined(OS_WIN)
|
|
||||||
base::FilePath preload(base::UTF16ToWide(preload_path_str));
|
|
||||||
#else
|
|
||||||
base::FilePath preload(preload_path_str);
|
|
||||||
#endif
|
|
||||||
if (preload.IsAbsolute()) {
|
if (preload.IsAbsolute()) {
|
||||||
*path = std::move(preload);
|
*path = std::move(preload);
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
LOG(ERROR) << "preload script must have absolute path.";
|
LOG(ERROR) << "preload script must have absolute path.";
|
||||||
}
|
}
|
||||||
} else if (GetAsString(&preference_, options::kPreloadURL,
|
} else if (GetAsString(&preference_, options::kPreloadURL, &preload_path)) {
|
||||||
&preload_path_str)) {
|
|
||||||
// Translate to file path if there is "preload-url" option.
|
// Translate to file path if there is "preload-url" option.
|
||||||
base::FilePath preload;
|
base::FilePath preload;
|
||||||
if (net::FileURLToFilePath(GURL(preload_path_str), &preload)) {
|
if (net::FileURLToFilePath(GURL(preload_path), &preload)) {
|
||||||
*path = std::move(preload);
|
*path = std::move(preload);
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in a new issue