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

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

Issue 2153133002: Add gesture type value from desktop prompt to permission report (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@add-user-gesture-to-reporting-part
Patch Set: rebase Created 4 years, 5 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" 13 #include "content/public/browser/permission_type.h"
14 14
15 class GURL; 15 class GURL;
16 class PermissionContextBase; 16 class PermissionContextBase;
17 class Profile; 17 class Profile;
18 18
19 // Default implementation of PermissionRequest, it is assumed that the 19 // Default implementation of PermissionRequest, it is assumed that the
20 // caller owns it and that it can be deleted once the |delete_callback| 20 // caller owns it and that it can be deleted once the |delete_callback|
21 // is executed. 21 // is executed.
22 class PermissionRequestImpl : public PermissionRequest { 22 class PermissionRequestImpl : public PermissionRequest {
23 public: 23 public:
24 using PermissionDecidedCallback = base::Callback<void(bool, ContentSetting)>; 24 using PermissionDecidedCallback = base::Callback<void(bool, ContentSetting)>;
25 25
26 PermissionRequestImpl( 26 PermissionRequestImpl(
27 const GURL& request_origin, 27 const GURL& request_origin,
28 content::PermissionType permission_type, 28 content::PermissionType permission_type,
29 bool user_gesture,
29 Profile* profile, 30 Profile* profile,
30 const PermissionDecidedCallback& permission_decided_callback, 31 const PermissionDecidedCallback& permission_decided_callback,
31 const base::Closure delete_callback); 32 const base::Closure delete_callback);
32 33
33 ~PermissionRequestImpl() override; 34 ~PermissionRequestImpl() override;
34 35
35 protected: 36 protected:
36 void RegisterActionTaken() { action_taken_ = true; } 37 void RegisterActionTaken() { action_taken_ = true; }
37 38
38 private: 39 private:
39 // PermissionRequest: 40 // PermissionRequest:
40 gfx::VectorIconId GetVectorIconId() const override; 41 gfx::VectorIconId GetVectorIconId() const override;
41 int GetIconId() const override; 42 int GetIconId() const override;
42 base::string16 GetMessageTextFragment() const override; 43 base::string16 GetMessageTextFragment() const override;
43 GURL GetOrigin() const override; 44 GURL GetOrigin() const override;
44 // Remember to call RegisterActionTaken for these methods if you are 45 // Remember to call RegisterActionTaken for these methods if you are
45 // overriding them. 46 // overriding them.
46 void PermissionGranted() override; 47 void PermissionGranted() override;
47 void PermissionDenied() override; 48 void PermissionDenied() override;
48 void Cancelled() override; 49 void Cancelled() override;
49 void RequestFinished() override; 50 void RequestFinished() override;
50 PermissionRequestType GetPermissionRequestType() const override; 51 PermissionRequestType GetPermissionRequestType() const override;
51 52
52 GURL request_origin_; 53 GURL request_origin_;
53 content::PermissionType permission_type_; 54 content::PermissionType permission_type_;
55 // Specify whether there was a user gesture which triggered the request.
56 bool user_gesture_;
54 Profile* profile_; 57 Profile* profile_;
55 58
56 // Called once a decision is made about the permission. 59 // Called once a decision is made about the permission.
57 const PermissionDecidedCallback permission_decided_callback_; 60 const PermissionDecidedCallback permission_decided_callback_;
58 61
59 // Called when the request is no longer in use so it can be deleted by the 62 // Called when the request is no longer in use so it can be deleted by the
60 // caller. 63 // caller.
61 const base::Closure delete_callback_; 64 const base::Closure delete_callback_;
62 bool is_finished_; 65 bool is_finished_;
63 bool action_taken_; 66 bool action_taken_;
64 67
65 DISALLOW_COPY_AND_ASSIGN(PermissionRequestImpl); 68 DISALLOW_COPY_AND_ASSIGN(PermissionRequestImpl);
66 }; 69 };
67 70
68 #endif // CHROME_BROWSER_PERMISSIONS_PERMISSION_REQUEST_IMPL_H_ 71 #endif // CHROME_BROWSER_PERMISSIONS_PERMISSION_REQUEST_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698