2017-01-24 15:09:23 +00:00
|
|
|
// Package deviceorientation provides the Chrome Debugging Protocol
|
2017-02-12 04:59:33 +00:00
|
|
|
// commands, types, and events for the DeviceOrientation domain.
|
2017-01-24 15:09:23 +00:00
|
|
|
//
|
|
|
|
// Generated by the chromedp-gen command.
|
|
|
|
package deviceorientation
|
|
|
|
|
|
|
|
// 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"
|
|
|
|
)
|
|
|
|
|
|
|
|
// SetDeviceOrientationOverrideParams overrides the Device Orientation.
|
|
|
|
type SetDeviceOrientationOverrideParams struct {
|
|
|
|
Alpha float64 `json:"alpha"` // Mock alpha
|
|
|
|
Beta float64 `json:"beta"` // Mock beta
|
|
|
|
Gamma float64 `json:"gamma"` // Mock gamma
|
|
|
|
}
|
|
|
|
|
|
|
|
// SetDeviceOrientationOverride overrides the Device Orientation.
|
|
|
|
//
|
|
|
|
// parameters:
|
|
|
|
// alpha - Mock alpha
|
|
|
|
// beta - Mock beta
|
|
|
|
// gamma - Mock gamma
|
|
|
|
func SetDeviceOrientationOverride(alpha float64, beta float64, gamma float64) *SetDeviceOrientationOverrideParams {
|
|
|
|
return &SetDeviceOrientationOverrideParams{
|
|
|
|
Alpha: alpha,
|
|
|
|
Beta: beta,
|
|
|
|
Gamma: gamma,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-02-12 04:59:33 +00:00
|
|
|
// Do executes DeviceOrientation.setDeviceOrientationOverride against the provided context and
|
|
|
|
// target handler.
|
|
|
|
func (p *SetDeviceOrientationOverrideParams) Do(ctxt context.Context, h cdp.Handler) (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.CommandDeviceOrientationSetDeviceOrientationOverride, 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:
|
|
|
|
return nil
|
|
|
|
|
|
|
|
case error:
|
|
|
|
return v
|
|
|
|
}
|
|
|
|
|
|
|
|
case <-ctxt.Done():
|
2017-02-12 04:59:33 +00:00
|
|
|
return ctxt.Err()
|
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
|
|
|
}
|
|
|
|
|
|
|
|
// ClearDeviceOrientationOverrideParams clears the overridden Device
|
|
|
|
// Orientation.
|
|
|
|
type ClearDeviceOrientationOverrideParams struct{}
|
|
|
|
|
|
|
|
// ClearDeviceOrientationOverride clears the overridden Device Orientation.
|
|
|
|
func ClearDeviceOrientationOverride() *ClearDeviceOrientationOverrideParams {
|
|
|
|
return &ClearDeviceOrientationOverrideParams{}
|
|
|
|
}
|
|
|
|
|
2017-02-12 04:59:33 +00:00
|
|
|
// Do executes DeviceOrientation.clearDeviceOrientationOverride against the provided context and
|
|
|
|
// target handler.
|
|
|
|
func (p *ClearDeviceOrientationOverrideParams) Do(ctxt context.Context, h cdp.Handler) (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.CommandDeviceOrientationClearDeviceOrientationOverride, 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-02-12 04:59:33 +00:00
|
|
|
return ctxt.Err()
|
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
|
|
|
}
|