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

Side by Side Diff: content/browser/devtools/forwarding_agent_host.cc

Issue 906223003: [DevTools] Preserve DevTools window when remote connection is lost. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/forwarding_agent_host.h" 5 #include "content/browser/devtools/forwarding_agent_host.h"
6 6
7 #include "base/bind.h"
8 #include "content/browser/devtools/protocol/inspector_handler.h"
9
7 namespace content { 10 namespace content {
8 11
9 ForwardingAgentHost::ForwardingAgentHost( 12 ForwardingAgentHost::ForwardingAgentHost(
10 DevToolsExternalAgentProxyDelegate* delegate) 13 DevToolsExternalAgentProxyDelegate* delegate)
11 : delegate_(delegate) { 14 : delegate_(delegate) {
12 } 15 }
13 16
14 ForwardingAgentHost::~ForwardingAgentHost() { 17 ForwardingAgentHost::~ForwardingAgentHost() {
15 } 18 }
16 19
17 void ForwardingAgentHost::DispatchOnClientHost(const std::string& message) { 20 void ForwardingAgentHost::DispatchOnClientHost(const std::string& message) {
18 SendMessageToClient(message); 21 SendMessageToClient(message);
19 } 22 }
20 23
21 void ForwardingAgentHost::ConnectionClosed() { 24 void ForwardingAgentHost::ConnectionClosed() {
22 HostClosed(); 25 devtools::inspector::Client inspector(
26 base::Bind(&ForwardingAgentHost::DispatchOnClientHost,
27 base::Unretained(this)));
28 inspector.Detached(devtools::inspector::DetachedParams::Create()
29 ->set_reason("Connection lost."));
30 delegate_.reset();
23 } 31 }
24 32
25 void ForwardingAgentHost::Attach() { 33 void ForwardingAgentHost::Attach() {
26 delegate_->Attach(this); 34 if (delegate_)
35 delegate_->Attach(this);
27 } 36 }
28 37
29 void ForwardingAgentHost::Detach() { 38 void ForwardingAgentHost::Detach() {
30 delegate_->Detach(); 39 if (delegate_)
40 delegate_->Detach();
31 } 41 }
32 42
33 void ForwardingAgentHost::DispatchProtocolMessage( 43 void ForwardingAgentHost::DispatchProtocolMessage(
34 const std::string& message) { 44 const std::string& message) {
35 delegate_->SendMessageToBackend(message); 45 if (delegate_)
46 delegate_->SendMessageToBackend(message);
36 } 47 }
37 48
38 DevToolsAgentHost::Type ForwardingAgentHost::GetType() { 49 DevToolsAgentHost::Type ForwardingAgentHost::GetType() {
39 return TYPE_EXTERNAL; 50 return TYPE_EXTERNAL;
40 } 51 }
41 52
42 std::string ForwardingAgentHost::GetTitle() { 53 std::string ForwardingAgentHost::GetTitle() {
43 return ""; 54 return "";
44 } 55 }
45 56
46 GURL ForwardingAgentHost::GetURL() { 57 GURL ForwardingAgentHost::GetURL() {
47 return GURL(); 58 return GURL();
48 } 59 }
49 60
50 bool ForwardingAgentHost::Activate() { 61 bool ForwardingAgentHost::Activate() {
51 return false; 62 return false;
52 } 63 }
53 64
54 bool ForwardingAgentHost::Close() { 65 bool ForwardingAgentHost::Close() {
55 return false; 66 return false;
56 } 67 }
57 68
58 } // content 69 } // content
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698