ozone: evdev: Sync caps lock LED state to evdev
[chromium-blink-merge.git] / chrome / browser / services / gcm / push_messaging_permission_context.h
blob5f9a5a0ddeaf327e5c92ecb28bd9751530b78555
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
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_SERVICES_GCM_PUSH_MESSAGING_PERMISSION_CONTEXT_H_
6 #define CHROME_BROWSER_SERVICES_GCM_PUSH_MESSAGING_PERMISSION_CONTEXT_H_
8 #include "chrome/browser/content_settings/permission_context_base.h"
10 #include "components/content_settings/core/common/content_settings_types.h"
12 class PermissionRequestID;
13 class Profile;
15 namespace gcm {
17 // Permission context for push messages.
18 class PushMessagingPermissionContext : public PermissionContextBase {
19 public:
20 explicit PushMessagingPermissionContext(Profile* profile);
21 ~PushMessagingPermissionContext() override;
23 // PermissionContextBase:
24 ContentSetting GetPermissionStatus(
25 const GURL& requesting_origin,
26 const GURL& embedding_origin) const override;
28 void CancelPermissionRequest(content::WebContents* web_contents,
29 const PermissionRequestID& id) override;
31 protected:
32 // PermissionContextBase:
33 void DecidePermission(content::WebContents* web_contents,
34 const PermissionRequestID& id,
35 const GURL& requesting_origin,
36 const GURL& embedding_origin,
37 bool user_gesture,
38 const BrowserPermissionCallback& callback) override;
40 private:
41 FRIEND_TEST_ALL_PREFIXES(PushMessagingPermissionContextTest,
42 DecidePushPermission);
44 // Used to decide the permission for push, once the permission for
45 // Notification has been granted/denied.
46 void DecidePushPermission(const PermissionRequestID& id,
47 const GURL& requesting_origin,
48 const GURL& embedding_origin,
49 const BrowserPermissionCallback& callback,
50 ContentSetting notifications_content_setting);
52 Profile* profile_;
54 // Must be the last member, to ensure that it will be
55 // destroyed first, which will invalidate weak pointers
56 base::WeakPtrFactory<PushMessagingPermissionContext> weak_factory_ui_thread_;
58 DISALLOW_COPY_AND_ASSIGN(PushMessagingPermissionContext);
61 } // namespace gcm
62 #endif // CHROME_BROWSER_SERVICES_GCM_PUSH_MESSAGING_PERMISSION_CONTEXT_H_