Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(21)

Side by Side Diff: chrome/browser/permissions/permission_request_impl.h

Issue 2675483002: Replace PermissionType in chrome/ with ContentSettingsType (Closed)
Patch Set: rebase Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 CHROME_BROWSER_PERMISSIONS_PERMISSION_REQUEST_IMPL_H_ 5 #ifndef CHROME_BROWSER_PERMISSIONS_PERMISSION_REQUEST_IMPL_H_
6 #define CHROME_BROWSER_PERMISSIONS_PERMISSION_REQUEST_IMPL_H_ 6 #define CHROME_BROWSER_PERMISSIONS_PERMISSION_REQUEST_IMPL_H_
7 7
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "chrome/browser/permissions/permission_request.h" 10 #include "chrome/browser/permissions/permission_request.h"
11 #include "chrome/browser/permissions/permission_request_id.h" 11 #include "chrome/browser/permissions/permission_request_id.h"
12 #include "components/content_settings/core/common/content_settings.h" 12 #include "components/content_settings/core/common/content_settings.h"
13 #include "content/public/browser/permission_type.h"
14 13
15 class GURL; 14 class GURL;
16 class Profile; 15 class Profile;
17 16
18 // Default implementation of PermissionRequest, it is assumed that the 17 // Default implementation of PermissionRequest, it is assumed that the
19 // caller owns it and that it can be deleted once the |delete_callback| 18 // caller owns it and that it can be deleted once the |delete_callback|
20 // is executed. 19 // is executed.
21 class PermissionRequestImpl : public PermissionRequest { 20 class PermissionRequestImpl : public PermissionRequest {
22 public: 21 public:
23 using PermissionDecidedCallback = base::Callback<void(bool, ContentSetting)>; 22 using PermissionDecidedCallback = base::Callback<void(bool, ContentSetting)>;
24 23
25 PermissionRequestImpl( 24 PermissionRequestImpl(
26 const GURL& request_origin, 25 const GURL& request_origin,
27 content::PermissionType permission_type, 26 ContentSettingsType content_settings_type,
28 Profile* profile, 27 Profile* profile,
29 bool has_gesture, 28 bool has_gesture,
30 const PermissionDecidedCallback& permission_decided_callback, 29 const PermissionDecidedCallback& permission_decided_callback,
31 const base::Closure delete_callback); 30 const base::Closure delete_callback);
32 31
33 ~PermissionRequestImpl() override; 32 ~PermissionRequestImpl() override;
34 33
35 protected: 34 protected:
36 void RegisterActionTaken() { action_taken_ = true; } 35 void RegisterActionTaken() { action_taken_ = true; }
37 36
38 private: 37 private:
39 // PermissionRequest: 38 // PermissionRequest:
40 IconId GetIconId() const override; 39 IconId GetIconId() const override;
41 base::string16 GetMessageTextFragment() const override; 40 base::string16 GetMessageTextFragment() const override;
42 GURL GetOrigin() const override; 41 GURL GetOrigin() const override;
43 // Remember to call RegisterActionTaken for these methods if you are 42 // Remember to call RegisterActionTaken for these methods if you are
44 // overriding them. 43 // overriding them.
45 void PermissionGranted() override; 44 void PermissionGranted() override;
46 void PermissionDenied() override; 45 void PermissionDenied() override;
47 void Cancelled() override; 46 void Cancelled() override;
48 void RequestFinished() override; 47 void RequestFinished() override;
49 bool ShouldShowPersistenceToggle() const override; 48 bool ShouldShowPersistenceToggle() const override;
50 PermissionRequestType GetPermissionRequestType() const override; 49 PermissionRequestType GetPermissionRequestType() const override;
51 PermissionRequestGestureType GetGestureType() const override; 50 PermissionRequestGestureType GetGestureType() const override;
52 ContentSettingsType GetContentSettingsType() const override;
53 51
54 GURL request_origin_; 52 GURL request_origin_;
55 content::PermissionType permission_type_; 53 ContentSettingsType content_settings_type_;
56 Profile* profile_; 54 Profile* profile_;
57 bool has_gesture_; 55 bool has_gesture_;
58 56
59 // Called once a decision is made about the permission. 57 // Called once a decision is made about the permission.
60 const PermissionDecidedCallback permission_decided_callback_; 58 const PermissionDecidedCallback permission_decided_callback_;
61 59
62 // Called when the request is no longer in use so it can be deleted by the 60 // Called when the request is no longer in use so it can be deleted by the
63 // caller. 61 // caller.
64 const base::Closure delete_callback_; 62 const base::Closure delete_callback_;
65 bool is_finished_; 63 bool is_finished_;
66 bool action_taken_; 64 bool action_taken_;
67 65
68 DISALLOW_COPY_AND_ASSIGN(PermissionRequestImpl); 66 DISALLOW_COPY_AND_ASSIGN(PermissionRequestImpl);
69 }; 67 };
70 68
71 #endif // CHROME_BROWSER_PERMISSIONS_PERMISSION_REQUEST_IMPL_H_ 69 #endif // CHROME_BROWSER_PERMISSIONS_PERMISSION_REQUEST_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698