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

Side by Side Diff: chrome/browser/safe_browsing/permission_reporter.cc

Issue 2458453002: [sensors] Add Permission guard to the generic sensor apis.
Patch Set: Remove resetPermission + Rebase Created 4 years 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 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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
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::BACKGROUND_SYNC; 52 return PermissionReport::BACKGROUND_SYNC;
53 case PermissionType::FLASH: 53 case PermissionType::FLASH:
54 return PermissionReport::FLASH; 54 return PermissionReport::FLASH;
55 case PermissionType::SENSORS:
56 // TODO(riju): as of now nothing
55 case PermissionType::NUM: 57 case PermissionType::NUM:
56 break; 58 break;
57 } 59 }
58 60
59 NOTREACHED(); 61 NOTREACHED();
60 return PermissionReport::UNKNOWN_PERMISSION; 62 return PermissionReport::UNKNOWN_PERMISSION;
61 } 63 }
62 64
63 PermissionReport::Action PermissionActionForReport(PermissionAction action) { 65 PermissionReport::Action PermissionActionForReport(PermissionAction action) {
64 switch (action) { 66 switch (action) {
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 } 224 }
223 if (log.size() < kMaximumReportsPerOriginPerPermissionPerMinute) { 225 if (log.size() < kMaximumReportsPerOriginPerPermissionPerMinute) {
224 log.push(current_time); 226 log.push(current_time);
225 return false; 227 return false;
226 } else { 228 } else {
227 return true; 229 return true;
228 } 230 }
229 } 231 }
230 232
231 } // namespace safe_browsing 233 } // namespace safe_browsing
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698