Rename vector icon header files.
[chromium-blink-merge.git] / chrome / browser / push_messaging / push_messaging_permission_context.h
blobe436c37a0401f56dc3e7b495dd39071334b8f80e
1 // Copyright 2015 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_PUSH_MESSAGING_PUSH_MESSAGING_PERMISSION_CONTEXT_H_
6 #define CHROME_BROWSER_PUSH_MESSAGING_PUSH_MESSAGING_PERMISSION_CONTEXT_H_
8 #include "chrome/browser/permissions/permission_context_base.h"
10 #include "components/content_settings/core/common/content_settings_types.h"
12 class PermissionRequestID;
13 class Profile;
15 // Permission context for push messages.
16 class PushMessagingPermissionContext : public PermissionContextBase {
17 public:
18 explicit PushMessagingPermissionContext(Profile* profile);
19 ~PushMessagingPermissionContext() override;
21 // PermissionContextBase:
22 ContentSetting GetPermissionStatus(
23 const GURL& requesting_origin,
24 const GURL& embedding_origin) const override;
26 protected:
27 // PermissionContextBase:
28 void DecidePermission(content::WebContents* web_contents,
29 const PermissionRequestID& id,
30 const GURL& requesting_origin,
31 const GURL& embedding_origin,
32 bool user_gesture,
33 const BrowserPermissionCallback& callback) override;
34 bool IsRestrictedToSecureOrigins() const override;
36 private:
37 FRIEND_TEST_ALL_PREFIXES(PushMessagingPermissionContextTest,
38 DecidePushPermission);
40 // Used to decide the permission for push, once the permission for
41 // Notification has been granted/denied.
42 void DecidePushPermission(const PermissionRequestID& id,
43 const GURL& requesting_origin,
44 const GURL& embedding_origin,
45 const BrowserPermissionCallback& callback,
46 ContentSetting notifications_content_setting);
48 Profile* profile_;
50 // Must be the last member, to ensure that it will be
51 // destroyed first, which will invalidate weak pointers
52 base::WeakPtrFactory<PushMessagingPermissionContext> weak_factory_ui_thread_;
54 DISALLOW_COPY_AND_ASSIGN(PushMessagingPermissionContext);
57 #endif // CHROME_BROWSER_PUSH_MESSAGING_PUSH_MESSAGING_PERMISSION_CONTEXT_H_