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 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 : public KeyedService, | 92 : public KeyedService, |
93 public PrivetDeviceLister::Delegate, | 93 public PrivetDeviceLister::Delegate, |
94 public PrivetNotificationsListener::Delegate, | 94 public PrivetNotificationsListener::Delegate, |
95 public base::SupportsWeakPtr<PrivetNotificationService> { | 95 public base::SupportsWeakPtr<PrivetNotificationService> { |
96 public: | 96 public: |
97 explicit PrivetNotificationService(content::BrowserContext* profile); | 97 explicit PrivetNotificationService(content::BrowserContext* profile); |
98 virtual ~PrivetNotificationService(); | 98 virtual ~PrivetNotificationService(); |
99 | 99 |
100 // PrivetDeviceLister::Delegate implementation: | 100 // PrivetDeviceLister::Delegate implementation: |
101 virtual void DeviceChanged(bool added, const std::string& name, | 101 virtual void DeviceChanged(bool added, const std::string& name, |
102 const DeviceDescription& description) OVERRIDE; | 102 const DeviceDescription& description) override; |
103 virtual void DeviceRemoved(const std::string& name) OVERRIDE; | 103 virtual void DeviceRemoved(const std::string& name) override; |
104 | 104 |
105 // PrivetNotificationListener::Delegate implementation: | 105 // PrivetNotificationListener::Delegate implementation: |
106 virtual void PrivetNotify(bool has_multiple, bool added) OVERRIDE; | 106 virtual void PrivetNotify(bool has_multiple, bool added) override; |
107 | 107 |
108 virtual void PrivetRemoveNotification() OVERRIDE; | 108 virtual void PrivetRemoveNotification() override; |
109 virtual void DeviceCacheFlushed() OVERRIDE; | 109 virtual void DeviceCacheFlushed() override; |
110 | 110 |
111 static bool IsEnabled(); | 111 static bool IsEnabled(); |
112 static bool IsForced(); | 112 static bool IsForced(); |
113 | 113 |
114 private: | 114 private: |
115 void Start(); | 115 void Start(); |
116 void OnNotificationsEnabledChanged(); | 116 void OnNotificationsEnabledChanged(); |
117 void StartLister(); | 117 void StartLister(); |
118 | 118 |
119 content::BrowserContext* profile_; | 119 content::BrowserContext* profile_; |
120 scoped_ptr<PrivetDeviceLister> device_lister_; | 120 scoped_ptr<PrivetDeviceLister> device_lister_; |
121 scoped_refptr<ServiceDiscoverySharedClient> service_discovery_client_; | 121 scoped_refptr<ServiceDiscoverySharedClient> service_discovery_client_; |
122 scoped_ptr<PrivetNotificationsListener> privet_notifications_listener_; | 122 scoped_ptr<PrivetNotificationsListener> privet_notifications_listener_; |
123 BooleanPrefMember enable_privet_notification_member_; | 123 BooleanPrefMember enable_privet_notification_member_; |
124 | 124 |
125 #if defined(ENABLE_MDNS) | 125 #if defined(ENABLE_MDNS) |
126 scoped_refptr<PrivetTrafficDetector> traffic_detector_; | 126 scoped_refptr<PrivetTrafficDetector> traffic_detector_; |
127 #endif // ENABLE_MDNS | 127 #endif // ENABLE_MDNS |
128 }; | 128 }; |
129 | 129 |
130 class PrivetNotificationDelegate : public NotificationDelegate { | 130 class PrivetNotificationDelegate : public NotificationDelegate { |
131 public: | 131 public: |
132 explicit PrivetNotificationDelegate(content::BrowserContext* profile); | 132 explicit PrivetNotificationDelegate(content::BrowserContext* profile); |
133 | 133 |
134 // NotificationDelegate implementation. | 134 // NotificationDelegate implementation. |
135 virtual std::string id() const OVERRIDE; | 135 virtual std::string id() const override; |
136 virtual content::WebContents* GetWebContents() const OVERRIDE; | 136 virtual content::WebContents* GetWebContents() const override; |
137 virtual void Display() OVERRIDE; | 137 virtual void Display() override; |
138 virtual void Error() OVERRIDE; | 138 virtual void Error() override; |
139 virtual void Close(bool by_user) OVERRIDE; | 139 virtual void Close(bool by_user) override; |
140 virtual void Click() OVERRIDE; | 140 virtual void Click() override; |
141 virtual void ButtonClick(int button_index) OVERRIDE; | 141 virtual void ButtonClick(int button_index) override; |
142 | 142 |
143 private: | 143 private: |
144 void OpenTab(const GURL& url); | 144 void OpenTab(const GURL& url); |
145 void DisableNotifications(); | 145 void DisableNotifications(); |
146 | 146 |
147 virtual ~PrivetNotificationDelegate(); | 147 virtual ~PrivetNotificationDelegate(); |
148 | 148 |
149 content::BrowserContext* profile_; | 149 content::BrowserContext* profile_; |
150 }; | 150 }; |
151 | 151 |
152 } // namespace local_discovery | 152 } // namespace local_discovery |
153 | 153 |
154 #endif // CHROME_BROWSER_LOCAL_DISCOVERY_PRIVET_NOTIFICATIONS_H_ | 154 #endif // CHROME_BROWSER_LOCAL_DISCOVERY_PRIVET_NOTIFICATIONS_H_ |
OLD | NEW |