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

Side by Side Diff: chrome/browser/automation/extension_port_container.cc

Issue 150125: Send port disconnect events when a frame is unloaded. (Closed)
Patch Set: from linux Created 11 years, 5 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 | chrome/browser/extensions/extension_message_service.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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 "chrome/browser/automation/extension_port_container.h" 5 #include "chrome/browser/automation/extension_port_container.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/json_reader.h" 8 #include "base/json_reader.h"
9 #include "base/json_writer.h" 9 #include "base/json_writer.h"
10 #include "base/values.h" 10 #include "base/values.h"
(...skipping 16 matching lines...) Expand all
27 tab_handle_(tab_handle) { 27 tab_handle_(tab_handle) {
28 URLRequestContext* context = automation_->profile()->GetRequestContext(); 28 URLRequestContext* context = automation_->profile()->GetRequestContext();
29 service_ = ExtensionMessageService::GetInstance(context); 29 service_ = ExtensionMessageService::GetInstance(context);
30 DCHECK(service_); 30 DCHECK(service_);
31 } 31 }
32 32
33 ExtensionPortContainer::~ExtensionPortContainer() { 33 ExtensionPortContainer::~ExtensionPortContainer() {
34 DCHECK_EQ(MessageLoop::current()->type(), MessageLoop::TYPE_UI); 34 DCHECK_EQ(MessageLoop::current()->type(), MessageLoop::TYPE_UI);
35 35
36 if (port_id_ != -1) 36 if (port_id_ != -1)
37 service_->CloseAutomationChannel(port_id_); 37 service_->CloseChannel(port_id_);
38 } 38 }
39 39
40 bool ExtensionPortContainer::PostResponseToExternalPort( 40 bool ExtensionPortContainer::PostResponseToExternalPort(
41 const std::string& message) { 41 const std::string& message) {
42 return automation_->Send( 42 return automation_->Send(
43 new AutomationMsg_ForwardMessageToExternalHost( 43 new AutomationMsg_ForwardMessageToExternalHost(
44 0, tab_handle_, message, ext::kAutomationOrigin, 44 0, tab_handle_, message, ext::kAutomationOrigin,
45 ext::kAutomationPortResponseTarget)); 45 ext::kAutomationPortResponseTarget));
46 } 46 }
47 47
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 DCHECK(port); 201 DCHECK(port);
202 if (port) 202 if (port)
203 port->PostMessageFromExternalPort(data); 203 port->PostMessageFromExternalPort(data);
204 } else { 204 } else {
205 // We don't expect other messages here. 205 // We don't expect other messages here.
206 NOTREACHED(); 206 NOTREACHED();
207 } 207 }
208 208
209 return true; 209 return true;
210 } 210 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/extensions/extension_message_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698