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_PRINTING_CLOUD_PRINT_PRIVET_NOTIFICATIONS_H_ | 5 #ifndef CHROME_BROWSER_PRINTING_CLOUD_PRINT_PRIVET_NOTIFICATIONS_H_ |
6 #define CHROME_BROWSER_PRINTING_CLOUD_PRINT_PRIVET_NOTIFICATIONS_H_ | 6 #define CHROME_BROWSER_PRINTING_CLOUD_PRINT_PRIVET_NOTIFICATIONS_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <memory> | 9 #include <memory> |
10 #include <string> | 10 #include <string> |
11 | 11 |
12 #include "chrome/browser/notifications/notification_delegate.h" | 12 #include "chrome/browser/notifications/notification_delegate.h" |
13 #include "chrome/browser/printing/cloud_print/privet_device_lister.h" | 13 #include "chrome/browser/printing/cloud_print/privet_device_lister.h" |
14 #include "chrome/browser/printing/cloud_print/privet_http.h" | 14 #include "chrome/browser/printing/cloud_print/privet_http.h" |
15 #include "components/keyed_service/core/keyed_service.h" | 15 #include "components/keyed_service/core/keyed_service.h" |
16 #include "components/prefs/pref_member.h" | 16 #include "components/prefs/pref_member.h" |
| 17 #include "net/net_features.h" |
17 | 18 |
18 class NotificationUIManager; | 19 class NotificationUIManager; |
19 class Profile; | 20 class Profile; |
20 | 21 |
21 namespace content { | 22 namespace content { |
22 class BrowserContext; | 23 class BrowserContext; |
23 } | 24 } |
24 | 25 |
25 namespace local_discovery { | 26 namespace local_discovery { |
26 class ServiceDiscoverySharedClient; | 27 class ServiceDiscoverySharedClient; |
27 } | 28 } |
28 | 29 |
29 namespace cloud_print { | 30 namespace cloud_print { |
30 | 31 |
31 class PrivetDeviceLister; | 32 class PrivetDeviceLister; |
32 class PrivetHTTPAsynchronousFactory; | 33 class PrivetHTTPAsynchronousFactory; |
33 class PrivetHTTPResolution; | 34 class PrivetHTTPResolution; |
34 class PrivetNotificationDelegate; | 35 class PrivetNotificationDelegate; |
35 struct DeviceDescription; | 36 struct DeviceDescription; |
36 | 37 |
37 #if defined(ENABLE_MDNS) | 38 #if BUILDFLAG(ENABLE_MDNS) |
38 class PrivetTrafficDetector; | 39 class PrivetTrafficDetector; |
39 #endif // ENABLE_MDNS | 40 #endif // ENABLE_MDNS |
40 | 41 |
41 // Contains logic related to notifications not tied actually displaying them. | 42 // Contains logic related to notifications not tied actually displaying them. |
42 class PrivetNotificationsListener { | 43 class PrivetNotificationsListener { |
43 public: | 44 public: |
44 class Delegate { | 45 class Delegate { |
45 public: | 46 public: |
46 virtual ~Delegate() {} | 47 virtual ~Delegate() {} |
47 | 48 |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 virtual PrivetNotificationDelegate* CreateNotificationDelegate( | 126 virtual PrivetNotificationDelegate* CreateNotificationDelegate( |
126 Profile* profile); | 127 Profile* profile); |
127 | 128 |
128 content::BrowserContext* const profile_; | 129 content::BrowserContext* const profile_; |
129 std::unique_ptr<PrivetDeviceLister> device_lister_; | 130 std::unique_ptr<PrivetDeviceLister> device_lister_; |
130 scoped_refptr<local_discovery::ServiceDiscoverySharedClient> | 131 scoped_refptr<local_discovery::ServiceDiscoverySharedClient> |
131 service_discovery_client_; | 132 service_discovery_client_; |
132 std::unique_ptr<PrivetNotificationsListener> privet_notifications_listener_; | 133 std::unique_ptr<PrivetNotificationsListener> privet_notifications_listener_; |
133 BooleanPrefMember enable_privet_notification_member_; | 134 BooleanPrefMember enable_privet_notification_member_; |
134 | 135 |
135 #if defined(ENABLE_MDNS) | 136 #if BUILDFLAG(ENABLE_MDNS) |
136 scoped_refptr<PrivetTrafficDetector> traffic_detector_; | 137 scoped_refptr<PrivetTrafficDetector> traffic_detector_; |
137 #endif // ENABLE_MDNS | 138 #endif // ENABLE_MDNS |
138 }; | 139 }; |
139 | 140 |
140 class PrivetNotificationDelegate : public NotificationDelegate { | 141 class PrivetNotificationDelegate : public NotificationDelegate { |
141 public: | 142 public: |
142 explicit PrivetNotificationDelegate(Profile* profile); | 143 explicit PrivetNotificationDelegate(Profile* profile); |
143 | 144 |
144 // NotificationDelegate implementation. | 145 // NotificationDelegate implementation. |
145 std::string id() const override; | 146 std::string id() const override; |
146 void ButtonClick(int button_index) override; | 147 void ButtonClick(int button_index) override; |
147 | 148 |
148 protected: | 149 protected: |
149 // Refcounted. | 150 // Refcounted. |
150 ~PrivetNotificationDelegate() override; | 151 ~PrivetNotificationDelegate() override; |
151 | 152 |
152 private: | 153 private: |
153 // ButtonClick() response handlers. Virtual for testing. | 154 // ButtonClick() response handlers. Virtual for testing. |
154 virtual void OpenTab(const GURL& url); | 155 virtual void OpenTab(const GURL& url); |
155 virtual void DisableNotifications(); | 156 virtual void DisableNotifications(); |
156 | 157 |
157 void CloseNotification(); | 158 void CloseNotification(); |
158 | 159 |
159 Profile* const profile_; | 160 Profile* const profile_; |
160 }; | 161 }; |
161 | 162 |
162 } // namespace cloud_print | 163 } // namespace cloud_print |
163 | 164 |
164 #endif // CHROME_BROWSER_PRINTING_CLOUD_PRINT_PRIVET_NOTIFICATIONS_H_ | 165 #endif // CHROME_BROWSER_PRINTING_CLOUD_PRINT_PRIVET_NOTIFICATIONS_H_ |
OLD | NEW |