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

Side by Side Diff: chrome/android/java/src/org/chromium/chrome/browser/preferences/website/Website.java

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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 package org.chromium.chrome.browser.preferences.website; 5 package org.chromium.chrome.browser.preferences.website;
6 6
7 import org.chromium.chrome.browser.util.MathUtils; 7 import org.chromium.chrome.browser.util.MathUtils;
8 8
9 import java.io.Serializable; 9 import java.io.Serializable;
10 import java.util.ArrayList; 10 import java.util.ArrayList;
(...skipping 17 matching lines...) Expand all
28 28
29 private ContentSettingException mAutoplayExceptionInfo; 29 private ContentSettingException mAutoplayExceptionInfo;
30 private ContentSettingException mBackgroundSyncExceptionInfo; 30 private ContentSettingException mBackgroundSyncExceptionInfo;
31 private CameraInfo mCameraInfo; 31 private CameraInfo mCameraInfo;
32 private ContentSettingException mCookieException; 32 private ContentSettingException mCookieException;
33 private GeolocationInfo mGeolocationInfo; 33 private GeolocationInfo mGeolocationInfo;
34 private ContentSettingException mJavaScriptException; 34 private ContentSettingException mJavaScriptException;
35 private LocalStorageInfo mLocalStorageInfo; 35 private LocalStorageInfo mLocalStorageInfo;
36 private MicrophoneInfo mMicrophoneInfo; 36 private MicrophoneInfo mMicrophoneInfo;
37 private MidiInfo mMidiInfo; 37 private MidiInfo mMidiInfo;
38 private SensorInfo mSensorInfo;
38 private NotificationInfo mNotificationInfo; 39 private NotificationInfo mNotificationInfo;
39 private ContentSettingException mPopupException; 40 private ContentSettingException mPopupException;
40 private ContentSettingException mSubresourceFilterException; 41 private ContentSettingException mSubresourceFilterException;
41 private ProtectedMediaIdentifierInfo mProtectedMediaIdentifierInfo; 42 private ProtectedMediaIdentifierInfo mProtectedMediaIdentifierInfo;
42 private final List<StorageInfo> mStorageInfo = new ArrayList<StorageInfo>(); 43 private final List<StorageInfo> mStorageInfo = new ArrayList<StorageInfo>();
43 private int mStorageInfoCallbacksLeft; 44 private int mStorageInfoCallbacksLeft;
44 private final List<UsbInfo> mUsbInfo = new ArrayList<UsbInfo>(); 45 private final List<UsbInfo> mUsbInfo = new ArrayList<UsbInfo>();
45 46
46 public Website(WebsiteAddress origin, WebsiteAddress embedder) { 47 public Website(WebsiteAddress origin, WebsiteAddress embedder) {
47 mOrigin = origin; 48 mOrigin = origin;
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
286 /** 287 /**
287 * Configure Midi usage access setting for this site. 288 * Configure Midi usage access setting for this site.
288 */ 289 */
289 public void setMidiPermission(ContentSetting value) { 290 public void setMidiPermission(ContentSetting value) {
290 if (mMidiInfo != null) { 291 if (mMidiInfo != null) {
291 mMidiInfo.setContentSetting(value); 292 mMidiInfo.setContentSetting(value);
292 } 293 }
293 } 294 }
294 295
295 /** 296 /**
297 * Sets the SensorInfo object for this Website.
298 */
299 public void setSensorInfo(SensorInfo info) {
300 mSensorInfo = info;
301 }
302
303 public SensorInfo getSensorInfo() {
304 return mSensorInfo;
305 }
306 /**
307 * Returns what permission governs Sensors usage access.
308 */
309 public ContentSetting getSensorsPermission() {
310 return mSensorInfo != null ? mSensorInfo.getContentSetting() : null;
311 }
312 /**
313 * Configure Sensors usage access setting for this site.
314 */
315 public void setSensorsPermission(ContentSetting value) {
316 if (mSensorInfo != null) {
317 mSensorInfo.setContentSetting(value);
318 }
319 }
320
321 /**
296 * Sets Notification access permission information class. 322 * Sets Notification access permission information class.
297 */ 323 */
298 public void setNotificationInfo(NotificationInfo info) { 324 public void setNotificationInfo(NotificationInfo info) {
299 mNotificationInfo = info; 325 mNotificationInfo = info;
300 } 326 }
301 327
302 public NotificationInfo getNotificationInfo() { 328 public NotificationInfo getNotificationInfo() {
303 return mNotificationInfo; 329 return mNotificationInfo;
304 } 330 }
305 331
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
470 mUsbInfo.add(info); 496 mUsbInfo.add(info);
471 } 497 }
472 498
473 /** 499 /**
474 * Returns the set of USB devices this website has been granted permission t o access. 500 * Returns the set of USB devices this website has been granted permission t o access.
475 */ 501 */
476 public List<UsbInfo> getUsbInfo() { 502 public List<UsbInfo> getUsbInfo() {
477 return new ArrayList<UsbInfo>(mUsbInfo); 503 return new ArrayList<UsbInfo>(mUsbInfo);
478 } 504 }
479 } 505 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698