| 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" |
| 11 #include "base/time/default_clock.h" | 11 #include "base/time/default_clock.h" |
| 12 #include "chrome/browser/permissions/permission_request.h" | 12 #include "chrome/browser/permissions/permission_request.h" |
| 13 #include "chrome/common/safe_browsing/permission_report.pb.h" | 13 #include "chrome/common/safe_browsing/permission_report.pb.h" |
| 14 #include "components/variations/active_field_trials.h" | 14 #include "components/variations/active_field_trials.h" |
| 15 #include "content/public/browser/permission_type.h" | 15 #include "content/public/browser/permission_type.h" |
| 16 #include "net/url_request/report_sender.h" | 16 #include "net/url_request/report_sender.h" |
| 17 | 17 |
| 18 using content::PermissionType; | 18 using content::PermissionType; |
| 19 | 19 |
| 20 namespace safe_browsing { | 20 namespace safe_browsing { |
| 21 | 21 |
| 22 namespace { | 22 namespace { |
| 23 // URL to upload permission action reports. | 23 // URL to upload permission action reports. |
| 24 const char kPermissionActionReportingUploadUrl[] = | 24 const char kPermissionActionReportingUploadUrl[] = |
| 25 "http://safebrowsing.googleusercontent.com/safebrowsing/clientreport/" | 25 "https://safebrowsing.googleusercontent.com/safebrowsing/clientreport/" |
| 26 "permission-action"; | 26 "chrome-permissions"; |
| 27 | 27 |
| 28 const int kMaximumReportsPerOriginPerPermissionPerMinute = 5; | 28 const int kMaximumReportsPerOriginPerPermissionPerMinute = 5; |
| 29 | 29 |
| 30 PermissionReport::PermissionType PermissionTypeForReport( | 30 PermissionReport::PermissionType PermissionTypeForReport( |
| 31 PermissionType permission) { | 31 PermissionType permission) { |
| 32 switch (permission) { | 32 switch (permission) { |
| 33 case PermissionType::MIDI_SYSEX: | 33 case PermissionType::MIDI_SYSEX: |
| 34 return PermissionReport::MIDI_SYSEX; | 34 return PermissionReport::MIDI_SYSEX; |
| 35 case PermissionType::PUSH_MESSAGING: | 35 case PermissionType::PUSH_MESSAGING: |
| 36 return PermissionReport::PUSH_MESSAGING; | 36 return PermissionReport::PUSH_MESSAGING; |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 218 } | 218 } |
| 219 if (log.size() < kMaximumReportsPerOriginPerPermissionPerMinute) { | 219 if (log.size() < kMaximumReportsPerOriginPerPermissionPerMinute) { |
| 220 log.push(current_time); | 220 log.push(current_time); |
| 221 return false; | 221 return false; |
| 222 } else { | 222 } else { |
| 223 return true; | 223 return true; |
| 224 } | 224 } |
| 225 } | 225 } |
| 226 | 226 |
| 227 } // namespace safe_browsing | 227 } // namespace safe_browsing |
| OLD | NEW |