| OLD | NEW |
| 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 #ifndef CHROME_UTILITY_LOCAL_DISCOVERY_SERVICE_DISCOVERY_MESSAGE_HANDLER_H_ | 5 #ifndef CHROME_UTILITY_LOCAL_DISCOVERY_SERVICE_DISCOVERY_MESSAGE_HANDLER_H_ |
| 6 #define CHROME_UTILITY_LOCAL_DISCOVERY_SERVICE_DISCOVERY_MESSAGE_HANDLER_H_ | 6 #define CHROME_UTILITY_LOCAL_DISCOVERY_SERVICE_DISCOVERY_MESSAGE_HANDLER_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 | 9 |
| 10 #include "base/memory/linked_ptr.h" | 10 #include "base/memory/linked_ptr.h" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 | 21 |
| 22 // Handles messages related to local discovery inside utility process. | 22 // Handles messages related to local discovery inside utility process. |
| 23 class ServiceDiscoveryMessageHandler : public chrome::UtilityMessageHandler { | 23 class ServiceDiscoveryMessageHandler : public chrome::UtilityMessageHandler { |
| 24 public: | 24 public: |
| 25 ServiceDiscoveryMessageHandler(); | 25 ServiceDiscoveryMessageHandler(); |
| 26 virtual ~ServiceDiscoveryMessageHandler(); | 26 virtual ~ServiceDiscoveryMessageHandler(); |
| 27 | 27 |
| 28 // UtilityMessageHandler implementation. | 28 // UtilityMessageHandler implementation. |
| 29 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; | 29 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; |
| 30 | 30 |
| 31 static void PreSandboxStartup(); |
| 32 |
| 31 private: | 33 private: |
| 32 typedef std::map<uint64, linked_ptr<ServiceWatcher> > ServiceWatchers; | 34 typedef std::map<uint64, linked_ptr<ServiceWatcher> > ServiceWatchers; |
| 33 typedef std::map<uint64, linked_ptr<ServiceResolver> > ServiceResolvers; | 35 typedef std::map<uint64, linked_ptr<ServiceResolver> > ServiceResolvers; |
| 34 | 36 |
| 35 // Lazy initializes ServiceDiscoveryClient. | 37 // Lazy initializes ServiceDiscoveryClient. |
| 36 void Initialize(); | 38 bool Initialize(); |
| 37 | 39 |
| 38 // IPC message handlers. | 40 // IPC message handlers. |
| 39 void OnStartWatcher(uint64 id, const std::string& service_type); | 41 void OnStartWatcher(uint64 id, const std::string& service_type); |
| 40 void OnDiscoverServices(uint64 id, bool force_update); | 42 void OnDiscoverServices(uint64 id, bool force_update); |
| 41 void OnDestroyWatcher(uint64 id); | 43 void OnDestroyWatcher(uint64 id); |
| 42 void OnResolveService(uint64 id, const std::string& service_name); | 44 void OnResolveService(uint64 id, const std::string& service_name); |
| 43 void OnDestroyResolver(uint64 id); | 45 void OnDestroyResolver(uint64 id); |
| 44 | 46 |
| 45 // Is called by ServiceWatcher as callback. | 47 // Is called by ServiceWatcher as callback. |
| 46 void OnServiceUpdated(uint64 id, | 48 void OnServiceUpdated(uint64 id, |
| 47 ServiceWatcher::UpdateType update, | 49 ServiceWatcher::UpdateType update, |
| 48 const std::string& name); | 50 const std::string& name); |
| 49 | 51 |
| 50 // Is called by ServiceResolver as callback. | 52 // Is called by ServiceResolver as callback. |
| 51 void OnServiceResolved(uint64 id, | 53 void OnServiceResolved(uint64 id, |
| 52 ServiceResolver::RequestStatus status, | 54 ServiceResolver::RequestStatus status, |
| 53 const ServiceDescription& description); | 55 const ServiceDescription& description); |
| 54 | 56 |
| 55 ServiceWatchers service_watchers_; | 57 ServiceWatchers service_watchers_; |
| 56 ServiceResolvers service_resolvers_; | 58 ServiceResolvers service_resolvers_; |
| 57 | 59 |
| 58 scoped_ptr<net::MDnsClient> mdns_client_; | 60 scoped_ptr<net::MDnsClient> mdns_client_; |
| 59 scoped_ptr<ServiceDiscoveryClient> service_discovery_client_; | 61 scoped_ptr<ServiceDiscoveryClient> service_discovery_client_; |
| 60 }; | 62 }; |
| 61 | 63 |
| 62 } // namespace local_discovery | 64 } // namespace local_discovery |
| 63 | 65 |
| 64 #endif // CHROME_UTILITY_LOCAL_DISCOVERY_SERVICE_DISCOVERY_MESSAGE_HANDLER_H_ | 66 #endif // CHROME_UTILITY_LOCAL_DISCOVERY_SERVICE_DISCOVERY_MESSAGE_HANDLER_H_ |
| 67 |
| OLD | NEW |