Implement CefDialogHandler based on #342

PR based on #342 apply polish before final merge review.