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

Side by Side Diff: content/browser/devtools/protocol/network_handler.cc

Issue 2003253002: [Devtools] Allow User-Agent header override for Websockets (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/browser/devtools/protocol/network_handler.h" 5 #include "content/browser/devtools/protocol/network_handler.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/containers/hash_tables.h" 9 #include "base/containers/hash_tables.h"
10 #include "base/strings/stringprintf.h" 10 #include "base/strings/stringprintf.h"
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 } 198 }
199 199
200 void NetworkHandler::SetRenderFrameHost(RenderFrameHostImpl* host) { 200 void NetworkHandler::SetRenderFrameHost(RenderFrameHostImpl* host) {
201 host_ = host; 201 host_ = host;
202 } 202 }
203 203
204 void NetworkHandler::SetClient(std::unique_ptr<Client> client) { 204 void NetworkHandler::SetClient(std::unique_ptr<Client> client) {
205 client_.swap(client); 205 client_.swap(client);
206 } 206 }
207 207
208 void NetworkHandler::Detached() {
209 user_agent_override_ = "";
210 }
211
212 std::string NetworkHandler::GetUserAgentOverride() {
213 return user_agent_override_;
214 }
215
208 Response NetworkHandler::ClearBrowserCache() { 216 Response NetworkHandler::ClearBrowserCache() {
209 if (host_) 217 if (host_)
210 GetContentClient()->browser()->ClearCache(host_); 218 GetContentClient()->browser()->ClearCache(host_);
211 return Response::OK(); 219 return Response::OK();
212 } 220 }
213 221
214 Response NetworkHandler::ClearBrowserCookies() { 222 Response NetworkHandler::ClearBrowserCookies() {
215 if (host_) 223 if (host_)
216 GetContentClient()->browser()->ClearCookies(host_); 224 GetContentClient()->browser()->ClearCookies(host_);
217 return Response::OK(); 225 return Response::OK();
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
327 335
328 Response NetworkHandler::ShowCertificateViewer(int certificate_id) { 336 Response NetworkHandler::ShowCertificateViewer(int certificate_id) {
329 if (!host_) 337 if (!host_)
330 return Response::InternalError("Could not connect to view"); 338 return Response::InternalError("Could not connect to view");
331 WebContents* web_contents = WebContents::FromRenderFrameHost(host_); 339 WebContents* web_contents = WebContents::FromRenderFrameHost(host_);
332 web_contents->GetDelegate()->ShowCertificateViewerInDevTools( 340 web_contents->GetDelegate()->ShowCertificateViewerInDevTools(
333 web_contents, certificate_id); 341 web_contents, certificate_id);
334 return Response::OK(); 342 return Response::OK();
335 } 343 }
336 344
345 Response NetworkHandler::SetUserAgentOverride(const std::string& user_agent) {
346 if (!host_)
347 return Response::InternalError("Could not connect to view");
348 user_agent_override_ = user_agent;
349 return Response::OK();
350 }
351
337 } // namespace network 352 } // namespace network
338 } // namespace devtools 353 } // namespace devtools
339 } // namespace content 354 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698