Dart Documentationchrome.browsingDataChromeBrowsingData

ChromeBrowsingData class

class ChromeBrowsingData extends ChromeApi {
 static final JsObject _browsingData = chrome['browsingData'];

 ChromeBrowsingData._();

 bool get available => _browsingData != null;

 /**
  * Reports which types of data are currently selected in the 'Clear browsing
  * data' settings UI.  Note: some of the data types included in this API are
  * not available in the settings UI, and some UI settings control more than
  * one data type listed here.
  */
 Future<Map> settings() {
   if (_browsingData == null) _throwNotAvailable();

   var completer = new ChromeCompleter<Map>.oneArg(mapify);
   _browsingData.callMethod('settings', [completer.callback]);
   return completer.future;
 }

 /**
  * Clears various types of browsing data stored in a user's profile.
  * 
  * [dataToRemove] The set of data types to remove.
  */
 Future remove(RemovalOptions options, DataTypeSet dataToRemove) {
   if (_browsingData == null) _throwNotAvailable();

   var completer = new ChromeCompleter.noArgs();
   _browsingData.callMethod('remove', [jsify(options), jsify(dataToRemove), completer.callback]);
   return completer.future;
 }

 /**
  * Clears websites' appcache data.
  */
 Future removeAppcache(RemovalOptions options) {
   if (_browsingData == null) _throwNotAvailable();

   var completer = new ChromeCompleter.noArgs();
   _browsingData.callMethod('removeAppcache', [jsify(options), completer.callback]);
   return completer.future;
 }

 /**
  * Clears the browser's cache.
  */
 Future removeCache(RemovalOptions options) {
   if (_browsingData == null) _throwNotAvailable();

   var completer = new ChromeCompleter.noArgs();
   _browsingData.callMethod('removeCache', [jsify(options), completer.callback]);
   return completer.future;
 }

 /**
  * Clears the browser's cookies and server-bound certificates modified within
  * a particular timeframe.
  */
 Future removeCookies(RemovalOptions options) {
   if (_browsingData == null) _throwNotAvailable();

   var completer = new ChromeCompleter.noArgs();
   _browsingData.callMethod('removeCookies', [jsify(options), completer.callback]);
   return completer.future;
 }

 /**
  * Clears the browser's list of downloaded files (_not_ the downloaded files
  * themselves).
  */
 Future removeDownloads(RemovalOptions options) {
   if (_browsingData == null) _throwNotAvailable();

   var completer = new ChromeCompleter.noArgs();
   _browsingData.callMethod('removeDownloads', [jsify(options), completer.callback]);
   return completer.future;
 }

 /**
  * Clears websites' file system data.
  */
 Future removeFileSystems(RemovalOptions options) {
   if (_browsingData == null) _throwNotAvailable();

   var completer = new ChromeCompleter.noArgs();
   _browsingData.callMethod('removeFileSystems', [jsify(options), completer.callback]);
   return completer.future;
 }

 /**
  * Clears the browser's stored form data (autofill).
  */
 Future removeFormData(RemovalOptions options) {
   if (_browsingData == null) _throwNotAvailable();

   var completer = new ChromeCompleter.noArgs();
   _browsingData.callMethod('removeFormData', [jsify(options), completer.callback]);
   return completer.future;
 }

 /**
  * Clears the browser's history.
  */
 Future removeHistory(RemovalOptions options) {
   if (_browsingData == null) _throwNotAvailable();

   var completer = new ChromeCompleter.noArgs();
   _browsingData.callMethod('removeHistory', [jsify(options), completer.callback]);
   return completer.future;
 }

 /**
  * Clears websites' IndexedDB data.
  */
 Future removeIndexedDB(RemovalOptions options) {
   if (_browsingData == null) _throwNotAvailable();

   var completer = new ChromeCompleter.noArgs();
   _browsingData.callMethod('removeIndexedDB', [jsify(options), completer.callback]);
   return completer.future;
 }

 /**
  * Clears websites' local storage data.
  */
 Future removeLocalStorage(RemovalOptions options) {
   if (_browsingData == null) _throwNotAvailable();

   var completer = new ChromeCompleter.noArgs();
   _browsingData.callMethod('removeLocalStorage', [jsify(options), completer.callback]);
   return completer.future;
 }

 /**
  * Clears plugins' data.
  */
 Future removePluginData(RemovalOptions options) {
   if (_browsingData == null) _throwNotAvailable();

   var completer = new ChromeCompleter.noArgs();
   _browsingData.callMethod('removePluginData', [jsify(options), completer.callback]);
   return completer.future;
 }

 /**
  * Clears the browser's stored passwords.
  */
 Future removePasswords(RemovalOptions options) {
   if (_browsingData == null) _throwNotAvailable();

   var completer = new ChromeCompleter.noArgs();
   _browsingData.callMethod('removePasswords', [jsify(options), completer.callback]);
   return completer.future;
 }

 /**
  * Clears websites' WebSQL data.
  */
 Future removeWebSQL(RemovalOptions options) {
   if (_browsingData == null) _throwNotAvailable();

   var completer = new ChromeCompleter.noArgs();
   _browsingData.callMethod('removeWebSQL', [jsify(options), completer.callback]);
   return completer.future;
 }

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

Extends

ChromeApi > ChromeBrowsingData

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 => _browsingData != null;

Methods

Future remove(RemovalOptions options, DataTypeSet dataToRemove) #

Clears various types of browsing data stored in a user's profile.

dataToRemove The set of data types to remove.

Future remove(RemovalOptions options, DataTypeSet dataToRemove) {
 if (_browsingData == null) _throwNotAvailable();

 var completer = new ChromeCompleter.noArgs();
 _browsingData.callMethod('remove', [jsify(options), jsify(dataToRemove), completer.callback]);
 return completer.future;
}

Future removeAppcache(RemovalOptions options) #

Clears websites' appcache data.

Future removeAppcache(RemovalOptions options) {
 if (_browsingData == null) _throwNotAvailable();

 var completer = new ChromeCompleter.noArgs();
 _browsingData.callMethod('removeAppcache', [jsify(options), completer.callback]);
 return completer.future;
}

Future removeCache(RemovalOptions options) #

Clears the browser's cache.

Future removeCache(RemovalOptions options) {
 if (_browsingData == null) _throwNotAvailable();

 var completer = new ChromeCompleter.noArgs();
 _browsingData.callMethod('removeCache', [jsify(options), completer.callback]);
 return completer.future;
}

Future removeCookies(RemovalOptions options) #

Clears the browser's cookies and server-bound certificates modified within a particular timeframe.

Future removeCookies(RemovalOptions options) {
 if (_browsingData == null) _throwNotAvailable();

 var completer = new ChromeCompleter.noArgs();
 _browsingData.callMethod('removeCookies', [jsify(options), completer.callback]);
 return completer.future;
}

Future removeDownloads(RemovalOptions options) #

Clears the browser's list of downloaded files (not the downloaded files themselves).

Future removeDownloads(RemovalOptions options) {
 if (_browsingData == null) _throwNotAvailable();

 var completer = new ChromeCompleter.noArgs();
 _browsingData.callMethod('removeDownloads', [jsify(options), completer.callback]);
 return completer.future;
}

Future removeFileSystems(RemovalOptions options) #

Clears websites' file system data.

Future removeFileSystems(RemovalOptions options) {
 if (_browsingData == null) _throwNotAvailable();

 var completer = new ChromeCompleter.noArgs();
 _browsingData.callMethod('removeFileSystems', [jsify(options), completer.callback]);
 return completer.future;
}

Future removeFormData(RemovalOptions options) #

Clears the browser's stored form data (autofill).

Future removeFormData(RemovalOptions options) {
 if (_browsingData == null) _throwNotAvailable();

 var completer = new ChromeCompleter.noArgs();
 _browsingData.callMethod('removeFormData', [jsify(options), completer.callback]);
 return completer.future;
}

Future removeHistory(RemovalOptions options) #

Clears the browser's history.

Future removeHistory(RemovalOptions options) {
 if (_browsingData == null) _throwNotAvailable();

 var completer = new ChromeCompleter.noArgs();
 _browsingData.callMethod('removeHistory', [jsify(options), completer.callback]);
 return completer.future;
}

Future removeIndexedDB(RemovalOptions options) #

Clears websites' IndexedDB data.

Future removeIndexedDB(RemovalOptions options) {
 if (_browsingData == null) _throwNotAvailable();

 var completer = new ChromeCompleter.noArgs();
 _browsingData.callMethod('removeIndexedDB', [jsify(options), completer.callback]);
 return completer.future;
}

Future removeLocalStorage(RemovalOptions options) #

Clears websites' local storage data.

Future removeLocalStorage(RemovalOptions options) {
 if (_browsingData == null) _throwNotAvailable();

 var completer = new ChromeCompleter.noArgs();
 _browsingData.callMethod('removeLocalStorage', [jsify(options), completer.callback]);
 return completer.future;
}

Future removePasswords(RemovalOptions options) #

Clears the browser's stored passwords.

Future removePasswords(RemovalOptions options) {
 if (_browsingData == null) _throwNotAvailable();

 var completer = new ChromeCompleter.noArgs();
 _browsingData.callMethod('removePasswords', [jsify(options), completer.callback]);
 return completer.future;
}

Future removePluginData(RemovalOptions options) #

Clears plugins' data.

Future removePluginData(RemovalOptions options) {
 if (_browsingData == null) _throwNotAvailable();

 var completer = new ChromeCompleter.noArgs();
 _browsingData.callMethod('removePluginData', [jsify(options), completer.callback]);
 return completer.future;
}

Future removeWebSQL(RemovalOptions options) #

Clears websites' WebSQL data.

Future removeWebSQL(RemovalOptions options) {
 if (_browsingData == null) _throwNotAvailable();

 var completer = new ChromeCompleter.noArgs();
 _browsingData.callMethod('removeWebSQL', [jsify(options), completer.callback]);
 return completer.future;
}

Future<Map> settings() #

Reports which types of data are currently selected in the 'Clear browsing data' settings UI. Note: some of the data types included in this API are not available in the settings UI, and some UI settings control more than one data type listed here.

Future<Map> settings() {
 if (_browsingData == null) _throwNotAvailable();

 var completer = new ChromeCompleter<Map>.oneArg(mapify);
 _browsingData.callMethod('settings', [completer.callback]);
 return completer.future;
}