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

Side by Side Diff: content/shell/browser/shell_devtools_frontend.cc

Issue 2223093002: Merge to 2785 "[DevTools] Do not use "settings" query param." (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2785
Patch Set: 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 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 agent_host_ = DevToolsAgentHost::GetOrCreateFor(inspected_contents_); 174 agent_host_ = DevToolsAgentHost::GetOrCreateFor(inspected_contents_);
175 agent_host_->AttachClient(this); 175 agent_host_->AttachClient(this);
176 } 176 }
177 177
178 void ShellDevToolsFrontend::WebContentsDestroyed() { 178 void ShellDevToolsFrontend::WebContentsDestroyed() {
179 if (agent_host_) 179 if (agent_host_)
180 agent_host_->DetachClient(this); 180 agent_host_->DetachClient(this);
181 delete this; 181 delete this;
182 } 182 }
183 183
184 void ShellDevToolsFrontend::SetPreferences(const std::string& json) {
185 preferences_.Clear();
186 if (json.empty())
187 return;
188 base::DictionaryValue* dict = nullptr;
189 std::unique_ptr<base::Value> parsed = base::JSONReader::Read(json);
190 if (!parsed || !parsed->GetAsDictionary(&dict))
191 return;
192 for (base::DictionaryValue::Iterator it(*dict); !it.IsAtEnd(); it.Advance()) {
193 if (!it.value().IsType(base::Value::TYPE_STRING))
194 continue;
195 preferences_.SetWithoutPathExpansion(it.key(), it.value().CreateDeepCopy());
196 }
197 }
198
184 void ShellDevToolsFrontend::HandleMessageFromDevToolsFrontend( 199 void ShellDevToolsFrontend::HandleMessageFromDevToolsFrontend(
185 const std::string& message) { 200 const std::string& message) {
186 if (!agent_host_) 201 if (!agent_host_)
187 return; 202 return;
188 std::string method; 203 std::string method;
189 base::ListValue* params = NULL; 204 base::ListValue* params = NULL;
190 base::DictionaryValue* dict = NULL; 205 base::DictionaryValue* dict = NULL;
191 std::unique_ptr<base::Value> parsed_message = base::JSONReader::Read(message); 206 std::unique_ptr<base::Value> parsed_message = base::JSONReader::Read(message);
192 if (!parsed_message || 207 if (!parsed_message ||
193 !parsed_message->GetAsDictionary(&dict) || 208 !parsed_message->GetAsDictionary(&dict) ||
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
345 CallClientFunction("DevToolsAPI.embedderMessageAck", 360 CallClientFunction("DevToolsAPI.embedderMessageAck",
346 &id_value, arg, nullptr); 361 &id_value, arg, nullptr);
347 } 362 }
348 363
349 void ShellDevToolsFrontend::AgentHostClosed( 364 void ShellDevToolsFrontend::AgentHostClosed(
350 DevToolsAgentHost* agent_host, bool replaced) { 365 DevToolsAgentHost* agent_host, bool replaced) {
351 frontend_shell_->Close(); 366 frontend_shell_->Close();
352 } 367 }
353 368
354 } // namespace content 369 } // 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