Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3306)

Unified Diff: chrome/browser/ui/webui/net_internals/net_internals_ui.cc

Issue 68573005: Fixed location for debug logs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix. Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/webui/net_internals/net_internals_ui.cc
diff --git a/chrome/browser/ui/webui/net_internals/net_internals_ui.cc b/chrome/browser/ui/webui/net_internals/net_internals_ui.cc
index cee252a6538be274936eeabe6bcf2ce3c2a6684c..d340be42133cc67f3ba31b2a4e5d91624962dd76 100644
--- a/chrome/browser/ui/webui/net_internals/net_internals_ui.cc
+++ b/chrome/browser/ui/webui/net_internals/net_internals_ui.cc
@@ -95,6 +95,7 @@
using base::PassPlatformFile;
using base::PlatformFile;
using base::PlatformFileError;
+using base::StringValue;
using content::BrowserThread;
using content::WebContents;
using content::WebUIMessageHandler;
@@ -373,14 +374,14 @@ void WriteDebugLogToFile(const StoreDebugLogsCallback& callback,
callback, PassPlatformFile(&platform_file), file_path));
}
-// Stores debug logs in the .tgz archive on the fileshelf. The file is
-// created on the worker pool, then writing to it is triggered from
+// Stores debug logs in the .tgz archive on the |fileshelf|. The file
+// is created on the worker pool, then writing to it is triggered from
// the UI thread, and finally it is closed (on success) or deleted (on
// failure) on the worker pool, prior to calling |callback|.
-void StoreDebugLogs(const StoreDebugLogsCallback& callback) {
+void StoreDebugLogs(const base::FilePath& fileshelf,
+ const StoreDebugLogsCallback& callback) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
DCHECK(!callback.is_null());
- const base::FilePath fileshelf = DownloadPrefs::GetDefaultDownloadDirectory();
DebugLogFileHelper* helper = new DebugLogFileHelper();
bool posted = base::WorkerPool::PostTaskAndReply(FROM_HERE,
base::Bind(&DebugLogFileHelper::DoWork,
@@ -838,7 +839,7 @@ void NetInternalsMessageHandler::RegisterMessages() {
void NetInternalsMessageHandler::SendJavascriptCommand(
const std::string& command,
Value* arg) {
- scoped_ptr<Value> command_value(Value::CreateStringValue(command));
+ scoped_ptr<Value> command_value(new StringValue(command));
scoped_ptr<Value> value(arg);
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
if (value.get()) {
@@ -1576,13 +1577,17 @@ void NetInternalsMessageHandler::OnImportONCFile(const ListValue* list) {
}
LOG_IF(ERROR, !error.empty()) << error;
- SendJavascriptCommand("receivedONCFileParse",
- Value::CreateStringValue(error));
+ SendJavascriptCommand("receivedONCFileParse", new StringValue(error));
}
void NetInternalsMessageHandler::OnStoreDebugLogs(const ListValue* list) {
DCHECK(list);
- StoreDebugLogs(
+
+ SendJavascriptCommand("receivedStoreDebugLogs",
+ new StringValue("Creating log file..."));
+ const DownloadPrefs* const prefs =
+ DownloadPrefs::FromBrowserContext(Profile::FromWebUI(web_ui()));
+ StoreDebugLogs(prefs->DownloadPath(),
base::Bind(&NetInternalsMessageHandler::OnStoreDebugLogsCompleted,
AsWeakPtr()));
}
@@ -1594,8 +1599,7 @@ void NetInternalsMessageHandler::OnStoreDebugLogsCompleted(
status = "Created log file: " + log_path.BaseName().AsUTF8Unsafe();
else
status = "Failed to create log file";
- SendJavascriptCommand("receivedStoreDebugLogs",
- Value::CreateStringValue(status));
+ SendJavascriptCommand("receivedStoreDebugLogs", new StringValue(status));
}
void NetInternalsMessageHandler::OnSetNetworkDebugMode(const ListValue* list) {
@@ -1619,8 +1623,7 @@ void NetInternalsMessageHandler::OnSetNetworkDebugModeCompleted(
status = "Debug mode is changed to " + subsystem;
else
status = "Failed to change debug mode to " + subsystem;
- SendJavascriptCommand("receivedSetNetworkDebugMode",
- Value::CreateStringValue(status));
+ SendJavascriptCommand("receivedSetNetworkDebugMode", new StringValue(status));
}
#endif // defined(OS_CHROMEOS)
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698