| OLD | NEW |
| 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.ContentSettingsType; |
| 7 import org.chromium.chrome.browser.util.MathUtils; | 8 import org.chromium.chrome.browser.util.MathUtils; |
| 8 | 9 |
| 9 import java.io.Serializable; | 10 import java.io.Serializable; |
| 10 import java.util.ArrayList; | 11 import java.util.ArrayList; |
| 11 import java.util.List; | 12 import java.util.List; |
| 12 | 13 |
| 13 /** | 14 /** |
| 14 * Website is a class for storing information about a website and its associated
permissions. | 15 * Website is a class for storing information about a website and its associated
permissions. |
| 15 */ | 16 */ |
| 16 public class Website implements Serializable { | 17 public class Website implements Serializable { |
| (...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 368 if (mSubresourceFilterException != null) { | 369 if (mSubresourceFilterException != null) { |
| 369 return mSubresourceFilterException.getContentSetting(); | 370 return mSubresourceFilterException.getContentSetting(); |
| 370 } | 371 } |
| 371 return null; | 372 return null; |
| 372 } | 373 } |
| 373 | 374 |
| 374 /** | 375 /** |
| 375 * Sets the Subresource Filter permission. | 376 * Sets the Subresource Filter permission. |
| 376 */ | 377 */ |
| 377 public void setSubresourceFilterPermission(ContentSetting value) { | 378 public void setSubresourceFilterPermission(ContentSetting value) { |
| 378 if (mSubresourceFilterException != null) { | 379 // It is possible to set the permission without having an existing excep
tion, because we can |
| 379 mSubresourceFilterException.setContentSetting(value); | 380 // show the BLOCK state even when this permission is set to the default.
In that case, just |
| 381 // set an exception now to BLOCK to enable changing the permission. |
| 382 if (mSubresourceFilterException == null) { |
| 383 setSubresourceFilterException(new ContentSettingException( |
| 384 ContentSettingsType.CONTENT_SETTINGS_TYPE_SUBRESOURCE_FILTER
, |
| 385 getAddress().getOrigin(), ContentSetting.BLOCK, "")); |
| 380 } | 386 } |
| 387 mSubresourceFilterException.setContentSetting(value); |
| 381 } | 388 } |
| 382 | 389 |
| 383 /** | 390 /** |
| 384 * Sets protected media identifier access permission information class. | 391 * Sets protected media identifier access permission information class. |
| 385 */ | 392 */ |
| 386 public void setProtectedMediaIdentifierInfo(ProtectedMediaIdentifierInfo inf
o) { | 393 public void setProtectedMediaIdentifierInfo(ProtectedMediaIdentifierInfo inf
o) { |
| 387 mProtectedMediaIdentifierInfo = info; | 394 mProtectedMediaIdentifierInfo = info; |
| 388 } | 395 } |
| 389 | 396 |
| 390 public ProtectedMediaIdentifierInfo getProtectedMediaIdentifierInfo() { | 397 public ProtectedMediaIdentifierInfo getProtectedMediaIdentifierInfo() { |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 470 mUsbInfo.add(info); | 477 mUsbInfo.add(info); |
| 471 } | 478 } |
| 472 | 479 |
| 473 /** | 480 /** |
| 474 * Returns the set of USB devices this website has been granted permission t
o access. | 481 * Returns the set of USB devices this website has been granted permission t
o access. |
| 475 */ | 482 */ |
| 476 public List<UsbInfo> getUsbInfo() { | 483 public List<UsbInfo> getUsbInfo() { |
| 477 return new ArrayList<UsbInfo>(mUsbInfo); | 484 return new ArrayList<UsbInfo>(mUsbInfo); |
| 478 } | 485 } |
| 479 } | 486 } |
| OLD | NEW |