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

Side by Side Diff: chrome/browser/extensions/api/mdns/mdns_api.cc

Issue 139923002: Added VLOG(1) loggings to mdns extensions API code (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 11 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 "chrome/browser/extensions/api/mdns/mdns_api.h" 5 #include "chrome/browser/extensions/api/mdns/mdns_api.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/lazy_instance.h" 9 #include "base/lazy_instance.h"
10 #include "chrome/browser/extensions/extension_service.h" 10 #include "chrome/browser/extensions/extension_service.h"
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 void MDnsAPI::UpdateMDnsListeners(const EventListenerInfo& details) { 82 void MDnsAPI::UpdateMDnsListeners(const EventListenerInfo& details) {
83 std::set<std::string> new_service_types; 83 std::set<std::string> new_service_types;
84 84
85 // Check all listeners for service type filers. 85 // Check all listeners for service type filers.
86 const EventListenerMap::ListenerList& listeners = 86 const EventListenerMap::ListenerList& listeners =
87 extensions::ExtensionSystem::Get(profile_)->event_router()-> 87 extensions::ExtensionSystem::Get(profile_)->event_router()->
88 listeners().GetEventListenersByName(details.event_name); 88 listeners().GetEventListenersByName(details.event_name);
89 for (EventListenerMap::ListenerList::const_iterator it = listeners.begin(); 89 for (EventListenerMap::ListenerList::const_iterator it = listeners.begin();
90 it != listeners.end(); ++it) { 90 it != listeners.end(); ++it) {
91 base::DictionaryValue* filter = ((*it)->filter.get()); 91 base::DictionaryValue* filter = ((*it)->filter.get());
92 // TODO(imcheng): Figure out what this is loop for, maybe remove it.
92 for (base::DictionaryValue::Iterator iter(*filter); 93 for (base::DictionaryValue::Iterator iter(*filter);
imcheng 2014/01/15 21:22:38 What this is for and can it be removed?
93 !iter.IsAtEnd(); iter.Advance()) { 94 !iter.IsAtEnd(); iter.Advance()) {
94 } 95 }
95 96
96 std::string filter_value; 97 std::string filter_value;
97 filter->GetStringASCII(kEventFilterServiceTypeKey, &filter_value); 98 filter->GetStringASCII(kEventFilterServiceTypeKey, &filter_value);
98 if (filter_value.empty()) 99 if (filter_value.empty())
99 continue; 100 continue;
100 new_service_types.insert(filter_value); 101 new_service_types.insert(filter_value);
101 } 102 }
102 103
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 mdns_service->service_data = (*it).service_data; 140 mdns_service->service_data = (*it).service_data;
140 args.push_back(mdns_service); 141 args.push_back(mdns_service);
141 } 142 }
142 143
143 scoped_ptr<base::ListValue> results = mdns::OnServiceList::Create(args); 144 scoped_ptr<base::ListValue> results = mdns::OnServiceList::Create(args);
144 scoped_ptr<Event> event( 145 scoped_ptr<Event> event(
145 new Event(mdns::OnServiceList::kEventName, results.Pass())); 146 new Event(mdns::OnServiceList::kEventName, results.Pass()));
146 event->restrict_to_browser_context = profile_; 147 event->restrict_to_browser_context = profile_;
147 event->filter_info.SetServiceType(service_type); 148 event->filter_info.SetServiceType(service_type);
148 149
150 VLOG(1) << "Broadcasting OnServiceList event: " << event.get();
151
149 // TODO(justinlin): To avoid having listeners without filters getting all 152 // TODO(justinlin): To avoid having listeners without filters getting all
150 // events, modify API to have this event require filters. 153 // events, modify API to have this event require filters.
151 extensions::ExtensionSystem::Get(profile_)->event_router()-> 154 extensions::ExtensionSystem::Get(profile_)->event_router()->
152 BroadcastEvent(event.Pass()); 155 BroadcastEvent(event.Pass());
153 } 156 }
154 157
155 } // namespace extensions 158 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698