| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 #include "chrome/browser/safe_browsing/permission_reporter.h" | 5 #include "chrome/browser/safe_browsing/permission_reporter.h" |
| 6 | 6 |
| 7 #include <functional> | 7 #include <functional> |
| 8 | 8 |
| 9 #include "base/hash.h" | 9 #include "base/hash.h" |
| 10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 return PermissionReport::PROTECTED_MEDIA_IDENTIFIER; | 42 return PermissionReport::PROTECTED_MEDIA_IDENTIFIER; |
| 43 case PermissionType::MIDI: | 43 case PermissionType::MIDI: |
| 44 return PermissionReport::MIDI; | 44 return PermissionReport::MIDI; |
| 45 case PermissionType::DURABLE_STORAGE: | 45 case PermissionType::DURABLE_STORAGE: |
| 46 return PermissionReport::DURABLE_STORAGE; | 46 return PermissionReport::DURABLE_STORAGE; |
| 47 case PermissionType::AUDIO_CAPTURE: | 47 case PermissionType::AUDIO_CAPTURE: |
| 48 return PermissionReport::AUDIO_CAPTURE; | 48 return PermissionReport::AUDIO_CAPTURE; |
| 49 case PermissionType::VIDEO_CAPTURE: | 49 case PermissionType::VIDEO_CAPTURE: |
| 50 return PermissionReport::VIDEO_CAPTURE; | 50 return PermissionReport::VIDEO_CAPTURE; |
| 51 case PermissionType::BACKGROUND_SYNC: | 51 case PermissionType::BACKGROUND_SYNC: |
| 52 return PermissionReport::UNKNOWN_PERMISSION; | 52 return PermissionReport::BACKGROUND_SYNC; |
| 53 case PermissionType::PLUGINS: |
| 54 return PermissionReport::PLUGINS; |
| 53 case PermissionType::NUM: | 55 case PermissionType::NUM: |
| 54 break; | 56 break; |
| 55 } | 57 } |
| 56 | 58 |
| 57 NOTREACHED(); | 59 NOTREACHED(); |
| 58 return PermissionReport::UNKNOWN_PERMISSION; | 60 return PermissionReport::UNKNOWN_PERMISSION; |
| 59 } | 61 } |
| 60 | 62 |
| 61 PermissionReport::Action PermissionActionForReport(PermissionAction action) { | 63 PermissionReport::Action PermissionActionForReport(PermissionAction action) { |
| 62 switch (action) { | 64 switch (action) { |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 218 } | 220 } |
| 219 if (log.size() < kMaximumReportsPerOriginPerPermissionPerMinute) { | 221 if (log.size() < kMaximumReportsPerOriginPerPermissionPerMinute) { |
| 220 log.push(current_time); | 222 log.push(current_time); |
| 221 return false; | 223 return false; |
| 222 } else { | 224 } else { |
| 223 return true; | 225 return true; |
| 224 } | 226 } |
| 225 } | 227 } |
| 226 | 228 |
| 227 } // namespace safe_browsing | 229 } // namespace safe_browsing |
| OLD | NEW |