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

Side by Side Diff: content/shell/browser/shell_devtools_frontend.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, 4 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 unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/shell/browser/shell_devtools_frontend.h" 5 #include "content/shell/browser/shell_devtools_frontend.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/json/json_reader.h" 10 #include "base/json/json_reader.h"
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 inspect_element_at_y_ = -1; 186 inspect_element_at_y_ = -1;
187 } 187 }
188 } 188 }
189 189
190 void ShellDevToolsFrontend::WebContentsDestroyed() { 190 void ShellDevToolsFrontend::WebContentsDestroyed() {
191 if (agent_host_) 191 if (agent_host_)
192 agent_host_->DetachClient(this); 192 agent_host_->DetachClient(this);
193 delete this; 193 delete this;
194 } 194 }
195 195
196 void ShellDevToolsFrontend::SetPreferences(const std::string& json) {
197 preferences_.Clear();
198 if (json.empty())
199 return;
200 base::DictionaryValue* dict = nullptr;
201 std::unique_ptr<base::Value> parsed = base::JSONReader::Read(json);
202 if (!parsed || !parsed->GetAsDictionary(&dict))
203 return;
204 for (base::DictionaryValue::Iterator it(*dict); !it.IsAtEnd(); it.Advance()) {
205 if (!it.value().IsType(base::Value::TYPE_STRING))
206 continue;
207 preferences_.SetWithoutPathExpansion(it.key(), it.value().CreateDeepCopy());
208 }
209 }
210
196 void ShellDevToolsFrontend::HandleMessageFromDevToolsFrontend( 211 void ShellDevToolsFrontend::HandleMessageFromDevToolsFrontend(
197 const std::string& message) { 212 const std::string& message) {
198 if (!agent_host_) 213 if (!agent_host_)
199 return; 214 return;
200 std::string method; 215 std::string method;
201 base::ListValue* params = NULL; 216 base::ListValue* params = NULL;
202 base::DictionaryValue* dict = NULL; 217 base::DictionaryValue* dict = NULL;
203 std::unique_ptr<base::Value> parsed_message = base::JSONReader::Read(message); 218 std::unique_ptr<base::Value> parsed_message = base::JSONReader::Read(message);
204 if (!parsed_message || 219 if (!parsed_message ||
205 !parsed_message->GetAsDictionary(&dict) || 220 !parsed_message->GetAsDictionary(&dict) ||
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
357 CallClientFunction("DevToolsAPI.embedderMessageAck", 372 CallClientFunction("DevToolsAPI.embedderMessageAck",
358 &id_value, arg, nullptr); 373 &id_value, arg, nullptr);
359 } 374 }
360 375
361 void ShellDevToolsFrontend::AgentHostClosed( 376 void ShellDevToolsFrontend::AgentHostClosed(
362 DevToolsAgentHost* agent_host, bool replaced) { 377 DevToolsAgentHost* agent_host, bool replaced) {
363 frontend_shell_->Close(); 378 frontend_shell_->Close();
364 } 379 }
365 380
366 } // namespace content 381 } // namespace content
OLDNEW
« no previous file with comments | « content/shell/browser/shell_devtools_frontend.h ('k') | third_party/WebKit/Source/devtools/front_end/devtools.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698