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

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: Addressed comments 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 for (base::DictionaryValue::Iterator iter(*filter);
93 !iter.IsAtEnd(); iter.Advance()) {
94 }
95 92
96 std::string filter_value; 93 std::string filter_value;
97 filter->GetStringASCII(kEventFilterServiceTypeKey, &filter_value); 94 filter->GetStringASCII(kEventFilterServiceTypeKey, &filter_value);
98 if (filter_value.empty()) 95 if (filter_value.empty())
99 continue; 96 continue;
100 new_service_types.insert(filter_value); 97 new_service_types.insert(filter_value);
101 } 98 }
102 99
103 // Find all the added and removed service types since last update. 100 // Find all the added and removed service types since last update.
104 std::set<std::string> added_service_types = 101 std::set<std::string> added_service_types =
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 mdns_service->service_data = (*it).service_data; 136 mdns_service->service_data = (*it).service_data;
140 args.push_back(mdns_service); 137 args.push_back(mdns_service);
141 } 138 }
142 139
143 scoped_ptr<base::ListValue> results = mdns::OnServiceList::Create(args); 140 scoped_ptr<base::ListValue> results = mdns::OnServiceList::Create(args);
144 scoped_ptr<Event> event( 141 scoped_ptr<Event> event(
145 new Event(mdns::OnServiceList::kEventName, results.Pass())); 142 new Event(mdns::OnServiceList::kEventName, results.Pass()));
146 event->restrict_to_browser_context = profile_; 143 event->restrict_to_browser_context = profile_;
147 event->filter_info.SetServiceType(service_type); 144 event->filter_info.SetServiceType(service_type);
148 145
146 VLOG(1) << "Broadcasting OnServiceList event: " << event.get();
147
149 // TODO(justinlin): To avoid having listeners without filters getting all 148 // TODO(justinlin): To avoid having listeners without filters getting all
150 // events, modify API to have this event require filters. 149 // events, modify API to have this event require filters.
151 extensions::ExtensionSystem::Get(profile_)->event_router()-> 150 extensions::ExtensionSystem::Get(profile_)->event_router()->
152 BroadcastEvent(event.Pass()); 151 BroadcastEvent(event.Pass());
153 } 152 }
154 153
155 } // namespace extensions 154 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698