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

Side by Side Diff: chrome/browser/extensions/extension_message_service.cc

Issue 2078021: First pass at experimental omnibox API. There are plenty of rough edges and (Closed)
Patch Set: no prefer_keyword Created 10 years, 7 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 (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/extensions/extension_message_service.h" 5 #include "chrome/browser/extensions/extension_message_service.h"
6 6
7 #include "base/json/json_writer.h" 7 #include "base/json/json_writer.h"
8 #include "base/singleton.h" 8 #include "base/singleton.h"
9 #include "base/stl_util-inl.h" 9 #include "base/stl_util-inl.h"
10 #include "base/values.h" 10 #include "base/values.h"
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 DCHECK_EQ(listeners_[event_name].count(render_process_id), 1u) 170 DCHECK_EQ(listeners_[event_name].count(render_process_id), 1u)
171 << " PID=" << render_process_id << " event=" << event_name; 171 << " PID=" << render_process_id << " event=" << event_name;
172 listeners_[event_name].erase(render_process_id); 172 listeners_[event_name].erase(render_process_id);
173 173
174 if (extension_devtools_manager_.get()) { 174 if (extension_devtools_manager_.get()) {
175 extension_devtools_manager_->RemoveEventListener(event_name, 175 extension_devtools_manager_->RemoveEventListener(event_name,
176 render_process_id); 176 render_process_id);
177 } 177 }
178 } 178 }
179 179
180 bool ExtensionMessageService::HasEventListener(
181 const std::string& event_name) {
182 return (listeners_.find(event_name) != listeners_.end() &&
183 !listeners_[event_name].empty());
184 }
185
180 void ExtensionMessageService::AllocatePortIdPair(int* port1, int* port2) { 186 void ExtensionMessageService::AllocatePortIdPair(int* port1, int* port2) {
181 AutoLock lock(next_port_id_lock_); 187 AutoLock lock(next_port_id_lock_);
182 188
183 // TODO(mpcomplete): what happens when this wraps? 189 // TODO(mpcomplete): what happens when this wraps?
184 int port1_id = next_port_id_++; 190 int port1_id = next_port_id_++;
185 int port2_id = next_port_id_++; 191 int port2_id = next_port_id_++;
186 192
187 DCHECK(IS_OPENER_PORT_ID(port1_id)); 193 DCHECK(IS_OPENER_PORT_ID(port1_id));
188 DCHECK(GET_OPPOSITE_PORT_ID(port1_id) == port2_id); 194 DCHECK(GET_OPPOSITE_PORT_ID(port1_id) == port2_id);
189 DCHECK(GET_OPPOSITE_PORT_ID(port2_id) == port1_id); 195 DCHECK(GET_OPPOSITE_PORT_ID(port2_id) == port1_id);
(...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after
544 550
545 if (current->second->opener.sender == sender) { 551 if (current->second->opener.sender == sender) {
546 CloseChannelImpl(current, GET_CHANNEL_OPENER_ID(current->first), 552 CloseChannelImpl(current, GET_CHANNEL_OPENER_ID(current->first),
547 notify_other_port); 553 notify_other_port);
548 } else if (current->second->receiver.sender == sender) { 554 } else if (current->second->receiver.sender == sender) {
549 CloseChannelImpl(current, GET_CHANNEL_RECEIVERS_ID(current->first), 555 CloseChannelImpl(current, GET_CHANNEL_RECEIVERS_ID(current->first),
550 notify_other_port); 556 notify_other_port);
551 } 557 }
552 } 558 }
553 } 559 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_message_service.h ('k') | chrome/browser/extensions/extension_omnibox_api.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698