Dart Documentationchrome.contentSettingsChromeContentSettings

ChromeContentSettings class

class ChromeContentSettings extends ChromeApi {
 static final JsObject _contentSettings = chrome['contentSettings'];

 ChromeContentSettings._();

 bool get available => _contentSettings != null;

 /**
  * Whether to allow cookies and other local data to be set by websites. One
  * of<br>[allow]: Accept cookies,<br>[block]: Block
  * cookies,<br>[session_only]: Accept cookies only for the current session.
  * <br>Default is [allow].<br>The primary URL is the URL representing the
  * cookie origin. The secondary URL is the URL of the top-level frame.
  */
 ContentSetting get cookies => _createContentSetting(_contentSettings['cookies']);

 /**
  * Whether to show images. One of<br>[allow]: Show images,<br>[block]: Don't
  * show images. <br>Default is [allow].<br>The primary URL is the main-frame
  * URL. The secondary URL is the URL of the image.
  */
 ContentSetting get images => _createContentSetting(_contentSettings['images']);

 /**
  * Whether to run JavaScript. One of<br>[allow]: Run JavaScript,<br>[block]:
  * Don't run JavaScript. <br>Default is [allow].<br>The primary URL is the
  * main-frame URL. The secondary URL is not used.
  */
 ContentSetting get javascript => _createContentSetting(_contentSettings['javascript']);

 /**
  * Whether to run plug-ins. One of<br>[allow]: Run plug-ins
  * automatically,<br>[block]: Don't run plug-ins automatically. <br>Default is
  * [allow].<br>The primary URL is the main-frame URL. The secondary URL is not
  * used.
  */
 ContentSetting get plugins => _createContentSetting(_contentSettings['plugins']);

 /**
  * Whether to allow sites to show pop-ups. One of<br>[allow]: Allow sites to
  * show pop-ups,<br>[block]: Don't allow sites to show pop-ups. <br>Default is
  * [block].<br>The primary URL is the main-frame URL. The secondary URL is not
  * used.
  */
 ContentSetting get popups => _createContentSetting(_contentSettings['popups']);

 /**
  * Whether to allow sites to show desktop notifications. One of<br>[allow]:
  * Allow sites to show desktop notifications,<br>[block]: Don't allow sites to
  * show desktop notifications,<br>[ask]: Ask when a site wants to show desktop
  * notifications. <br>Default is [ask].<br>The primary URL is the main-frame
  * URL. The secondary URL is not used.
  */
 ContentSetting get notifications => _createContentSetting(_contentSettings['notifications']);

 void _throwNotAvailable() {
   throw new UnsupportedError("'chrome.contentSettings' is not available");
 }
}

Extends

ChromeApi > ChromeContentSettings

Properties

final bool available #

Returns true if the API is available. The common causes of an API not being avilable are:

  • a permission is missing in the application's manifest.json file
  • the API is defined on a newer version of Chrome then the current runtime
docs inherited from ChromeApi
bool get available => _contentSettings != null;

final ContentSetting cookies #

Whether to allow cookies and other local data to be set by websites. One of<br>allow: Accept cookies,<br>block: Block cookies,<br>session_only: Accept cookies only for the current session. <br>Default is allow.<br>The primary URL is the URL representing the cookie origin. The secondary URL is the URL of the top-level frame.

ContentSetting get cookies => _createContentSetting(_contentSettings['cookies']);

final ContentSetting images #

Whether to show images. One of<br>allow: Show images,<br>block: Don't show images. <br>Default is allow.<br>The primary URL is the main-frame URL. The secondary URL is the URL of the image.

ContentSetting get images => _createContentSetting(_contentSettings['images']);

final ContentSetting javascript #

Whether to run JavaScript. One of<br>allow: Run JavaScript,<br>block: Don't run JavaScript. <br>Default is allow.<br>The primary URL is the main-frame URL. The secondary URL is not used.

ContentSetting get javascript => _createContentSetting(_contentSettings['javascript']);

final ContentSetting notifications #

Whether to allow sites to show desktop notifications. One of<br>allow: Allow sites to show desktop notifications,<br>block: Don't allow sites to show desktop notifications,<br>ask: Ask when a site wants to show desktop notifications. <br>Default is ask.<br>The primary URL is the main-frame URL. The secondary URL is not used.

ContentSetting get notifications => _createContentSetting(_contentSettings['notifications']);

final ContentSetting plugins #

Whether to run plug-ins. One of<br>allow: Run plug-ins automatically,<br>block: Don't run plug-ins automatically. <br>Default is allow.<br>The primary URL is the main-frame URL. The secondary URL is not used.

ContentSetting get plugins => _createContentSetting(_contentSettings['plugins']);

final ContentSetting popups #

Whether to allow sites to show pop-ups. One of<br>allow: Allow sites to show pop-ups,<br>block: Don't allow sites to show pop-ups. <br>Default is block.<br>The primary URL is the main-frame URL. The secondary URL is not used.

ContentSetting get popups => _createContentSetting(_contentSettings['popups']);