Improve WebResponse::setcookie

Various bits of code are not using this because it doesn't support
various use cases, e.g. session cookies, httpOnly, custom paths, etc.

Refactor it to add all those options. Also add a hook so extensions can
override the setting of the cookie.

Change-Id: Ia0c424a48d9455a8574d91631cde0f00c9882288
Merge "Improve WebResponse::setcookie"