| 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_BROWSER_LOCAL_DISCOVERY_PRIVET_NOTIFICATIONS_H_ | 5 #ifndef CHROME_BROWSER_LOCAL_DISCOVERY_PRIVET_NOTIFICATIONS_H_ |
| 6 #define CHROME_BROWSER_LOCAL_DISCOVERY_PRIVET_NOTIFICATIONS_H_ | 6 #define CHROME_BROWSER_LOCAL_DISCOVERY_PRIVET_NOTIFICATIONS_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 scoped_ptr<PrivetHTTPAsynchronousFactory> privet_http_factory_; | 86 scoped_ptr<PrivetHTTPAsynchronousFactory> privet_http_factory_; |
| 87 DeviceContextMap devices_seen_; | 87 DeviceContextMap devices_seen_; |
| 88 }; | 88 }; |
| 89 | 89 |
| 90 class PrivetNotificationService | 90 class PrivetNotificationService |
| 91 : public BrowserContextKeyedService, | 91 : public BrowserContextKeyedService, |
| 92 public PrivetDeviceLister::Delegate, | 92 public PrivetDeviceLister::Delegate, |
| 93 public PrivetNotificationsListener::Delegate, | 93 public PrivetNotificationsListener::Delegate, |
| 94 public base::SupportsWeakPtr<PrivetNotificationService> { | 94 public base::SupportsWeakPtr<PrivetNotificationService> { |
| 95 public: | 95 public: |
| 96 PrivetNotificationService(content::BrowserContext* profile, | 96 explicit PrivetNotificationService(content::BrowserContext* profile); |
| 97 NotificationUIManager* notification_manager); | |
| 98 virtual ~PrivetNotificationService(); | 97 virtual ~PrivetNotificationService(); |
| 99 | 98 |
| 100 // PrivetDeviceLister::Delegate implementation: | 99 // PrivetDeviceLister::Delegate implementation: |
| 101 virtual void DeviceChanged(bool added, const std::string& name, | 100 virtual void DeviceChanged(bool added, const std::string& name, |
| 102 const DeviceDescription& description) OVERRIDE; | 101 const DeviceDescription& description) OVERRIDE; |
| 103 virtual void DeviceRemoved(const std::string& name) OVERRIDE; | 102 virtual void DeviceRemoved(const std::string& name) OVERRIDE; |
| 104 | 103 |
| 105 // PrivetNotificationListener::Delegate implementation: | 104 // PrivetNotificationListener::Delegate implementation: |
| 106 virtual void PrivetNotify(const std::string& device_name, | 105 virtual void PrivetNotify(const std::string& device_name, |
| 107 const std::string& human_readable_name, | 106 const std::string& human_readable_name, |
| 108 const std::string& description) OVERRIDE; | 107 const std::string& description) OVERRIDE; |
| 109 | 108 |
| 110 virtual void PrivetRemoveNotification( | 109 virtual void PrivetRemoveNotification( |
| 111 const std::string& device_name) OVERRIDE; | 110 const std::string& device_name) OVERRIDE; |
| 112 virtual void DeviceCacheFlushed() OVERRIDE; | 111 virtual void DeviceCacheFlushed() OVERRIDE; |
| 113 | 112 |
| 114 private: | 113 private: |
| 115 void Start(); | 114 void Start(); |
| 116 | 115 |
| 117 content::BrowserContext* profile_; | 116 content::BrowserContext* profile_; |
| 118 NotificationUIManager* notification_manager_; | |
| 119 scoped_ptr<PrivetDeviceLister> device_lister_; | 117 scoped_ptr<PrivetDeviceLister> device_lister_; |
| 120 scoped_refptr<ServiceDiscoveryHostClient> service_discovery_client_; | 118 scoped_refptr<ServiceDiscoveryHostClient> service_discovery_client_; |
| 121 scoped_ptr<PrivetNotificationsListener> privet_notifications_listener_; | 119 scoped_ptr<PrivetNotificationsListener> privet_notifications_listener_; |
| 122 }; | 120 }; |
| 123 | 121 |
| 124 class PrivetNotificationDelegate : public NotificationDelegate { | 122 class PrivetNotificationDelegate : public NotificationDelegate { |
| 125 public: | 123 public: |
| 126 explicit PrivetNotificationDelegate(const std::string& device_id, | 124 explicit PrivetNotificationDelegate(const std::string& device_id, |
| 127 content::BrowserContext* profile); | 125 content::BrowserContext* profile); |
| 128 | 126 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 140 | 138 |
| 141 virtual ~PrivetNotificationDelegate(); | 139 virtual ~PrivetNotificationDelegate(); |
| 142 | 140 |
| 143 std::string device_id_; | 141 std::string device_id_; |
| 144 content::BrowserContext* profile_; | 142 content::BrowserContext* profile_; |
| 145 }; | 143 }; |
| 146 | 144 |
| 147 } // namespace local_discovery | 145 } // namespace local_discovery |
| 148 | 146 |
| 149 #endif // CHROME_BROWSER_LOCAL_DISCOVERY_PRIVET_NOTIFICATIONS_H_ | 147 #endif // CHROME_BROWSER_LOCAL_DISCOVERY_PRIVET_NOTIFICATIONS_H_ |
| OLD | NEW |