2017-01-24 15:09:23 +00:00
// Package applicationcache provides the Chrome Debugging Protocol
// commands, types, and events for the Chrome ApplicationCache domain.
//
// Generated by the chromedp-gen command.
package applicationcache
// AUTOGENERATED. DO NOT EDIT.
import (
"context"
2017-01-26 07:28:34 +00:00
cdp "github.com/knq/chromedp/cdp"
2017-01-24 15:09:23 +00:00
"github.com/mailru/easyjson"
)
// GetFramesWithManifestsParams returns array of frame identifiers with
// manifest urls for each frame containing a document associated with some
// application cache.
type GetFramesWithManifestsParams struct { }
// GetFramesWithManifests returns array of frame identifiers with manifest
// urls for each frame containing a document associated with some application
// cache.
func GetFramesWithManifests ( ) * GetFramesWithManifestsParams {
return & GetFramesWithManifestsParams { }
}
// GetFramesWithManifestsReturns return values.
type GetFramesWithManifestsReturns struct {
FrameIds [ ] * FrameWithManifest ` json:"frameIds,omitempty" ` // Array of frame identifiers with manifest urls for each frame containing a document associated with some application cache.
}
// Do executes ApplicationCache.getFramesWithManifests.
//
// returns:
// frameIds - Array of frame identifiers with manifest urls for each frame containing a document associated with some application cache.
2017-01-26 07:28:34 +00:00
func ( p * GetFramesWithManifestsParams ) Do ( ctxt context . Context , h cdp . FrameHandler ) ( frameIds [ ] * FrameWithManifest , err error ) {
2017-01-24 15:09:23 +00:00
if ctxt == nil {
ctxt = context . Background ( )
}
// execute
2017-01-26 07:28:34 +00:00
ch := h . Execute ( ctxt , cdp . CommandApplicationCacheGetFramesWithManifests , cdp . Empty )
2017-01-24 15:09:23 +00:00
// read response
select {
case res := <- ch :
if res == nil {
2017-01-26 07:28:34 +00:00
return nil , cdp . ErrChannelClosed
2017-01-24 15:09:23 +00:00
}
switch v := res . ( type ) {
case easyjson . RawMessage :
// unmarshal
var r GetFramesWithManifestsReturns
err = easyjson . Unmarshal ( v , & r )
if err != nil {
2017-01-26 07:28:34 +00:00
return nil , cdp . ErrInvalidResult
2017-01-24 15:09:23 +00:00
}
return r . FrameIds , nil
case error :
return nil , v
}
case <- ctxt . Done ( ) :
2017-01-26 07:28:34 +00:00
return nil , cdp . ErrContextDone
2017-01-24 15:09:23 +00:00
}
2017-01-26 07:28:34 +00:00
return nil , cdp . ErrUnknownResult
2017-01-24 15:09:23 +00:00
}
// EnableParams enables application cache domain notifications.
type EnableParams struct { }
// Enable enables application cache domain notifications.
func Enable ( ) * EnableParams {
return & EnableParams { }
}
// Do executes ApplicationCache.enable.
2017-01-26 07:28:34 +00:00
func ( p * EnableParams ) Do ( ctxt context . Context , h cdp . FrameHandler ) ( err error ) {
2017-01-24 15:09:23 +00:00
if ctxt == nil {
ctxt = context . Background ( )
}
// execute
2017-01-26 07:28:34 +00:00
ch := h . Execute ( ctxt , cdp . CommandApplicationCacheEnable , cdp . Empty )
2017-01-24 15:09:23 +00:00
// read response
select {
case res := <- ch :
if res == nil {
2017-01-26 07:28:34 +00:00
return cdp . ErrChannelClosed
2017-01-24 15:09:23 +00:00
}
switch v := res . ( type ) {
case easyjson . RawMessage :
return nil
case error :
return v
}
case <- ctxt . Done ( ) :
2017-01-26 07:28:34 +00:00
return cdp . ErrContextDone
2017-01-24 15:09:23 +00:00
}
2017-01-26 07:28:34 +00:00
return cdp . ErrUnknownResult
2017-01-24 15:09:23 +00:00
}
// GetManifestForFrameParams returns manifest URL for document in the given
// frame.
type GetManifestForFrameParams struct {
2017-01-26 07:28:34 +00:00
FrameID cdp . FrameID ` json:"frameId" ` // Identifier of the frame containing document whose manifest is retrieved.
2017-01-24 15:09:23 +00:00
}
// GetManifestForFrame returns manifest URL for document in the given frame.
//
// parameters:
2017-01-26 07:28:34 +00:00
// frameID - Identifier of the frame containing document whose manifest is retrieved.
func GetManifestForFrame ( frameID cdp . FrameID ) * GetManifestForFrameParams {
2017-01-24 15:09:23 +00:00
return & GetManifestForFrameParams {
2017-01-26 07:28:34 +00:00
FrameID : frameID ,
2017-01-24 15:09:23 +00:00
}
}
// GetManifestForFrameReturns return values.
type GetManifestForFrameReturns struct {
ManifestURL string ` json:"manifestURL,omitempty" ` // Manifest URL for document in the given frame.
}
// Do executes ApplicationCache.getManifestForFrame.
//
// returns:
// manifestURL - Manifest URL for document in the given frame.
2017-01-26 07:28:34 +00:00
func ( p * GetManifestForFrameParams ) Do ( ctxt context . Context , h cdp . FrameHandler ) ( manifestURL string , err error ) {
2017-01-24 15:09:23 +00:00
if ctxt == nil {
ctxt = context . Background ( )
}
// marshal
buf , err := easyjson . Marshal ( p )
if err != nil {
return "" , err
}
// execute
2017-01-26 07:28:34 +00:00
ch := h . Execute ( ctxt , cdp . CommandApplicationCacheGetManifestForFrame , easyjson . RawMessage ( buf ) )
2017-01-24 15:09:23 +00:00
// read response
select {
case res := <- ch :
if res == nil {
2017-01-26 07:28:34 +00:00
return "" , cdp . ErrChannelClosed
2017-01-24 15:09:23 +00:00
}
switch v := res . ( type ) {
case easyjson . RawMessage :
// unmarshal
var r GetManifestForFrameReturns
err = easyjson . Unmarshal ( v , & r )
if err != nil {
2017-01-26 07:28:34 +00:00
return "" , cdp . ErrInvalidResult
2017-01-24 15:09:23 +00:00
}
return r . ManifestURL , nil
case error :
return "" , v
}
case <- ctxt . Done ( ) :
2017-01-26 07:28:34 +00:00
return "" , cdp . ErrContextDone
2017-01-24 15:09:23 +00:00
}
2017-01-26 07:28:34 +00:00
return "" , cdp . ErrUnknownResult
2017-01-24 15:09:23 +00:00
}
// GetApplicationCacheForFrameParams returns relevant application cache data
// for the document in given frame.
type GetApplicationCacheForFrameParams struct {
2017-01-26 07:28:34 +00:00
FrameID cdp . FrameID ` json:"frameId" ` // Identifier of the frame containing document whose application cache is retrieved.
2017-01-24 15:09:23 +00:00
}
// GetApplicationCacheForFrame returns relevant application cache data for
// the document in given frame.
//
// parameters:
2017-01-26 07:28:34 +00:00
// frameID - Identifier of the frame containing document whose application cache is retrieved.
func GetApplicationCacheForFrame ( frameID cdp . FrameID ) * GetApplicationCacheForFrameParams {
2017-01-24 15:09:23 +00:00
return & GetApplicationCacheForFrameParams {
2017-01-26 07:28:34 +00:00
FrameID : frameID ,
2017-01-24 15:09:23 +00:00
}
}
// GetApplicationCacheForFrameReturns return values.
type GetApplicationCacheForFrameReturns struct {
ApplicationCache * ApplicationCache ` json:"applicationCache,omitempty" ` // Relevant application cache data for the document in given frame.
}
// Do executes ApplicationCache.getApplicationCacheForFrame.
//
// returns:
// applicationCache - Relevant application cache data for the document in given frame.
2017-01-26 07:28:34 +00:00
func ( p * GetApplicationCacheForFrameParams ) Do ( ctxt context . Context , h cdp . FrameHandler ) ( applicationCache * ApplicationCache , err error ) {
2017-01-24 15:09:23 +00:00
if ctxt == nil {
ctxt = context . Background ( )
}
// marshal
buf , err := easyjson . Marshal ( p )
if err != nil {
return nil , err
}
// execute
2017-01-26 07:28:34 +00:00
ch := h . Execute ( ctxt , cdp . CommandApplicationCacheGetApplicationCacheForFrame , easyjson . RawMessage ( buf ) )
2017-01-24 15:09:23 +00:00
// read response
select {
case res := <- ch :
if res == nil {
2017-01-26 07:28:34 +00:00
return nil , cdp . ErrChannelClosed
2017-01-24 15:09:23 +00:00
}
switch v := res . ( type ) {
case easyjson . RawMessage :
// unmarshal
var r GetApplicationCacheForFrameReturns
err = easyjson . Unmarshal ( v , & r )
if err != nil {
2017-01-26 07:28:34 +00:00
return nil , cdp . ErrInvalidResult
2017-01-24 15:09:23 +00:00
}
return r . ApplicationCache , nil
case error :
return nil , v
}
case <- ctxt . Done ( ) :
2017-01-26 07:28:34 +00:00
return nil , cdp . ErrContextDone
2017-01-24 15:09:23 +00:00
}
2017-01-26 07:28:34 +00:00
return nil , cdp . ErrUnknownResult
2017-01-24 15:09:23 +00:00
}