OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 CONTENT_PUBLIC_BROWSER_PUSH_MESSAGING_SERVICE_H_ | 5 #ifndef CONTENT_PUBLIC_BROWSER_PUSH_MESSAGING_SERVICE_H_ |
6 #define CONTENT_PUBLIC_BROWSER_PUSH_MESSAGING_SERVICE_H_ | 6 #define CONTENT_PUBLIC_BROWSER_PUSH_MESSAGING_SERVICE_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
11 #include "content/common/content_export.h" | 11 #include "content/common/content_export.h" |
12 #include "content/public/common/push_messaging_status.h" | 12 #include "content/public/common/push_messaging_status.h" |
13 #include "third_party/WebKit/public/platform/WebPushPermissionStatus.h" | 13 #include "third_party/WebKit/public/platform/WebPushPermissionStatus.h" |
14 #include "url/gurl.h" | 14 #include "url/gurl.h" |
15 | 15 |
16 namespace content { | 16 namespace content { |
17 | 17 |
| 18 class WebContents; |
| 19 |
18 // A push service-agnostic interface that the Push API uses for talking to | 20 // A push service-agnostic interface that the Push API uses for talking to |
19 // push messaging services like GCM. Must only be used on the UI thread. | 21 // push messaging services like GCM. Must only be used on the UI thread. |
20 class CONTENT_EXPORT PushMessagingService { | 22 class CONTENT_EXPORT PushMessagingService { |
21 public: | 23 public: |
22 using RegisterCallback = | 24 using RegisterCallback = |
23 base::Callback<void(const std::string& /* registration_id */, | 25 base::Callback<void(const std::string& /* registration_id */, |
24 PushRegistrationStatus /* status */)>; | 26 PushRegistrationStatus /* status */)>; |
25 using UnregisterCallback = base::Callback<void(PushUnregistrationStatus)>; | 27 using UnregisterCallback = base::Callback<void(PushUnregistrationStatus)>; |
26 | 28 |
27 virtual ~PushMessagingService() {} | 29 virtual ~PushMessagingService() {} |
(...skipping 27 matching lines...) Expand all Loading... |
55 virtual void Unregister(const GURL& requesting_origin, | 57 virtual void Unregister(const GURL& requesting_origin, |
56 int64 service_worker_registration_id, | 58 int64 service_worker_registration_id, |
57 const UnregisterCallback& callback) = 0; | 59 const UnregisterCallback& callback) = 0; |
58 | 60 |
59 // Checks the permission status for the requesting origin. Permission is only | 61 // Checks the permission status for the requesting origin. Permission is only |
60 // ever granted when the requesting origin matches the top level embedding | 62 // ever granted when the requesting origin matches the top level embedding |
61 // origin. | 63 // origin. |
62 virtual blink::WebPushPermissionStatus GetPermissionStatus( | 64 virtual blink::WebPushPermissionStatus GetPermissionStatus( |
63 const GURL& requesting_origin, | 65 const GURL& requesting_origin, |
64 const GURL& embedding_origin) = 0; | 66 const GURL& embedding_origin) = 0; |
| 67 |
| 68 protected: |
| 69 bool IsWebContentsUserVisible(const WebContents* web_contents); |
65 }; | 70 }; |
66 | 71 |
67 } // namespace content | 72 } // namespace content |
68 | 73 |
69 #endif // CONTENT_PUBLIC_BROWSER_PUSH_MESSAGING_SERVICE_H_ | 74 #endif // CONTENT_PUBLIC_BROWSER_PUSH_MESSAGING_SERVICE_H_ |
OLD | NEW |