summaryrefslogtreecommitdiffstats
path: root/chrome/utility
diff options
context:
space:
mode:
authorgene@chromium.org <gene@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-10-06 21:39:26 +0000
committergene@chromium.org <gene@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-10-06 21:39:26 +0000
commitda00dc1867fb2c4e51b4f4dbaa5796a748eaf120 (patch)
tree749d03dd0e92b71b2cfc0b2901307d4ea697372c /chrome/utility
parent98dd0af88597069ac8ff99287e9abe77e3236be3 (diff)
downloadchromium_src-da00dc1867fb2c4e51b4f4dbaa5796a748eaf120.zip
chromium_src-da00dc1867fb2c4e51b4f4dbaa5796a748eaf120.tar.gz
chromium_src-da00dc1867fb2c4e51b4f4dbaa5796a748eaf120.tar.bz2
Added autorotate flag in PDF rendering and wiring it through service-utility channel.
Review URL: http://codereview.chromium.org/8146004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@104371 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/utility')
-rw-r--r--chrome/utility/chrome_content_utility_client.cc15
-rw-r--r--chrome/utility/chrome_content_utility_client.h5
2 files changed, 12 insertions, 8 deletions
diff --git a/chrome/utility/chrome_content_utility_client.cc b/chrome/utility/chrome_content_utility_client.cc
index a939f82..39c3dd7 100644
--- a/chrome/utility/chrome_content_utility_client.cc
+++ b/chrome/utility/chrome_content_utility_client.cc
@@ -171,16 +171,16 @@ void ChromeContentUtilityClient::OnDecodeImageBase64(
void ChromeContentUtilityClient::OnRenderPDFPagesToMetafile(
base::PlatformFile pdf_file,
const FilePath& metafile_path,
- const gfx::Rect& render_area,
- int render_dpi,
+ const printing::PdfRenderSettings& pdf_render_settings,
const std::vector<printing::PageRange>& page_ranges) {
bool succeeded = false;
#if defined(OS_WIN)
int highest_rendered_page_number = 0;
succeeded = RenderPDFToWinMetafile(pdf_file,
metafile_path,
- render_area,
- render_dpi,
+ pdf_render_settings.area(),
+ pdf_render_settings.dpi(),
+ pdf_render_settings.autorotate(),
page_ranges,
&highest_rendered_page_number);
if (succeeded) {
@@ -200,7 +200,8 @@ typedef bool (*RenderPDFPageToDCProc)(
const unsigned char* pdf_buffer, int buffer_size, int page_number, HDC dc,
int dpi_x, int dpi_y, int bounds_origin_x, int bounds_origin_y,
int bounds_width, int bounds_height, bool fit_to_bounds,
- bool stretch_to_bounds, bool keep_aspect_ratio, bool center_in_bounds);
+ bool stretch_to_bounds, bool keep_aspect_ratio, bool center_in_bounds,
+ bool autorotate);
typedef bool (*GetPDFDocInfoProc)(const unsigned char* pdf_buffer,
int buffer_size, int* page_count,
@@ -249,6 +250,7 @@ bool ChromeContentUtilityClient::RenderPDFToWinMetafile(
const FilePath& metafile_path,
const gfx::Rect& render_area,
int render_dpi,
+ bool autorotate,
const std::vector<printing::PageRange>& page_ranges,
int* highest_rendered_page_number) {
*highest_rendered_page_number = -1;
@@ -323,7 +325,8 @@ bool ChromeContentUtilityClient::RenderPDFToWinMetafile(
if (render_proc(&buffer.front(), buffer.size(), page_number,
metafile.context(), render_dpi, render_dpi,
render_area.x(), render_area.y(), render_area.width(),
- render_area.height(), true, false, true, true))
+ render_area.height(), true, false, true, true,
+ autorotate))
if (*highest_rendered_page_number < page_number)
*highest_rendered_page_number = page_number;
ret = true;
diff --git a/chrome/utility/chrome_content_utility_client.h b/chrome/utility/chrome_content_utility_client.h
index b1ef6c3..005fd5e 100644
--- a/chrome/utility/chrome_content_utility_client.h
+++ b/chrome/utility/chrome_content_utility_client.h
@@ -11,6 +11,7 @@
#include "base/memory/scoped_ptr.h"
#include "base/platform_file.h"
#include "content/utility/content_utility_client.h"
+#include "printing/pdf_render_settings.h"
class ExternalProcessImporterBridge;
class FilePath;
@@ -55,8 +56,7 @@ class ChromeContentUtilityClient : public content::ContentUtilityClient {
void OnRenderPDFPagesToMetafile(
base::PlatformFile pdf_file,
const FilePath& metafile_path,
- const gfx::Rect& render_area,
- int render_dpi,
+ const printing::PdfRenderSettings& pdf_render_settings,
const std::vector<printing::PageRange>& page_ranges);
void OnParseJSON(const std::string& json);
@@ -68,6 +68,7 @@ class ChromeContentUtilityClient : public content::ContentUtilityClient {
const FilePath& metafile_path,
const gfx::Rect& render_area,
int render_dpi,
+ bool autorotate,
const std::vector<printing::PageRange>& page_ranges,
int* highest_rendered_page_number);
#endif // defined(OS_WIN)