Commit 1426a022 authored by kinaba@chromium.org's avatar kinaba@chromium.org

net-internals: Fallback debug log store when non-native path is download target.

Download destination on Chrome OS may be a virtual path that
needs to be acccessed via JavaScript FileSystem API. As a work around,
when such a path is set, fall back to the initial default directory
that is always a native local location.

BUG=381575

Review URL: https://codereview.chromium.org/375213002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@282045 0039d316-1c4b-4281-b951-d872f2087c98
parent 490e65e2
......@@ -79,6 +79,7 @@
#include "ui/base/resource/resource_bundle.h"
#if defined(OS_CHROMEOS)
#include "chrome/browser/chromeos/file_manager/filesystem_api_util.h"
#include "chrome/browser/chromeos/login/users/user.h"
#include "chrome/browser/chromeos/net/onc_utils.h"
#include "chrome/browser/chromeos/profiles/profile_helper.h"
......@@ -245,6 +246,7 @@ void WriteDebugLogToFile(const StoreDebugLogsCallback& callback,
LOG(ERROR) <<
"Can't create debug log file: " << file_path.AsUTF8Unsafe() << ", " <<
"error: " << file->error_details();
callback.Run(file_path, false);
return;
}
chromeos::DBusThreadManager::Get()->GetDebugDaemonClient()->GetDebugLogs(
......@@ -1532,9 +1534,12 @@ void NetInternalsMessageHandler::OnStoreDebugLogs(const base::ListValue* list) {
SendJavascriptCommand("receivedStoreDebugLogs",
new base::StringValue("Creating log file..."));
const DownloadPrefs* const prefs =
DownloadPrefs::FromBrowserContext(Profile::FromWebUI(web_ui()));
StoreDebugLogs(prefs->DownloadPath(),
Profile* const profile = Profile::FromWebUI(web_ui());
const DownloadPrefs* const prefs = DownloadPrefs::FromBrowserContext(profile);
base::FilePath path = prefs->DownloadPath();
if (file_manager::util::IsUnderNonNativeLocalPath(profile, path))
path = prefs->GetDefaultDownloadDirectoryForProfile();
StoreDebugLogs(path,
base::Bind(&NetInternalsMessageHandler::OnStoreDebugLogsCompleted,
AsWeakPtr()));
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment