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

Unified Diff: chrome/browser/devtools/devtools_window.cc

Issue 2177983004: [DevTools] Do not use "settings" query param. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: cleanup Created 4 years, 5 months 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
Index: chrome/browser/devtools/devtools_window.cc
diff --git a/chrome/browser/devtools/devtools_window.cc b/chrome/browser/devtools/devtools_window.cc
index 09a961fd62a3fa524f510e9219f74fab5af6f1e0..6a2a45df1e0d01000b621fc08d4fffb088301c7f 100644
--- a/chrome/browser/devtools/devtools_window.cc
+++ b/chrome/browser/devtools/devtools_window.cc
@@ -90,6 +90,20 @@ bool FindInspectedBrowserAndTabIndex(
return false;
}
+void SetPreferencesFromJson(Profile* profile, const std::string& json) {
+ base::DictionaryValue* dict = nullptr;
+ std::unique_ptr<base::Value> parsed = base::JSONReader::Read(json);
+ if (!parsed || !parsed->GetAsDictionary(&dict))
+ return;
+ DictionaryPrefUpdate update(profile->GetPrefs(), prefs::kDevToolsPreferences);
+ for (base::DictionaryValue::Iterator it(*dict); !it.IsAtEnd(); it.Advance()) {
+ if (!it.value().IsType(base::Value::TYPE_STRING))
+ continue;
+ update.Get()->SetWithoutPathExpansion(
+ it.key(), it.value().CreateDeepCopy());
+ }
+}
+
// DevToolsToolboxDelegate ----------------------------------------------------
class DevToolsToolboxDelegate
@@ -791,7 +805,7 @@ DevToolsWindow* DevToolsWindow::Create(
GURL url(GetDevToolsURL(profile, frontend_url,
shared_worker_frontend,
remote_frontend,
- can_dock, settings));
+ can_dock));
std::unique_ptr<WebContents> main_web_contents(
WebContents::Create(WebContents::CreateParams(profile)));
main_web_contents->GetController().LoadURL(
@@ -801,7 +815,8 @@ DevToolsWindow* DevToolsWindow::Create(
DevToolsUIBindings::ForWebContents(main_web_contents.get());
if (!bindings)
return nullptr;
-
+ if (!settings.empty())
+ SetPreferencesFromJson(profile, settings);
return new DevToolsWindow(profile, main_web_contents.release(), bindings,
inspected_web_contents, can_dock);
}
@@ -811,8 +826,7 @@ GURL DevToolsWindow::GetDevToolsURL(Profile* profile,
const GURL& base_url,
bool shared_worker_frontend,
const std::string& remote_frontend,
- bool can_dock,
- const std::string& settings) {
+ bool can_dock) {
// Compatibility errors are encoded with data urls, pass them
// through with no decoration.
if (base_url.SchemeIs("data"))
@@ -834,8 +848,6 @@ GURL DevToolsWindow::GetDevToolsURL(Profile* profile,
}
if (can_dock)
url_string += "&can_dock=true";
- if (settings.size())
- url_string += "&settings=" + settings;
return GURL(url_string);
}
« no previous file with comments | « chrome/browser/devtools/devtools_window.h ('k') | content/shell/browser/layout_test/blink_test_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698