OLD | NEW |
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/json/json_reader.h" | 9 #include "base/json/json_reader.h" |
10 #include "base/json/json_writer.h" | 10 #include "base/json/json_writer.h" |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 | 193 |
194 void ShellDevToolsFrontend::SetPreferences(const std::string& json) { | 194 void ShellDevToolsFrontend::SetPreferences(const std::string& json) { |
195 preferences_.Clear(); | 195 preferences_.Clear(); |
196 if (json.empty()) | 196 if (json.empty()) |
197 return; | 197 return; |
198 base::DictionaryValue* dict = nullptr; | 198 base::DictionaryValue* dict = nullptr; |
199 std::unique_ptr<base::Value> parsed = base::JSONReader::Read(json); | 199 std::unique_ptr<base::Value> parsed = base::JSONReader::Read(json); |
200 if (!parsed || !parsed->GetAsDictionary(&dict)) | 200 if (!parsed || !parsed->GetAsDictionary(&dict)) |
201 return; | 201 return; |
202 for (base::DictionaryValue::Iterator it(*dict); !it.IsAtEnd(); it.Advance()) { | 202 for (base::DictionaryValue::Iterator it(*dict); !it.IsAtEnd(); it.Advance()) { |
203 if (!it.value().IsType(base::Value::TYPE_STRING)) | 203 if (!it.value().IsType(base::Value::Type::STRING)) |
204 continue; | 204 continue; |
205 preferences_.SetWithoutPathExpansion(it.key(), it.value().CreateDeepCopy()); | 205 preferences_.SetWithoutPathExpansion(it.key(), it.value().CreateDeepCopy()); |
206 } | 206 } |
207 } | 207 } |
208 | 208 |
209 void ShellDevToolsFrontend::HandleMessageFromDevToolsFrontend( | 209 void ShellDevToolsFrontend::HandleMessageFromDevToolsFrontend( |
210 const std::string& message) { | 210 const std::string& message) { |
211 if (!agent_host_) | 211 if (!agent_host_) |
212 return; | 212 return; |
213 std::string method; | 213 std::string method; |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
370 CallClientFunction("DevToolsAPI.embedderMessageAck", | 370 CallClientFunction("DevToolsAPI.embedderMessageAck", |
371 &id_value, arg, nullptr); | 371 &id_value, arg, nullptr); |
372 } | 372 } |
373 | 373 |
374 void ShellDevToolsFrontend::AgentHostClosed( | 374 void ShellDevToolsFrontend::AgentHostClosed( |
375 DevToolsAgentHost* agent_host, bool replaced) { | 375 DevToolsAgentHost* agent_host, bool replaced) { |
376 frontend_shell_->Close(); | 376 frontend_shell_->Close(); |
377 } | 377 } |
378 | 378 |
379 } // namespace content | 379 } // namespace content |
OLD | NEW |