| 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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 default: | 50 default: |
| 51 break; | 51 break; |
| 52 } | 52 } |
| 53 | 53 |
| 54 NOTREACHED(); | 54 NOTREACHED(); |
| 55 return PermissionReport::UNKNOWN_PERMISSION; | 55 return PermissionReport::UNKNOWN_PERMISSION; |
| 56 } | 56 } |
| 57 | 57 |
| 58 PermissionReport::Action PermissionActionForReport(PermissionAction action) { | 58 PermissionReport::Action PermissionActionForReport(PermissionAction action) { |
| 59 switch (action) { | 59 switch (action) { |
| 60 case GRANTED: | 60 case PermissionAction::GRANTED: |
| 61 return PermissionReport::GRANTED; | 61 return PermissionReport::GRANTED; |
| 62 case DENIED: | 62 case PermissionAction::DENIED: |
| 63 return PermissionReport::DENIED; | 63 return PermissionReport::DENIED; |
| 64 case DISMISSED: | 64 case PermissionAction::DISMISSED: |
| 65 return PermissionReport::DISMISSED; | 65 return PermissionReport::DISMISSED; |
| 66 case IGNORED: | 66 case PermissionAction::IGNORED: |
| 67 return PermissionReport::IGNORED; | 67 return PermissionReport::IGNORED; |
| 68 case REVOKED: | 68 case PermissionAction::REVOKED: |
| 69 return PermissionReport::REVOKED; | 69 return PermissionReport::REVOKED; |
| 70 case REENABLED: | 70 case PermissionAction::REENABLED: |
| 71 case REQUESTED: | 71 case PermissionAction::REQUESTED: |
| 72 return PermissionReport::ACTION_UNSPECIFIED; | 72 return PermissionReport::ACTION_UNSPECIFIED; |
| 73 case PERMISSION_ACTION_NUM: | 73 case PermissionAction::NUM: |
| 74 break; | 74 break; |
| 75 } | 75 } |
| 76 | 76 |
| 77 NOTREACHED(); | 77 NOTREACHED(); |
| 78 return PermissionReport::ACTION_UNSPECIFIED; | 78 return PermissionReport::ACTION_UNSPECIFIED; |
| 79 } | 79 } |
| 80 | 80 |
| 81 PermissionReport::SourceUI SourceUIForReport(PermissionSourceUI source_ui) { | 81 PermissionReport::SourceUI SourceUIForReport(PermissionSourceUI source_ui) { |
| 82 switch (source_ui) { | 82 switch (source_ui) { |
| 83 case PermissionSourceUI::PROMPT: | 83 case PermissionSourceUI::PROMPT: |
| 84 return PermissionReport::PROMPT; | 84 return PermissionReport::PROMPT; |
| 85 case PermissionSourceUI::OIB: | 85 case PermissionSourceUI::OIB: |
| 86 return PermissionReport::OIB; | 86 return PermissionReport::OIB; |
| 87 case PermissionSourceUI::SITE_SETTINGS: | 87 case PermissionSourceUI::SITE_SETTINGS: |
| 88 return PermissionReport::SITE_SETTINGS; | 88 return PermissionReport::SITE_SETTINGS; |
| 89 case PermissionSourceUI::PAGE_ACTION: | 89 case PermissionSourceUI::PAGE_ACTION: |
| 90 return PermissionReport::PAGE_ACTION; | 90 return PermissionReport::PAGE_ACTION; |
| 91 case PermissionSourceUI::SOURCE_UI_NUM: | 91 case PermissionSourceUI::NUM: |
| 92 break; | 92 break; |
| 93 } | 93 } |
| 94 | 94 |
| 95 NOTREACHED(); | 95 NOTREACHED(); |
| 96 return PermissionReport::SOURCE_UI_UNSPECIFIED; | 96 return PermissionReport::SOURCE_UI_UNSPECIFIED; |
| 97 } | 97 } |
| 98 | 98 |
| 99 PermissionReport::GestureType GestureTypeForReport( | 99 PermissionReport::GestureType GestureTypeForReport( |
| 100 PermissionRequestGestureType gesture_type) { | 100 PermissionRequestGestureType gesture_type) { |
| 101 switch (gesture_type) { | 101 switch (gesture_type) { |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 217 } | 217 } |
| 218 if (log.size() < kMaximumReportsPerOriginPerPermissionPerMinute) { | 218 if (log.size() < kMaximumReportsPerOriginPerPermissionPerMinute) { |
| 219 log.push(current_time); | 219 log.push(current_time); |
| 220 return false; | 220 return false; |
| 221 } else { | 221 } else { |
| 222 return true; | 222 return true; |
| 223 } | 223 } |
| 224 } | 224 } |
| 225 | 225 |
| 226 } // namespace safe_browsing | 226 } // namespace safe_browsing |
| OLD | NEW |