public void Initialize(IBrowser browser, HttpResponseMessage response, HttpResult result)
{
if (browser == null)
{
throw new ArgumentNullException("browser");
}
if (response == null)
{
throw new ArgumentNullException("response");
}
if (result == null)
{
throw new ArgumentNullException("result");
}
// Look at the content type header to determine the correct type of page to return
var mediaType = DetermineMediaType(response);
var contentType = browser.ContentTypeResolver.DeterminePageType(mediaType);
if (contentType == PageContentType.Html)
{
_resolvedPage = new DynamicHtmlPage();
}
else if (contentType == PageContentType.Binary)
{
_resolvedPage = new BinaryPageWrapper();
}
else
{
_resolvedPage = new TextPageWrapper();
}
ResolvedPage.Initialize(browser, response, result);
}