[Print Preview]: Added code to support pdf fit to page functionality.

BUG=85132
TEST=none


Review URL: https://chromiumcodereview.appspot.com/10083060

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@137498 0039d316-1c4b-4281-b951-d872f2087c98
void PrintPreviewDataSource::StartDataRequest(const std::string& path,
                                              bool is_incognito,
                                              int request_id) {
  if (!EndsWith(path, "/print.pdf", true)) {
    ChromeWebUIDataSource::StartDataRequest(path, is_incognito, request_id);
    return;
  }

  scoped_refptr<base::RefCountedBytes> data;
  std::vector<std::string> url_substr;
  base::SplitString(path, '/', &url_substr);
  int page_index = 0;
  if (url_substr.size() == 3 && base::StringToInt(url_substr[1], &page_index)) {
    PrintPreviewDataService::GetInstance()->GetDataEntry(
        url_substr[0], page_index, &data);
  }
  if (data.get()) {
    SendResponse(request_id, data);
    return;
  }
  scoped_refptr<base::RefCountedBytes> empty_bytes(new base::RefCountedBytes);
  SendResponse(request_id, empty_bytes);
}

void PrintPreviewDataSource::StartDataRequest(const std::string& path,
                                              bool is_incognito,
                                              int request_id) {
  if (!EndsWith(path, "/print.pdf", true)) {
    ChromeWebUIDataSource::StartDataRequest(path, is_incognito, request_id);
    return;
  }

  scoped_refptr<base::RefCountedBytes> data;
  std::vector<std::string> url_substr;
  base::SplitString(path, '/', &url_substr);
  int page_index = 0;
  if (url_substr.size() == 3 && base::StringToInt(url_substr[1], &page_index)) {
    PrintPreviewDataService::GetInstance()->GetDataEntry(
        url_substr[0], page_index, &data);
  }
  if (data.get()) {
    SendResponse(request_id, data);
    return;
  }
  scoped_refptr<base::RefCountedBytes> empty_bytes(new base::RefCountedBytes);
  SendResponse(request_id, empty_bytes);
}
