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

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

Issue 2463393003: Record permission prompt gesture metrics on Android. (Closed)
Patch Set: Address comments Created 4 years, 1 month 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 2015 The Chromium Authors. All rights reserved. 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 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_UTIL_H_ 5 #ifndef CHROME_BROWSER_PERMISSIONS_PERMISSION_UTIL_H_
6 #define CHROME_BROWSER_PERMISSIONS_PERMISSION_UTIL_H_ 6 #define CHROME_BROWSER_PERMISSIONS_PERMISSION_UTIL_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
11 #include "chrome/browser/permissions/permission_request.h"
11 #include "components/content_settings/core/common/content_settings.h" 12 #include "components/content_settings/core/common/content_settings.h"
12 #include "components/content_settings/core/common/content_settings_types.h" 13 #include "components/content_settings/core/common/content_settings_types.h"
13 #include "url/gurl.h" 14 #include "url/gurl.h"
14 15
15 class Profile; 16 class Profile;
16 17
17 namespace content { 18 namespace content {
18 enum class PermissionType; 19 enum class PermissionType;
19 } // namespace content 20 } // namespace content
20 21
(...skipping 16 matching lines...) Expand all
37 struct PermissionTypeHash { 38 struct PermissionTypeHash {
38 std::size_t operator()(const content::PermissionType& type) const; 39 std::size_t operator()(const content::PermissionType& type) const;
39 }; 40 };
40 41
41 // A utility class for permissions. 42 // A utility class for permissions.
42 class PermissionUtil { 43 class PermissionUtil {
43 public: 44 public:
44 // Returns the permission string for the given PermissionType. 45 // Returns the permission string for the given PermissionType.
45 static std::string GetPermissionString(content::PermissionType permission); 46 static std::string GetPermissionString(content::PermissionType permission);
46 47
48 // Returns the request type corresponding to a permission type.
49 static PermissionRequestType GetRequestType(content::PermissionType type);
50
51 // Returns the gesture type corresponding to whether a permission request is
52 // made with or without a user gesture.
53 static PermissionRequestGestureType GetGestureType(bool user_gesture);
54
47 // Limited conversion of ContentSettingsType to PermissionType. Intended for 55 // Limited conversion of ContentSettingsType to PermissionType. Intended for
48 // recording Permission UMA metrics from areas of the codebase which have not 56 // recording Permission UMA metrics from areas of the codebase which have not
49 // yet been converted to PermissionType. Returns true if the conversion was 57 // yet been converted to PermissionType. Returns true if the conversion was
50 // performed. 58 // performed.
51 // TODO(tsergeant): Remove this function once callsites operate on 59 // TODO(tsergeant): Remove this function once callsites operate on
52 // PermissionType directly. 60 // PermissionType directly.
53 static bool GetPermissionType(ContentSettingsType type, 61 static bool GetPermissionType(ContentSettingsType type,
54 content::PermissionType* out); 62 content::PermissionType* out);
55 63
56 static bool ShouldShowPersistenceToggle(); 64 static bool ShouldShowPersistenceToggle();
(...skipping 24 matching lines...) Expand all
81 ContentSettingsType content_type_; 89 ContentSettingsType content_type_;
82 PermissionSourceUI source_ui_; 90 PermissionSourceUI source_ui_;
83 bool is_initially_allowed_; 91 bool is_initially_allowed_;
84 }; 92 };
85 93
86 private: 94 private:
87 DISALLOW_IMPLICIT_CONSTRUCTORS(PermissionUtil); 95 DISALLOW_IMPLICIT_CONSTRUCTORS(PermissionUtil);
88 }; 96 };
89 97
90 #endif // CHROME_BROWSER_PERMISSIONS_PERMISSION_UTIL_H_ 98 #endif // CHROME_BROWSER_PERMISSIONS_PERMISSION_UTIL_H_
OLDNEW
« no previous file with comments | « chrome/browser/permissions/permission_uma_util.cc ('k') | chrome/browser/permissions/permission_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698