| 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 22 matching lines...) Expand all Loading... |
| 33 #endif // ENABLE_MDNS | 33 #endif // ENABLE_MDNS |
| 34 | 34 |
| 35 // Contains logic related to notifications not tied actually displaying them. | 35 // Contains logic related to notifications not tied actually displaying them. |
| 36 class PrivetNotificationsListener { | 36 class PrivetNotificationsListener { |
| 37 public: | 37 public: |
| 38 class Delegate { | 38 class Delegate { |
| 39 public: | 39 public: |
| 40 virtual ~Delegate() {} | 40 virtual ~Delegate() {} |
| 41 | 41 |
| 42 // Notify user of the existence of device |device_name|. | 42 // Notify user of the existence of device |device_name|. |
| 43 virtual void PrivetNotify(bool multiple, bool added) = 0; | 43 virtual void PrivetNotify(int devices_active, bool added) = 0; |
| 44 | 44 |
| 45 // Remove the noitification for |device_name| if it still exists. | 45 // Remove the noitification for |device_name| if it still exists. |
| 46 virtual void PrivetRemoveNotification() = 0; | 46 virtual void PrivetRemoveNotification() = 0; |
| 47 }; | 47 }; |
| 48 | 48 |
| 49 PrivetNotificationsListener( | 49 PrivetNotificationsListener( |
| 50 scoped_ptr<PrivetHTTPAsynchronousFactory> privet_http_factory, | 50 scoped_ptr<PrivetHTTPAsynchronousFactory> privet_http_factory, |
| 51 Delegate* delegate); | 51 Delegate* delegate); |
| 52 virtual ~PrivetNotificationsListener(); | 52 virtual ~PrivetNotificationsListener(); |
| 53 | 53 |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 explicit PrivetNotificationService(content::BrowserContext* profile); | 97 explicit PrivetNotificationService(content::BrowserContext* profile); |
| 98 ~PrivetNotificationService() override; | 98 ~PrivetNotificationService() override; |
| 99 | 99 |
| 100 // PrivetDeviceLister::Delegate implementation: | 100 // PrivetDeviceLister::Delegate implementation: |
| 101 void DeviceChanged(bool added, | 101 void DeviceChanged(bool added, |
| 102 const std::string& name, | 102 const std::string& name, |
| 103 const DeviceDescription& description) override; | 103 const DeviceDescription& description) override; |
| 104 void DeviceRemoved(const std::string& name) override; | 104 void DeviceRemoved(const std::string& name) override; |
| 105 | 105 |
| 106 // PrivetNotificationListener::Delegate implementation: | 106 // PrivetNotificationListener::Delegate implementation: |
| 107 void PrivetNotify(bool has_multiple, bool added) override; | 107 void PrivetNotify(int devices_active, bool added) override; |
| 108 | 108 |
| 109 void PrivetRemoveNotification() override; | 109 void PrivetRemoveNotification() override; |
| 110 void DeviceCacheFlushed() override; | 110 void DeviceCacheFlushed() override; |
| 111 | 111 |
| 112 static bool IsEnabled(); | 112 static bool IsEnabled(); |
| 113 static bool IsForced(); | 113 static bool IsForced(); |
| 114 | 114 |
| 115 private: | 115 private: |
| 116 void Start(); | 116 void Start(); |
| 117 void OnNotificationsEnabledChanged(); | 117 void OnNotificationsEnabledChanged(); |
| (...skipping 23 matching lines...) Expand all Loading... |
| 141 void DisableNotifications(); | 141 void DisableNotifications(); |
| 142 | 142 |
| 143 ~PrivetNotificationDelegate() override; | 143 ~PrivetNotificationDelegate() override; |
| 144 | 144 |
| 145 content::BrowserContext* profile_; | 145 content::BrowserContext* profile_; |
| 146 }; | 146 }; |
| 147 | 147 |
| 148 } // namespace local_discovery | 148 } // namespace local_discovery |
| 149 | 149 |
| 150 #endif // CHROME_BROWSER_LOCAL_DISCOVERY_PRIVET_NOTIFICATIONS_H_ | 150 #endif // CHROME_BROWSER_LOCAL_DISCOVERY_PRIVET_NOTIFICATIONS_H_ |
| OLD | NEW |