How can I get call the “full page screenshot” function in develop tool when writing a chrome extend?

I am writing a chrome extend and need to screenshot the full page using javascript. I find that chrome has already offered powerful screenshot function in its development tool:

Just open the develop tool, use command+shift+p to run “capture full size screenshot” command.(my reputation is not enough for posting images here, sorry for that)

Anyone know how can I call that function?