Merge commit '2772dfeec9cdb1744f6c010babef9e40b6770dd7' into plan-of-destroy-implicitAny

This commit is contained in:
vvakame
2013-10-18 12:41:53 +09:00
40 changed files with 11925 additions and 112 deletions

View File

@@ -0,0 +1,27 @@
/// <reference path="chrome-app.d.ts" />
import runtime = chrome.app.runtime;
import cwindow = chrome.app.window;
var createOptions: cwindow.CreateOptions = {
id: "My Window",
bounds: {
left: 0,
top: 0,
width: 640,
height: 480
},
resizable: true
};
//Create new window on app launch
chrome.app.runtime.onLaunched.addListener(function (launchData: runtime.LaunchData) {
chrome.app.window.create('app/url', createOptions, function (created_window: cwindow.AppWindow) {
return;
});
});
chrome.app.runtime.onRestarted.addListener(function () { return; });
// Get Current Window
var currentWindow: cwindow.AppWindow = chrome.app.window.current();

95
chrome/chrome-app.d.ts vendored Normal file
View File

@@ -0,0 +1,95 @@
// Type definitions for Chrome packaged application development.
// Project: http://developer.chrome.com/apps/
// Definitions by: Adam Lay <https://github.com/AdamLay>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
////////////////////
// App Runtime
////////////////////
declare module chrome.app.runtime {
interface LaunchData {
id?: string;
items?: LaunchDataItem[];
url?: string;
referrerUrl?: string;
isKioskSession?: boolean;
}
interface LaunchDataItem {
entry: File;
type: string;
}
interface LaunchedEvent {
addListener(callback: (launchData: LaunchData) => void);
}
interface RestartedEvent {
addListener(callback: () => void);
}
var onLaunched: LaunchedEvent;
var onRestarted: RestartedEvent;
}
////////////////////
// App Window
////////////////////
declare module chrome.app.window {
interface Bounds {
left?: number;
top?: number;
width?: number;
height?: number;
}
interface AppWindow {
focus: () => void;
fullscreen: () => void;
isFullscreen: () => boolean;
minimize: () => void;
isMinimized: () => boolean;
maximize: () => void;
isMaximized: () => boolean;
restore: () => void;
moveTo: (left: number, top: number) => void;
resizeTo: (width: number, height: number) => void;
drawAttention: () => void;
clearAttention: () => void;
close: () => void;
show: () => void;
hide: () => void;
getBounds: () => Bounds;
setBounds: (bounds: Bounds) => void;
contentWindow: Window;
}
interface CreateOptions {
id?: string;
minWidth?: number;
minHeight?: number;
maxWidth?: number;
maxHeight?: number;
frame?: string; // "none", "chrome"
bounds?: Bounds;
transparentBackground?: boolean;
state?: string; // "normal", "fullscreen", "maximized", "minimized"
hidden?: boolean;
resizable?: boolean;
singleton?: boolean;
}
export function create(url: string, options?: CreateOptions, callback?: (created_window: AppWindow) => void): void;
export function current(): AppWindow;
interface WindowEvent {
addListener(callback: () => void): void;
}
var onBoundsChanged: WindowEvent;
var onClosed: WindowEvent;
var onFullscreened: WindowEvent;
var onMaximized: WindowEvent;
var onMinimized: WindowEvent;
var onRestored: WindowEvent;
}

22
chrome/chrome.d.ts vendored
View File

@@ -1,4 +1,4 @@
// Type definitions for Chrome extension development.
// Type definitions for Chrome extension development.
// Project: http://developer.chrome.com/extensions/
// Definitions by: Matthew Kimber <https://github.com/matthewkimber>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
@@ -114,7 +114,7 @@ declare module chrome.bookmarks {
export function getSubTree(id: string, callback: (results: BookmarkTreeNode[]) => void): void;
export function removeTree(id: string, callback?: Function): void;
var onRemoved: chrome.alarms.AlarmEvent;
var onRemoved: BookmarkRemovedEvent;
var onImportEnded: BookmarkImportEndedEvent;
var onImportBegan: BookmarkImportBeganEvent;
var onChanged: BookmarkChangedEvent;
@@ -1056,6 +1056,15 @@ declare module chrome.history {
var onVisitRemoved: HistoryVisitRemovedEvent;
}
////////////////////
// Identity
////////////////////
declare module chrome.identity {
var getAuthToken: (options:any, cb:(token:{})=>void)=>void;
}
////////////////////
// Internationalization
////////////////////
@@ -1341,7 +1350,7 @@ declare module chrome.pageCapture {
tabId: number;
}
export function saveAsMHTML(details: SaveDetails, callback: (mhtmlData?: any) => void): void;
export function saveAsMHTML(details: SaveDetails, callback: (mhtmlData: any) => void): void;
}
////////////////////
@@ -1472,6 +1481,9 @@ declare module chrome.runtime {
interface RuntimeSuspendCanceledEvent extends chrome.events.Event {
addListener(callback: Function): void;
}
interface RuntimeMessageEvent extends chrome.events.Event {
addListener(callback: Function): void;
}
export function getBackgroundPage(callback: (backgroundPage?: Window) => void): void;
export function getManifest(): Object;
@@ -1481,6 +1493,10 @@ declare module chrome.runtime {
var onStartup: RuntimeStartupEvent;
var onInstalled: RuntimeInstalledEvent;
var onSuspendCanceled: RuntimeSuspendCanceledEvent;
var onMessage: RuntimeMessageEvent;
var onMessageExternal: RuntimeMessageEvent;
var sendMessage:(req:any, cb:(resp:any)=>void)=>void;
}
////////////////////