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

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

Issue 1079843002: DevTools: allow storing devtools preferences on the browser side. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: review comments addressed Created 5 years, 8 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 "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/json/json_reader.h" 8 #include "base/json/json_reader.h"
9 #include "base/json/json_writer.h" 9 #include "base/json/json_writer.h"
10 #include "base/strings/string_number_conversions.h" 10 #include "base/strings/string_number_conversions.h"
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 net::URLFetcher* fetcher = 217 net::URLFetcher* fetcher =
218 net::URLFetcher::Create(gurl, net::URLFetcher::GET, this); 218 net::URLFetcher::Create(gurl, net::URLFetcher::GET, this);
219 pending_requests_[fetcher] = request_id; 219 pending_requests_[fetcher] = request_id;
220 fetcher->SetRequestContext(web_contents()->GetBrowserContext()-> 220 fetcher->SetRequestContext(web_contents()->GetBrowserContext()->
221 GetRequestContext()); 221 GetRequestContext());
222 fetcher->SetExtraRequestHeaders(headers); 222 fetcher->SetExtraRequestHeaders(headers);
223 fetcher->SaveResponseWithWriter(scoped_ptr<net::URLFetcherResponseWriter>( 223 fetcher->SaveResponseWithWriter(scoped_ptr<net::URLFetcherResponseWriter>(
224 new ResponseWriter(weak_factory_.GetWeakPtr(), stream_id))); 224 new ResponseWriter(weak_factory_.GetWeakPtr(), stream_id)));
225 fetcher->Start(); 225 fetcher->Start();
226 return; 226 return;
227 } else if (method == "getPreferences") {
228 SendMessageAck(request_id, &preferences_);
229 return;
230 } else if (method == "setPreference") {
231 std::string name;
232 std::string value;
233 if (!params->GetString(0, &name) ||
234 !params->GetString(1, &value)) {
235 return;
236 }
237 preferences_.SetStringWithoutPathExpansion(name, value);
238 } else if (method == "removePreference") {
239 std::string name;
240 if (!params->GetString(0, &name))
241 return;
242 preferences_.RemoveWithoutPathExpansion(name, nullptr);
227 } else { 243 } else {
228 return; 244 return;
229 } 245 }
230 246
231 if (request_id) 247 if (request_id)
232 SendMessageAck(request_id, nullptr); 248 SendMessageAck(request_id, nullptr);
233 } 249 }
234 250
235 void ShellDevToolsFrontend::HandleMessageFromDevToolsFrontendToBackend( 251 void ShellDevToolsFrontend::HandleMessageFromDevToolsFrontendToBackend(
236 const std::string& message) { 252 const std::string& message) {
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
313 CallClientFunction("DevToolsAPI.embedderMessageAck", 329 CallClientFunction("DevToolsAPI.embedderMessageAck",
314 &id_value, arg, nullptr); 330 &id_value, arg, nullptr);
315 } 331 }
316 332
317 void ShellDevToolsFrontend::AgentHostClosed( 333 void ShellDevToolsFrontend::AgentHostClosed(
318 DevToolsAgentHost* agent_host, bool replaced) { 334 DevToolsAgentHost* agent_host, bool replaced) {
319 frontend_shell_->Close(); 335 frontend_shell_->Close();
320 } 336 }
321 337
322 } // namespace content 338 } // namespace content
OLDNEW
« no previous file with comments | « content/shell/browser/shell_devtools_frontend.h ('k') | content/shell/renderer/test_runner/test_interfaces.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698