Skip to content

Commit

Permalink
35
Browse files Browse the repository at this point in the history
  • Loading branch information
tong committed Jun 6, 2014
1 parent cfd6cc0 commit d88b092
Show file tree
Hide file tree
Showing 71 changed files with 1,283 additions and 1,157 deletions.
31 changes: 18 additions & 13 deletions Makefile
@@ -1,24 +1,29 @@

##
## chrome-extension
##

all: haxedoc.xml

haxedoc.xml:
PROJECT = chrome-ext
SRC := $(shell find chrome/ -type f -name '*.hx')

all: haxedoc.xml documentation $(PROJECT).zip

haxedoc.xml: $(SRC)
haxe haxedoc.hxml

chrome-extension.zip: haxedoc.xml
zip -r $@ chrome/ extraParams.hxml haxedoc.hxml haxelib.json README.md
documentation: $(SRC) haxedoc.xml
haxelib run dox -o doc/ -i ./

$(PROJECT).zip: $(SRC) haxedoc.xml
zip -r $@ chrome/ extraParams.hxml haxedoc.xml haxelib.json README.md

install: chrome-extension.zip
haxelib install chrome-extension.zip
install: $(PROJECT).zip
haxelib install $(PROJECT).zip

uninstall: haxelib
haxelib remove chrome-extension
uninstall:
haxelib remove $(PROJECT)

clean:
rm -f chrome-extension.zip haxedoc.xml
rm -f $(PROJECT).zip haxedoc.xml
rm -rf doc/

.PHONY: install uninstall clean
.PHONY: all documentation install uninstall clean

9 changes: 6 additions & 3 deletions README.md
@@ -1,8 +1,11 @@
CHROME-EXTENSION
================
Haxe/Javascript type definitions for the google chrome extension api.
http://code.google.com/chrome/extensions
https://developer.chrome.com/extensions/api_index

API version: 33
API version: 35

For packaged apps type definitions see: https://github.com/tong/chrome.app
For packaged apps types see: https://github.com/tong/chrome.app
For using types available on chrome-os only set: -D chrome_os
For using dev channel apis set: -D chrome_dev
For using experimental apis set: -D chrome_experimental
7 changes: 4 additions & 3 deletions chrome/Alarms.hx
Expand Up @@ -7,17 +7,18 @@ typedef Alarm = {
}

typedef AlarmCreateInfo = {
@:optional var when : Float;
@:optional var delayInMinutes : Float;
@:optional var periodInMinutes : Float;
@:optional var when : Float;
}

@:require(chrome)
@:native("chrome.alarms")
extern class Alarms {
static function create( ?name : String, alarmInfo : AlarmCreateInfo ) : Void;
static function get( ?name : String, f : Alarm->Void ) : Void;
static function getAll( f : Array<Alarm>->Void ) : Void;
static function clear( ?name : String ) : Void;
static function clearAll() : Void;
static function clear( ?name : String, ?f : Bool->Void ) : Void;
static function clearAll( ?f : Bool->Void ) : Void;
static var onAlarm(default,null) : Event<Alarm->Void>;
}
78 changes: 43 additions & 35 deletions chrome/Bookmarks.hx
Expand Up @@ -2,70 +2,78 @@ package chrome;

typedef BookmarkTreeNode = {
var id : String;
var parentId : Null<String>;
var index : Null<Int>;
var url : Null<String>;
@:optional var parentId : Null<String>;
@:optional var index : Int;
@:optional var url : String;
var title : String;
var dateAdded : Null<Float>;
var dateGroupModified : Null<Float>;
var children : Null<Array<BookmarkTreeNode>>;
@:optional var dateAdded : Float;
@:optional var dateGroupModified : Float;
@:optional var children : Array<BookmarkTreeNode>;
}

typedef BookmarkDestination = {
var parentId : String;
var index : Null<Int>;
@:optional var parentId : String;
@:optional var index : Null<Int>;
}

private typedef BookmarkChanges = {
var title : Null<String>;
var url : Null<String>;
typedef BookmarkChanges = {
@:optional var title : String;
@:optional var url : String;
}

private typedef BookmarkChangeInfo = {
typedef BookmarkChangeInfo = {
var title : String;
var url : Null<String>;
@:optional var url : Null<String>;
}

typedef Bookmark = { >BookmarkDestination,
var title : Null<String>;
var url : Null<String>;
typedef Bookmark = {
@:optional var parentId : String;
@:optional var index : Int;
@:optional var title : String;
@:optional var url : String;
}

private typedef BookmarkReorderInfo = {
typedef BookmarkReorderInfo = {
var childIds : Array<String>;
}

private typedef BookmarkMoveInfo = {
typedef BookmarkMoveInfo = {
var parentId : String;
var index : Int;
var oldParentId : Int;
var oldIndex : Int;
}

private typedef BookmarkRemoveInfo = {
typedef BookmarkRemoveInfo = {
var parentId : String;
var index : Int;
}

@:require(chrome)
@:require(chrome_ext)
@:native("chrome.bookmarks")
extern class Bookmarks {
static function create( bookmark : Bookmark, ?cb : BookmarkTreeNode->Void ) : Void;
@:overload(function( ?idList:Array<String>, cb:Array<BookmarkTreeNode>->Void ) : Void {} )
static function get( id : String, cb : Array<BookmarkTreeNode>->Void ) : Void;
static function getChildren( id : String, cb : Array<BookmarkTreeNode>->Void ) : Void;
static function getRecent( numberOfItems : Int, cb : Array<BookmarkTreeNode>->Void ) : Void;
static function getTree( cb : Array<BookmarkTreeNode>->Void ) : Void;
static function getSubTree( id : String, cb : Array<BookmarkTreeNode>->Void ) : Void;
static function move( id : String, destination : BookmarkDestination, ?cb : BookmarkTreeNode->Void ) : Void;
static function remove( id : String, ?cb : Void->Void ) : Void;
static function search( query : String, cb : Array<BookmarkTreeNode>->Void ) : Void;
static function update( id : String, changes : BookmarkChanges, ?cb : Array<BookmarkTreeNode>->Void ) : Void;

static var MAX_WRITE_OPERATIONS_PER_HOUR(default,null) : Int;
static var MAX_SUSTAINED_WRITE_OPERATIONS_PER_MINUTE(default,null) : Int;

@:overload(function( ?idList:Array<String>, f : Array<BookmarkTreeNode>->Void ) : Void {} )
static function get( id : String, f : Array<BookmarkTreeNode>->Void ) : Void;
static function getChildren( id : String, f : Array<BookmarkTreeNode>->Void ) : Void;
static function getRecent( numberOfItems : Int, f : Array<BookmarkTreeNode>->Void ) : Void;
static function getTree( f : Array<BookmarkTreeNode>->Void ) : Void;
static function getSubTree( id : String, f : Array<BookmarkTreeNode>->Void ) : Void;
static function search( query : String, f : Array<BookmarkTreeNode>->Void ) : Void;
static function create( bookmark : Bookmark, ?f : BookmarkTreeNode->Void ) : Void;
static function move( id : String, destination : BookmarkDestination, ?f : BookmarkTreeNode->Void ) : Void;
static function update( id : String, changes : BookmarkChanges, ?f : Array<BookmarkTreeNode>->Void ) : Void;
static function remove( id : String, ?f : Void->Void ) : Void;
static function removeTree( id : String, ?f : Void->Void ) : Void;

static var onCreated(default,null) : Event<String->BookmarkTreeNode->Void>;
static var onRemoved(default,null) : Event<String->BookmarkRemoveInfo->Void>;
static var onChanged(default,null) : Event<String->BookmarkChangeInfo->Void>;
static var onMoved(default,null) : Event<String->BookmarkMoveInfo->Void>;
static var onChildrenReordered(default,null) : Event<String->BookmarkReorderInfo->Void>;
static var onCreated(default,null) : Event<String->BookmarkTreeNode->Void>;
static var onImportBegan(default,null) : Event<Void->Void>;
static var onImportEnded(default,null) : Event<Void->Void>;
static var onMoved(default,null) : Event<String->BookmarkMoveInfo->Void>;
static var onRemoved(default,null) : Event<String->Dynamic->Void>;
static var onImportBegan(default,null) : Event<Void->Void>;
}
19 changes: 10 additions & 9 deletions chrome/BrowserAction.hx
@@ -1,20 +1,21 @@
package chrome;

@:require(chrome)
typedef ColorArray = Array<Int>;
private typedef ImageDataType = Dynamic; //TODO

@:require(chrome_ext)
@:native("chrome.browserAction")
extern class BrowserAction {

static function setTitle( details : { title : String, ?tabId : Int } ) : Void;
static function getTitle( details : { ?tabId : Int }, cb : String->Void ) : Void;
static function setIcon( details : { ?imageData : Dynamic, ?path : String, ?tabId : Int }, ?cb : Void->Void ) : Void; // ?imageData : ImageData
static function getTitle( details : { ?tabId : Int }, f : String->Void ) : Void;
static function setIcon( details : { ?imageData : ImageDataType, ?path : Dynamic, ?tabId : Int }, ?f : Void->Void ) : Void;
static function setPopup( details : { ?tabId : Int, popup : String } ) : Void;
static function getPopup( details : { ?tabId : Int }, cb : String->Void ) : Void;
static function getPopup( details : { ?tabId : Int }, f : String->Void ) : Void;
static function setBadgeText( details : { text : String, ?tabId : Int } ) : Void;
static function getBadgeText( details : { ?tabId : Int }, cb : String->Void ) : Void;
static function setBadgeBackgroundColor( details : { color : Array<Int>, ?tabId : Int } ) : Void;
static function getBadgeBackgroundColor( details : { ?tabId : Int }, cb : Array<Int>->Void ) : Void;
static function getBadgeText( details : { ?tabId : Int }, f : String->Void ) : Void;
static function setBadgeBackgroundColor( details : { color : ColorArray, ?tabId : Int } ) : Void;
static function getBadgeBackgroundColor( details : { ?tabId : Int }, f : ColorArray->Void ) : Void;
static function enable( ?tabId : Int ) : Void;
static function disable( ?tabId : Int ) : Void;

static var onClicked(default,null) : Event<Tab->Void>;
}
31 changes: 16 additions & 15 deletions chrome/BrowsingData.hx
@@ -1,6 +1,6 @@
package chrome;

private typedef OriginTypes = {
typedef OriginTypes = {
@:optional var unprotectedWeb : Bool;
@:optional var protectedWeb : Bool;
@:optional var extension : Bool;
Expand All @@ -11,7 +11,7 @@ typedef RemovalOptions = {
var originTypes : OriginTypes;
}

typedef DataToRemove = {
typedef DataTypeSet = {
@:optional var appcache : Bool;
@:optional var cache : Bool;
@:optional var cookies : Bool;
Expand All @@ -30,17 +30,18 @@ typedef DataToRemove = {
@:require(chrome_ext)
@:native("chrome.browsingData")
extern class BrowsingData {
static function remove( options : RemovalOptions, dataToRemove : DataToRemove, ?cb : Void->Void ) : Void;
static function removeAppcache( options : RemovalOptions, ?cb : Void->Void ) : Void;
static function removeCache( options : RemovalOptions, ?cb : Void->Void ) : Void;
static function removeCookies( options : RemovalOptions, ?cb : Void->Void ) : Void;
static function removeDownloads( options : RemovalOptions, ?cb : Void->Void ) : Void;
static function removeFileSystems( options : RemovalOptions, ?cb : Void->Void ) : Void;
static function removeFormData( options : RemovalOptions, ?cb : Void->Void ) : Void;
static function removeHistory( options : RemovalOptions, ?cb : Void->Void ) : Void;
static function removeIndexedDB( options : RemovalOptions, ?cb : Void->Void ) : Void;
static function removeLocalStorage( options : RemovalOptions, ?cb : Void->Void ) : Void;
static function removePasswords( options : RemovalOptions, ?cb : Void->Void ) : Void;
static function removePluginData( options : RemovalOptions, ?cb : Void->Void ) : Void;
static function removeWebSQL( options : RemovalOptions, ?cb : Void->Void ) : Void;
static function settings( f : {options:RemovalOptions,dataToRemove:DataTypeSet,dataRemovalPermitted:DataTypeSet}->Void ) : Void;
static function remove( options : RemovalOptions, dataToRemove : DataTypeSet, ?f : Void->Void ) : Void;
static function removeAppcache( options : RemovalOptions, ?f : Void->Void ) : Void;
static function removeCache( options : RemovalOptions, ?f : Void->Void ) : Void;
static function removeCookies( options : RemovalOptions, ?f : Void->Void ) : Void;
static function removeDownloads( options : RemovalOptions, ?f : Void->Void ) : Void;
static function removeFileSystems( options : RemovalOptions, ?f : Void->Void ) : Void;
static function removeFormData( options : RemovalOptions, ?f : Void->Void ) : Void;
static function removeHistory( options : RemovalOptions, ?f : Void->Void ) : Void;
static function removeIndexedDB( options : RemovalOptions, ?f : Void->Void ) : Void;
static function removeLocalStorage( options : RemovalOptions, ?f : Void->Void ) : Void;
static function removePluginData( options : RemovalOptions, ?f : Void->Void ) : Void;
static function removePasswords( options : RemovalOptions, ?f : Void->Void ) : Void;
static function removeWebSQL( options : RemovalOptions, ?f : Void->Void ) : Void;
}
4 changes: 2 additions & 2 deletions chrome/Commands.hx
Expand Up @@ -6,9 +6,9 @@ typedef Command = {
@:optional var shortcut : String;
}

@:require(chrome_ext)
@:require(chrome)
@:native("chrome.commands")
extern class Commands {
static function getAll( ?cb : Array<Command>->Void ) : Void;
static function getAll( ?f : Array<Command>->Void ) : Void;
static var onCommand(default,null) : Event<String->Void>;
}
49 changes: 18 additions & 31 deletions chrome/ContentSetting.hx
Expand Up @@ -2,40 +2,27 @@ package chrome;

typedef ResourceIdentifier = {
var id : String;
var description : Null<String>;
@:optional var description : String;
}

@:enum abstract Scope(String) {
var regular = "regular";
var incognito_session_only = "incognito_session_only";
}

@:require(chrome_ext)
typedef ContentSetting = {

function clear(
details : { ?scope : String },
?cb : Void->Void
) : Void;

function get(
details : {
primaryUrl : String,
?secondaryUrl : String,
?resourceIdentifier : { id : String, ?description : String },
?incognito : Bool
},
?cb : Void->Void
) : Void;

function getResourceIdentifiers(
cb : Array<ResourceIdentifier>->Void
) : Void;
@:native("chrome.contentSetting")
extern class ContentSetting {

function set(
details : {
primaryPattern : String,
?secondaryPattern : String,
?resourceIdentifier : ResourceIdentifier,
setting : Dynamic,
?scope : String
},
?cb : Void->Void
) : Void;
static var cookies(default,never) : String;
static var images(default,never) : String;
static var javascript(default,never) : String;
static var plugins(default,never) : String;
static var popups(default,never) : String;
static var notifications(default,never) : String;

static function clear( details : { ?scope : Scope }, ?f : Void->Void ) : Void;
static function get( details : { primaryUrl : String, secondaryUrl : String, ?resourceIdentifier : ResourceIdentifier, ?incognito : Bool }, f : Dynamic->Void ) : Void;
static function set( details : { primaryPattern : String, secondaryPattern : String, ?resourceIdentifier : ResourceIdentifier, setting : Dynamic, ?scope : Scope }, f : Dynamic->Void ) : Void;
static function getResourceIdentifiers( f : Array<ResourceIdentifier>->Void ) : Void;
}
12 changes: 0 additions & 12 deletions chrome/ContentSettings.hx

This file was deleted.

0 comments on commit d88b092

Please sign in to comment.