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

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

Issue 2458453002: [sensors] Add Permission guard to the generic sensor apis.
Patch Set: rebase + blink reformat Created 3 years, 8 months 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 29 matching lines...) Expand all
40 case CONTENT_SETTINGS_TYPE_DURABLE_STORAGE: 40 case CONTENT_SETTINGS_TYPE_DURABLE_STORAGE:
41 return PermissionReport::DURABLE_STORAGE; 41 return PermissionReport::DURABLE_STORAGE;
42 case CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC: 42 case CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC:
43 return PermissionReport::AUDIO_CAPTURE; 43 return PermissionReport::AUDIO_CAPTURE;
44 case CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA: 44 case CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA:
45 return PermissionReport::VIDEO_CAPTURE; 45 return PermissionReport::VIDEO_CAPTURE;
46 case CONTENT_SETTINGS_TYPE_BACKGROUND_SYNC: 46 case CONTENT_SETTINGS_TYPE_BACKGROUND_SYNC:
47 return PermissionReport::BACKGROUND_SYNC; 47 return PermissionReport::BACKGROUND_SYNC;
48 case CONTENT_SETTINGS_TYPE_PLUGINS: 48 case CONTENT_SETTINGS_TYPE_PLUGINS:
49 return PermissionReport::FLASH; 49 return PermissionReport::FLASH;
50 case CONTENT_SETTINGS_TYPE_SENSORS:
51 // TODO(riju): as of now nothing
50 default: 52 default:
51 break; 53 break;
52 } 54 }
53 55
54 NOTREACHED(); 56 NOTREACHED();
55 return PermissionReport::UNKNOWN_PERMISSION; 57 return PermissionReport::UNKNOWN_PERMISSION;
56 } 58 }
57 59
58 PermissionReport::Action PermissionActionForReport(PermissionAction action) { 60 PermissionReport::Action PermissionActionForReport(PermissionAction action) {
59 switch (action) { 61 switch (action) {
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 } 219 }
218 if (log.size() < kMaximumReportsPerOriginPerPermissionPerMinute) { 220 if (log.size() < kMaximumReportsPerOriginPerPermissionPerMinute) {
219 log.push(current_time); 221 log.push(current_time);
220 return false; 222 return false;
221 } else { 223 } else {
222 return true; 224 return true;
223 } 225 }
224 } 226 }
225 227
226 } // namespace safe_browsing 228 } // namespace safe_browsing
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698