Chromium Code Reviews| OLD | NEW |
|---|---|
| 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" |
| (...skipping 23 matching lines...) Expand all Loading... | |
| 34 // recording Permission UMA metrics from areas of the codebase which have not | 34 // recording Permission UMA metrics from areas of the codebase which have not |
| 35 // yet been converted to PermissionType. Returns true if the conversion was | 35 // yet been converted to PermissionType. Returns true if the conversion was |
| 36 // performed. | 36 // performed. |
| 37 // TODO(tsergeant): Remove this function once callsites operate on | 37 // TODO(tsergeant): Remove this function once callsites operate on |
| 38 // PermissionType directly. | 38 // PermissionType directly. |
| 39 static bool GetPermissionType(ContentSettingsType type, | 39 static bool GetPermissionType(ContentSettingsType type, |
| 40 content::PermissionType* out); | 40 content::PermissionType* out); |
| 41 | 41 |
| 42 // A scoped class that will check the current resolved content setting on | 42 // A scoped class that will check the current resolved content setting on |
| 43 // construction and report a revocation metric accordingly if the revocation | 43 // construction and report a revocation metric accordingly if the revocation |
| 44 // condition is met (from ALLOW to something else). | 44 // condition is met (from ALLOW to something else). By default, |
| 45 // |settings_map_| is obtained from |profile_|, but it can be changed with the | |
| 46 // setter if necessary. | |
|
raymes
2016/07/26 07:50:03
This comment is incorrect now
stefanocs
2016/07/26 12:00:05
Done.
| |
| 45 class ScopedRevocationReporter { | 47 class ScopedRevocationReporter { |
| 46 public: | 48 public: |
| 47 ScopedRevocationReporter(Profile* profile, | 49 ScopedRevocationReporter(Profile* profile, |
| 48 const GURL& primary_url, | 50 const GURL& primary_url, |
| 49 const GURL& secondary_url, | 51 const GURL& secondary_url, |
| 50 ContentSettingsType content_type, | 52 ContentSettingsType content_type, |
| 51 PermissionSourceUI source_ui); | 53 PermissionSourceUI source_ui); |
| 52 | 54 |
| 55 ScopedRevocationReporter(Profile* profile, | |
| 56 const ContentSettingsPattern& primary_pattern, | |
| 57 const ContentSettingsPattern& secondary_pattern, | |
| 58 ContentSettingsType content_type, | |
| 59 PermissionSourceUI source_ui); | |
| 60 | |
| 53 ~ScopedRevocationReporter(); | 61 ~ScopedRevocationReporter(); |
| 54 | 62 |
| 55 private: | 63 private: |
| 56 Profile* profile_; | 64 Profile* profile_; |
| 57 const GURL primary_url_; | 65 const GURL primary_url_; |
| 58 const GURL secondary_url_; | 66 const GURL secondary_url_; |
| 59 ContentSettingsType content_type_; | 67 ContentSettingsType content_type_; |
| 60 PermissionSourceUI source_ui_; | 68 PermissionSourceUI source_ui_; |
| 61 bool is_initially_allowed_; | 69 bool is_initially_allowed_; |
| 62 }; | 70 }; |
| 63 | 71 |
| 64 private: | 72 private: |
| 65 DISALLOW_IMPLICIT_CONSTRUCTORS(PermissionUtil); | 73 DISALLOW_IMPLICIT_CONSTRUCTORS(PermissionUtil); |
| 66 }; | 74 }; |
| 67 | 75 |
| 68 #endif // CHROME_BROWSER_PERMISSIONS_PERMISSION_UTIL_H_ | 76 #endif // CHROME_BROWSER_PERMISSIONS_PERMISSION_UTIL_H_ |
| OLD | NEW |