summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsverrir@google.com <sverrir@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-07 21:31:39 +0000
committersverrir@google.com <sverrir@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-07 21:31:39 +0000
commit8ff1d42631e79e842669dc3051d91ed7db80f1dc (patch)
tree55c1987549e982bfbf60a33fad3b60b5113d7864
parent395f9295b3e370746846dbe6073a0d43ab7e4af5 (diff)
downloadchromium_src-8ff1d42631e79e842669dc3051d91ed7db80f1dc.zip
chromium_src-8ff1d42631e79e842669dc3051d91ed7db80f1dc.tar.gz
chromium_src-8ff1d42631e79e842669dc3051d91ed7db80f1dc.tar.bz2
Move printing related stuff to the root printing project from the browser project. This simplifies further refactoring and eases understanding of the printing part of Chrome.
Also renamed win_printing_context to printing_context_win (correct naming convention) and added stub implementations for _linux and mac. Now all but one file is compiling on all platforms. TEST=none (no functional change). BUG=none Review URL: http://codereview.chromium.org/149212 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@20086 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/browser_main.cc2
-rw-r--r--chrome/browser/printing/print_job.cc4
-rw-r--r--chrome/browser/printing/print_job_manager.cc4
-rw-r--r--chrome/browser/printing/print_job_unittest.cc2
-rw-r--r--chrome/browser/printing/print_job_worker.cc4
-rw-r--r--chrome/browser/printing/print_job_worker.h4
-rw-r--r--chrome/browser/printing/print_job_worker_owner.h2
-rw-r--r--chrome/browser/printing/print_view_manager.cc2
-rw-r--r--chrome/browser/printing/print_view_manager.h2
-rw-r--r--chrome/browser/printing/printing_layout_uitest.cc2
-rw-r--r--chrome/browser/renderer_host/resource_message_filter.cc25
-rw-r--r--chrome/chrome.gyp27
-rw-r--r--printing/DEPS3
-rw-r--r--printing/emf_win.h6
-rw-r--r--printing/emf_win_unittest.cc2
-rw-r--r--printing/native_metafile.h10
-rw-r--r--printing/page_number.cc (renamed from chrome/browser/printing/page_number.cc)4
-rw-r--r--printing/page_number.h (renamed from chrome/browser/printing/page_number.h)8
-rw-r--r--printing/page_number_unittest.cc (renamed from chrome/browser/printing/page_number_unittest.cc)4
-rw-r--r--printing/page_overlays.cc (renamed from chrome/browser/printing/page_overlays.cc)6
-rw-r--r--printing/page_overlays.h (renamed from chrome/browser/printing/page_overlays.h)6
-rw-r--r--printing/page_overlays_unittest.cc (renamed from chrome/browser/printing/page_overlays_unittest.cc)13
-rw-r--r--printing/page_range.cc (renamed from chrome/browser/printing/page_range.cc)2
-rw-r--r--printing/page_range.h (renamed from chrome/browser/printing/page_range.h)6
-rw-r--r--printing/page_range_unittest.cc (renamed from chrome/browser/printing/page_range_unittest.cc)2
-rw-r--r--printing/page_setup.cc (renamed from chrome/browser/printing/page_setup.cc)2
-rw-r--r--printing/page_setup.h (renamed from chrome/browser/printing/page_setup.h)6
-rw-r--r--printing/page_setup_unittest.cc (renamed from chrome/browser/printing/page_setup_unittest.cc)2
-rw-r--r--printing/print_settings.cc (renamed from chrome/browser/printing/print_settings.cc)19
-rw-r--r--printing/print_settings.h (renamed from chrome/browser/printing/print_settings.h)17
-rw-r--r--printing/printed_document.cc (renamed from chrome/browser/printing/printed_document.cc)10
-rw-r--r--printing/printed_document.h (renamed from chrome/browser/printing/printed_document.h)12
-rw-r--r--printing/printed_page.cc (renamed from chrome/browser/printing/printed_page.cc)2
-rw-r--r--printing/printed_page.h (renamed from chrome/browser/printing/printed_page.h)6
-rw-r--r--printing/printed_pages_source.h (renamed from chrome/browser/printing/printed_pages_source.h)6
-rw-r--r--printing/printing.gyp50
-rw-r--r--printing/printing_context.h (renamed from chrome/browser/printing/win_printing_context.h)23
-rw-r--r--printing/printing_context_linux.cc117
-rw-r--r--printing/printing_context_mac.cc117
-rw-r--r--printing/printing_context_win.cc (renamed from chrome/browser/printing/win_printing_context.cc)9
-rw-r--r--printing/printing_context_win_unittest.cc (renamed from chrome/browser/printing/win_printing_context_unittest.cc)7
-rw-r--r--printing/printing_test.h (renamed from chrome/browser/printing/printing_test.h)0
42 files changed, 414 insertions, 143 deletions
diff --git a/chrome/browser/browser_main.cc b/chrome/browser/browser_main.cc
index 349a226..2044261 100644
--- a/chrome/browser/browser_main.cc
+++ b/chrome/browser/browser_main.cc
@@ -90,7 +90,6 @@
#include "chrome/browser/jankometer.h"
#include "chrome/browser/metrics/user_metrics.h"
#include "chrome/browser/net/url_fixer_upper.h"
-#include "chrome/browser/printing/printed_document.h"
#include "chrome/browser/profile.h"
#include "chrome/browser/rlz/rlz.h"
#include "chrome/browser/views/user_data_dir_dialog.h"
@@ -103,6 +102,7 @@
#include "net/base/sdch_manager.h"
#include "net/base/winsock_init.h"
#include "net/http/http_network_layer.h"
+#include "printing/printed_document.h"
#include "sandbox/src/sandbox.h"
#include "views/widget/accelerator_handler.h"
#endif // defined(OS_WIN)
diff --git a/chrome/browser/printing/print_job.cc b/chrome/browser/printing/print_job.cc
index 88f68e1..d65b7bf 100644
--- a/chrome/browser/printing/print_job.cc
+++ b/chrome/browser/printing/print_job.cc
@@ -7,9 +7,9 @@
#include "base/message_loop.h"
#include "base/timer.h"
#include "chrome/browser/printing/print_job_worker.h"
-#include "chrome/browser/printing/printed_document.h"
-#include "chrome/browser/printing/printed_page.h"
#include "chrome/common/notification_service.h"
+#include "printing/printed_document.h"
+#include "printing/printed_page.h"
#ifdef _MSC_VER
#pragma warning(disable:4355) // 'this' : used in base member initializer list
diff --git a/chrome/browser/printing/print_job_manager.cc b/chrome/browser/printing/print_job_manager.cc
index 320aa21..dc122ea 100644
--- a/chrome/browser/printing/print_job_manager.cc
+++ b/chrome/browser/printing/print_job_manager.cc
@@ -6,9 +6,9 @@
#include "chrome/browser/printing/print_job.h"
#include "chrome/browser/printing/printer_query.h"
-#include "chrome/browser/printing/printed_document.h"
-#include "chrome/browser/printing/printed_page.h"
#include "chrome/common/notification_service.h"
+#include "printing/printed_document.h"
+#include "printing/printed_page.h"
namespace printing {
diff --git a/chrome/browser/printing/print_job_unittest.cc b/chrome/browser/printing/print_job_unittest.cc
index 209b366..fe98964 100644
--- a/chrome/browser/printing/print_job_unittest.cc
+++ b/chrome/browser/printing/print_job_unittest.cc
@@ -5,9 +5,9 @@
#include "base/message_loop.h"
#include "chrome/browser/printing/print_job.h"
#include "chrome/browser/printing/print_job_worker.h"
-#include "chrome/browser/printing/printed_pages_source.h"
#include "chrome/common/notification_registrar.h"
#include "chrome/common/notification_service.h"
+#include "printing/printed_pages_source.h"
#include "googleurl/src/gurl.h"
#include "testing/gtest/include/gtest/gtest.h"
diff --git a/chrome/browser/printing/print_job_worker.cc b/chrome/browser/printing/print_job_worker.cc
index 728ff3d..d8c2d83 100644
--- a/chrome/browser/printing/print_job_worker.cc
+++ b/chrome/browser/printing/print_job_worker.cc
@@ -6,9 +6,9 @@
#include "base/message_loop.h"
#include "chrome/browser/printing/print_job.h"
-#include "chrome/browser/printing/printed_document.h"
-#include "chrome/browser/printing/printed_page.h"
#include "chrome/common/notification_service.h"
+#include "printing/printed_document.h"
+#include "printing/printed_page.h"
namespace printing {
diff --git a/chrome/browser/printing/print_job_worker.h b/chrome/browser/printing/print_job_worker.h
index b01881a..9ad2c39 100644
--- a/chrome/browser/printing/print_job_worker.h
+++ b/chrome/browser/printing/print_job_worker.h
@@ -7,8 +7,8 @@
#include "base/task.h"
#include "base/thread.h"
-#include "chrome/browser/printing/page_number.h"
-#include "chrome/browser/printing/win_printing_context.h"
+#include "printing/page_number.h"
+#include "printing/printing_context.h"
namespace printing {
diff --git a/chrome/browser/printing/print_job_worker_owner.h b/chrome/browser/printing/print_job_worker_owner.h
index 334c5ab..1810eca 100644
--- a/chrome/browser/printing/print_job_worker_owner.h
+++ b/chrome/browser/printing/print_job_worker_owner.h
@@ -5,7 +5,7 @@
#ifndef CHROME_BROWSER_PRINTING_PRINT_JOB_WORKER_OWNER_H__
#define CHROME_BROWSER_PRINTING_PRINT_JOB_WORKER_OWNER_H__
-#include "chrome/browser/printing/win_printing_context.h"
+#include "printing/printing_context.h"
class MessageLoop;
diff --git a/chrome/browser/printing/print_view_manager.cc b/chrome/browser/printing/print_view_manager.cc
index 1c56d00d..d1040b2 100644
--- a/chrome/browser/printing/print_view_manager.cc
+++ b/chrome/browser/printing/print_view_manager.cc
@@ -9,7 +9,6 @@
#include "chrome/browser/browser_process.h"
#include "chrome/browser/printing/print_job.h"
#include "chrome/browser/printing/print_job_manager.h"
-#include "chrome/browser/printing/printed_document.h"
#include "chrome/browser/printing/printer_query.h"
#include "chrome/browser/renderer_host/render_view_host.h"
#include "chrome/browser/tab_contents/navigation_entry.h"
@@ -18,6 +17,7 @@
#include "chrome/common/render_messages.h"
#include "grit/generated_resources.h"
#include "printing/native_metafile.h"
+#include "printing/printed_document.h"
using base::TimeDelta;
diff --git a/chrome/browser/printing/print_view_manager.h b/chrome/browser/printing/print_view_manager.h
index cd95f06..2945b0c 100644
--- a/chrome/browser/printing/print_view_manager.h
+++ b/chrome/browser/printing/print_view_manager.h
@@ -6,8 +6,8 @@
#define CHROME_BROWSER_PRINTING_PRINT_VIEW_MANAGER_H_
#include "base/ref_counted.h"
-#include "chrome/browser/printing/printed_pages_source.h"
#include "chrome/common/notification_registrar.h"
+#include "printing/printed_pages_source.h"
class RenderViewHost;
class TabContents;
diff --git a/chrome/browser/printing/printing_layout_uitest.cc b/chrome/browser/printing/printing_layout_uitest.cc
index e9f6c27..8455c11 100644
--- a/chrome/browser/printing/printing_layout_uitest.cc
+++ b/chrome/browser/printing/printing_layout_uitest.cc
@@ -15,8 +15,8 @@
#include "chrome/test/automation/tab_proxy.h"
#include "chrome/test/automation/window_proxy.h"
#include "chrome/test/ui/ui_test.h"
-#include "chrome/browser/printing/printing_test.h"
#include "net/url_request/url_request_unittest.h"
+#include "printing/printing_test.h"
#include "printing/native_metafile.h"
namespace {
diff --git a/chrome/browser/renderer_host/resource_message_filter.cc b/chrome/browser/renderer_host/resource_message_filter.cc
index 53baac3..f4168da 100644
--- a/chrome/browser/renderer_host/resource_message_filter.cc
+++ b/chrome/browser/renderer_host/resource_message_filter.cc
@@ -113,6 +113,27 @@ class WriteClipboardTask : public Task {
scoped_ptr<Clipboard::ObjectMap> objects_;
};
+void RenderParamsFromPrintSettings(const printing::PrintSettings& settings,
+ ViewMsg_Print_Params* params) {
+ DCHECK(params);
+#if defined(OS_WIN)
+ params->printable_size.SetSize(
+ settings.page_setup_pixels().content_area().width(),
+ settings.page_setup_pixels().content_area().height());
+ params->dpi = settings.dpi();
+ // Currently hardcoded at 1.25. See PrintSettings' constructor.
+ params->min_shrink = settings.min_shrink;
+ // Currently hardcoded at 2.0. See PrintSettings' constructor.
+ params->max_shrink = settings.max_shrink;
+ // Currently hardcoded at 72dpi. See PrintSettings' constructor.
+ params->desired_dpi = settings.desired_dpi;
+ // Always use an invalid cookie.
+ params->document_cookie = 0;
+ params->selection_only = settings.selection_only;
+#else
+ NOTIMPLEMENTED();
+#endif
+}
} // namespace
@@ -724,7 +745,7 @@ void ResourceMessageFilter::OnGetDefaultPrintSettingsReply(
if (printer_query->last_status() != printing::PrintingContext::OK) {
memset(&params, 0, sizeof(params));
} else {
- printer_query->settings().RenderParams(&params);
+ RenderParamsFromPrintSettings(printer_query->settings(), &params);
params.document_cookie = printer_query->cookie();
}
ViewHostMsg_GetDefaultPrintSettings::WriteReplyParams(reply_msg, params);
@@ -781,7 +802,7 @@ void ResourceMessageFilter::OnScriptedPrintReply(
!printer_query->settings().dpi()) {
memset(&params, 0, sizeof(params));
} else {
- printer_query->settings().RenderParams(&params.params);
+ RenderParamsFromPrintSettings(printer_query->settings(), &params.params);
params.params.document_cookie = printer_query->cookie();
params.pages =
printing::PageRange::GetPages(printer_query->settings().ranges);
diff --git a/chrome/chrome.gyp b/chrome/chrome.gyp
index e801ae3..67b113b9 100644
--- a/chrome/chrome.gyp
+++ b/chrome/chrome.gyp
@@ -540,6 +540,7 @@
'../app/app.gyp:app_resources',
'../media/media.gyp:media',
'../net/net.gyp:net_resources',
+ '../printing/printing.gyp:printing',
'../skia/skia.gyp:skia',
'../third_party/icu38/icu38.gyp:icui18n',
'../third_party/icu38/icu38.gyp:icuuc',
@@ -1267,14 +1268,6 @@
'browser/plugin_service.h',
'browser/possible_url_model.cc',
'browser/possible_url_model.h',
- 'browser/printing/page_number.cc',
- 'browser/printing/page_number.h',
- 'browser/printing/page_overlays.cc',
- 'browser/printing/page_overlays.h',
- 'browser/printing/page_range.cc',
- 'browser/printing/page_range.h',
- 'browser/printing/page_setup.cc',
- 'browser/printing/page_setup.h',
'browser/printing/print_job.cc',
'browser/printing/print_job.h',
'browser/printing/print_job_manager.cc',
@@ -1282,19 +1275,10 @@
'browser/printing/print_job_worker.cc',
'browser/printing/print_job_worker.h',
'browser/printing/print_job_worker_owner.h',
- 'browser/printing/print_settings.cc',
- 'browser/printing/print_settings.h',
'browser/printing/print_view_manager.cc',
'browser/printing/print_view_manager.h',
- 'browser/printing/printed_document.cc',
- 'browser/printing/printed_document.h',
- 'browser/printing/printed_page.cc',
- 'browser/printing/printed_page.h',
- 'browser/printing/printed_pages_source.h',
'browser/printing/printer_query.cc',
'browser/printing/printer_query.h',
- 'browser/printing/win_printing_context.cc',
- 'browser/printing/win_printing_context.h',
'browser/privacy_blacklist/blacklist.h',
'browser/privacy_blacklist/blacklist.cc',
'browser/process_singleton.h',
@@ -1886,7 +1870,6 @@
'dependencies': [
'../google_update/google_update.gyp:google_update',
'installer/installer.gyp:installer_util',
- '../printing/printing.gyp:printing',
'../third_party/cld/cld.gyp:cld',
'../views/views.gyp:views',
'../gears/gears.gyp:gears',
@@ -3256,7 +3239,6 @@
'browser/media_uitest.cc',
'browser/metrics/metrics_service_uitest.cc',
'browser/printing/printing_layout_uitest.cc',
- 'browser/printing/printing_test.h',
'browser/renderer_host/resource_dispatcher_host_uitest.cc',
'browser/sanity_uitest.cc',
'browser/session_history_uitest.cc',
@@ -3551,12 +3533,7 @@
'browser/password_manager/login_database_unittest.cc',
'browser/password_manager/password_form_manager_unittest.cc',
'browser/password_manager/password_store_mac_unittest.cc',
- 'browser/printing/page_number_unittest.cc',
- 'browser/printing/page_overlays_unittest.cc',
- 'browser/printing/page_range_unittest.cc',
- 'browser/printing/page_setup_unittest.cc',
'browser/printing/print_job_unittest.cc',
- 'browser/printing/win_printing_context_unittest.cc',
'browser/privacy_blacklist/blacklist_unittest.cc',
'browser/profile_manager_unittest.cc',
'browser/renderer_host/audio_renderer_host_unittest.cc',
@@ -3779,8 +3756,6 @@
'browser/importer/firefox_importer_unittest.cc',
'browser/importer/importer_unittest.cc',
'browser/login_prompt_unittest.cc',
- 'browser/printing/page_number_unittest.cc',
- 'browser/printing/page_overlays_unittest.cc',
'browser/printing/print_job_unittest.cc',
'browser/rlz/rlz_unittest.cc',
'browser/safe_browsing/safe_browsing_blocking_page_unittest.cc',
diff --git a/printing/DEPS b/printing/DEPS
index 5cd0867..64b2aab 100644
--- a/printing/DEPS
+++ b/printing/DEPS
@@ -1,3 +1,6 @@
include_rules = [
+ "+app/gfx", # Font's are here.
+ "+app", # win_util::FormatSystemTime/Date.
"+base",
+ "+skia/ext",
]
diff --git a/printing/emf_win.h b/printing/emf_win.h
index 7be747a..4170e87 100644
--- a/printing/emf_win.h
+++ b/printing/emf_win.h
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef PRINTING_EMF_WIN_H__
-#define PRINTING_EMF_WIN_H__
+#ifndef PRINTING_EMF_WIN_H_
+#define PRINTING_EMF_WIN_H_
#include <windows.h>
#include <vector>
@@ -178,4 +178,4 @@ class Emf::Enumerator {
} // namespace printing
-#endif // PRINTING_EMF_WIN_H__
+#endif // PRINTING_EMF_WIN_H_
diff --git a/printing/emf_win_unittest.cc b/printing/emf_win_unittest.cc
index 9ff375a..7f1a1e6 100644
--- a/printing/emf_win_unittest.cc
+++ b/printing/emf_win_unittest.cc
@@ -64,7 +64,7 @@ TEST(EmfTest, DC) {
/*
// DEPS check fails even if include is in a multi line comment:
-// #include "chrome/browser/printing/win_printing_context.h"
+// #include "printing/printing_context.h"
// #include "chrome/common/chrome_paths.h"
// Disabled if no "UnitTest printer" exist. Useful to reproduce bug 1186598.
diff --git a/printing/native_metafile.h b/printing/native_metafile.h
index 6963089..284212c 100644
--- a/printing/native_metafile.h
+++ b/printing/native_metafile.h
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef PRINTING_NATIVE_METAFILE_H__
-#define PRINTING_NATIVE_METAFILE_H__
+#ifndef PRINTING_NATIVE_METAFILE_H_
+#define PRINTING_NATIVE_METAFILE_H_
// Define a metafile format for the current platform. We use this platform
// independent define so we can define interfaces in platform agnostic manner.
@@ -25,12 +25,16 @@ typedef Emf NativeMetafile;
#elif defined(OS_MACOSX)
// TODO(port): Printing using PDF?
+// The mock class is here so we can compile.
+class NativeMetafile {};
#elif defined(OS_LINUX)
// TODO(port): Printing using PostScript?
+// The mock class is here so we can compile.
+class NativeMetafile {};
#endif
-#endif // PRINTING_NATIVE_METAFILE_H__
+#endif // PRINTING_NATIVE_METAFILE_H_
diff --git a/chrome/browser/printing/page_number.cc b/printing/page_number.cc
index 9832c96..8e92870 100644
--- a/chrome/browser/printing/page_number.cc
+++ b/printing/page_number.cc
@@ -2,12 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "chrome/browser/printing/page_number.h"
+#include "printing/page_number.h"
#include <limits>
#include "base/logging.h"
-#include "chrome/browser/printing/print_settings.h"
+#include "printing/print_settings.h"
namespace printing {
diff --git a/chrome/browser/printing/page_number.h b/printing/page_number.h
index 20417e8..528a41d 100644
--- a/chrome/browser/printing/page_number.h
+++ b/printing/page_number.h
@@ -2,12 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CHROME_BROWSER_PRINTING_PAGE_NUMBER_H__
-#define CHROME_BROWSER_PRINTING_PAGE_NUMBER_H__
+#ifndef PRINTING_PAGE_NUMBER_H_
+#define PRINTING_PAGE_NUMBER_H_
#include <ostream>
-#include "chrome/browser/printing/page_range.h"
+#include "printing/page_range.h"
namespace printing {
@@ -70,4 +70,4 @@ inline typename std::basic_ostream<E,T>& operator<<(
} // namespace printing
-#endif // CHROME_BROWSER_PRINTING_PAGE_NUMBER_H__
+#endif // PRINTING_PAGE_NUMBER_H_
diff --git a/chrome/browser/printing/page_number_unittest.cc b/printing/page_number_unittest.cc
index 6281925..ece1e0f 100644
--- a/chrome/browser/printing/page_number_unittest.cc
+++ b/printing/page_number_unittest.cc
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "chrome/browser/printing/page_number.h"
-#include "chrome/browser/printing/print_settings.h"
+#include "printing/page_number.h"
+#include "printing/print_settings.h"
#include "testing/gtest/include/gtest/gtest.h"
TEST(PageNumberTest, Count) {
diff --git a/chrome/browser/printing/page_overlays.cc b/printing/page_overlays.cc
index 6233d84..946186d 100644
--- a/chrome/browser/printing/page_overlays.cc
+++ b/printing/page_overlays.cc
@@ -2,13 +2,13 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "chrome/browser/printing/page_overlays.h"
+#include "printing/page_overlays.h"
#include "app/gfx/text_elider.h"
#include "base/logging.h"
#include "base/string_util.h"
-#include "chrome/browser/printing/printed_document.h"
-#include "chrome/browser/printing/printed_page.h"
+#include "printing/printed_document.h"
+#include "printing/printed_page.h"
namespace {
diff --git a/chrome/browser/printing/page_overlays.h b/printing/page_overlays.h
index 7663153..f30aa26 100644
--- a/chrome/browser/printing/page_overlays.h
+++ b/printing/page_overlays.h
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CHROME_BROWSER_PRINTING_PAGE_OVERLAYS_H__
-#define CHROME_BROWSER_PRINTING_PAGE_OVERLAYS_H__
+#ifndef PRINTING_PAGE_OVERLAYS_H_
+#define PRINTING_PAGE_OVERLAYS_H_
#include <string>
@@ -77,4 +77,4 @@ class PageOverlays {
} // namespace printing
-#endif // CHROME_BROWSER_PRINTING_PAGE_OVERLAYS_H__
+#endif // PRINTING_PAGE_OVERLAYS_H_
diff --git a/chrome/browser/printing/page_overlays_unittest.cc b/printing/page_overlays_unittest.cc
index 0710f33..2d1bdac 100644
--- a/chrome/browser/printing/page_overlays_unittest.cc
+++ b/printing/page_overlays_unittest.cc
@@ -2,17 +2,20 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include "base/at_exit.h"
#include "base/message_loop.h"
#include "base/string_util.h"
-#include "chrome/browser/printing/page_overlays.h"
-#include "chrome/browser/printing/print_settings.h"
-#include "chrome/browser/printing/printed_document.h"
-#include "chrome/browser/printing/printed_page.h"
-#include "chrome/browser/printing/printed_pages_source.h"
+#include "printing/page_overlays.h"
+#include "printing/print_settings.h"
+#include "printing/printed_document.h"
+#include "printing/printed_page.h"
+#include "printing/printed_pages_source.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace {
+base::AtExitManager global_at_exit_manager;
+
class PageOverlaysTest : public testing::Test {
private:
MessageLoop message_loop_;
diff --git a/chrome/browser/printing/page_range.cc b/printing/page_range.cc
index 9669a9e..ffe572d 100644
--- a/chrome/browser/printing/page_range.cc
+++ b/printing/page_range.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "chrome/browser/printing/page_range.h"
+#include "printing/page_range.h"
#include "base/stl_util-inl.h"
diff --git a/chrome/browser/printing/page_range.h b/printing/page_range.h
index 1f3e024..1237d5d 100644
--- a/chrome/browser/printing/page_range.h
+++ b/printing/page_range.h
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CHROME_BROWSER_PRINTING_PAGE_RANGE_H__
-#define CHROME_BROWSER_PRINTING_PAGE_RANGE_H__
+#ifndef PRINTING_PAGE_RANGE_H_
+#define PRINTING_PAGE_RANGE_H_
#include <vector>
@@ -31,4 +31,4 @@ struct PageRange {
} // namespace printing
-#endif // CHROME_BROWSER_PRINTING_PAGE_RANGE_H__
+#endif // PRINTING_PAGE_RANGE_H_
diff --git a/chrome/browser/printing/page_range_unittest.cc b/printing/page_range_unittest.cc
index a5ac563..2cb4f82 100644
--- a/chrome/browser/printing/page_range_unittest.cc
+++ b/printing/page_range_unittest.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "chrome/browser/printing/page_range.h"
+#include "printing/page_range.h"
#include "testing/gtest/include/gtest/gtest.h"
TEST(PageRangeTest, RangeMerge) {
diff --git a/chrome/browser/printing/page_setup.cc b/printing/page_setup.cc
index 2df670c..adc285b 100644
--- a/chrome/browser/printing/page_setup.cc
+++ b/printing/page_setup.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "chrome/browser/printing/page_setup.h"
+#include "printing/page_setup.h"
#include "base/logging.h"
diff --git a/chrome/browser/printing/page_setup.h b/printing/page_setup.h
index 6cf294e..101b128 100644
--- a/chrome/browser/printing/page_setup.h
+++ b/printing/page_setup.h
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CHROME_BROWSER_PRINTING_PAGE_SETUP_H__
-#define CHROME_BROWSER_PRINTING_PAGE_SETUP_H__
+#ifndef PRINTING_PAGE_SETUP_H_
+#define PRINTING_PAGE_SETUP_H_
#include "base/gfx/rect.h"
@@ -79,4 +79,4 @@ class PageSetup {
} // namespace printing
-#endif // CHROME_BROWSER_PRINTING_PAGE_SETUP_H__
+#endif // PRINTING_PAGE_SETUP_H_
diff --git a/chrome/browser/printing/page_setup_unittest.cc b/printing/page_setup_unittest.cc
index 8619014..e2c68b9 100644
--- a/chrome/browser/printing/page_setup_unittest.cc
+++ b/printing/page_setup_unittest.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "chrome/browser/printing/page_setup.h"
+#include "printing/page_setup.h"
#include <stdlib.h>
#include <time.h>
diff --git a/chrome/browser/printing/print_settings.cc b/printing/print_settings.cc
index d7eeeb0..b76821b 100644
--- a/chrome/browser/printing/print_settings.cc
+++ b/printing/print_settings.cc
@@ -2,11 +2,10 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "chrome/browser/printing/print_settings.h"
+#include "printing/print_settings.h"
#include "base/atomic_sequence_num.h"
#include "base/logging.h"
-#include "chrome/common/render_messages.h"
#include "printing/units.h"
namespace printing {
@@ -94,22 +93,6 @@ void PrintSettings::SetPrinterPrintableArea(
page_setup_pixels_.SetRequestedMargins(margins);
}
-void PrintSettings::RenderParams(ViewMsg_Print_Params* params) const {
- DCHECK(params);
- params->printable_size.SetSize(page_setup_pixels_.content_area().width(),
- page_setup_pixels_.content_area().height());
- params->dpi = dpi_;
- // Currently hardcoded at 1.25. See PrintSettings' constructor.
- params->min_shrink = min_shrink;
- // Currently hardcoded at 2.0. See PrintSettings' constructor.
- params->max_shrink = max_shrink;
- // Currently hardcoded at 72dpi. See PrintSettings' constructor.
- params->desired_dpi = desired_dpi;
- // Always use an invalid cookie.
- params->document_cookie = 0;
- params->selection_only = selection_only;
-}
-
bool PrintSettings::Equals(const PrintSettings& rhs) const {
// Do not test the display device name (printer_name_) for equality since it
// may sometimes be chopped off at 30 chars. As long as device_name is the
diff --git a/chrome/browser/printing/print_settings.h b/printing/print_settings.h
index a82af96..d1929c3 100644
--- a/chrome/browser/printing/print_settings.h
+++ b/printing/print_settings.h
@@ -2,15 +2,14 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CHROME_BROWSER_PRINTING_PRINT_SETTINGS_H__
-#define CHROME_BROWSER_PRINTING_PRINT_SETTINGS_H__
+#ifndef PRINTING_PRINT_SETTINGS_H_
+#define PRINTING_PRINT_SETTINGS_H_
#include "base/gfx/rect.h"
-#include "chrome/browser/printing/page_overlays.h"
-#include "chrome/browser/printing/page_range.h"
-#include "chrome/browser/printing/page_setup.h"
+#include "printing/page_overlays.h"
+#include "printing/page_range.h"
+#include "printing/page_setup.h"
-struct ViewMsg_Print_Params;
typedef struct HDC__* HDC;
typedef struct _devicemodeW DEVMODE;
@@ -38,10 +37,6 @@ class PrintSettings {
void SetPrinterPrintableArea(gfx::Size const& physical_size_pixels,
gfx::Rect const& printable_area_pixels);
- // Initializes the print parameters that needs to be sent to the renderer
- // process.
- void RenderParams(ViewMsg_Print_Params* params) const;
-
// Equality operator.
// NOTE: printer_name is NOT tested for equality since it doesn't affect the
// output.
@@ -109,4 +104,4 @@ class PrintSettings {
} // namespace printing
-#endif // CHROME_BROWSER_PRINTING_PRINT_SETTINGS_H__
+#endif // PRINTING_PRINT_SETTINGS_H_
diff --git a/chrome/browser/printing/printed_document.cc b/printing/printed_document.cc
index ac26581..517548b 100644
--- a/chrome/browser/printing/printed_document.cc
+++ b/printing/printed_document.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "chrome/browser/printing/printed_document.h"
+#include "printing/printed_document.h"
#include <set>
@@ -14,10 +14,10 @@
#include "base/singleton.h"
#include "base/string_util.h"
#include "base/time.h"
-#include "chrome/browser/printing/page_number.h"
-#include "chrome/browser/printing/page_overlays.h"
-#include "chrome/browser/printing/printed_pages_source.h"
-#include "chrome/browser/printing/printed_page.h"
+#include "printing/page_number.h"
+#include "printing/page_overlays.h"
+#include "printing/printed_pages_source.h"
+#include "printing/printed_page.h"
#include "printing/units.h"
#include "skia/ext/platform_device.h"
diff --git a/chrome/browser/printing/printed_document.h b/printing/printed_document.h
index 0d1480d..cedaddd 100644
--- a/chrome/browser/printing/printed_document.h
+++ b/printing/printed_document.h
@@ -2,17 +2,17 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CHROME_BROWSER_PRINTING_PRINTED_DOCUMENT_H__
-#define CHROME_BROWSER_PRINTING_PRINTED_DOCUMENT_H__
+#ifndef PRINTING_PRINTED_DOCUMENT_H_
+#define PRINTING_PRINTED_DOCUMENT_H_
#include <map>
#include "base/lock.h"
#include "base/ref_counted.h"
#include "base/scoped_ptr.h"
-#include "chrome/browser/printing/print_settings.h"
-#include "printing/native_metafile.h"
#include "googleurl/src/gurl.h"
+#include "printing/print_settings.h"
+#include "printing/native_metafile.h"
class MessageLoop;
@@ -104,7 +104,7 @@ class PrintedDocument : public base::RefCountedThreadSafe<PrintedDocument> {
private:
// Array of data for each print previewed page.
- typedef std::map<int, scoped_refptr<PrintedPage>> PrintedPages;
+ typedef std::map<int, scoped_refptr<PrintedPage> > PrintedPages;
// Contains all the mutable stuff. All this stuff MUST be accessed with the
// lock held.
@@ -189,4 +189,4 @@ class PrintedDocument : public base::RefCountedThreadSafe<PrintedDocument> {
} // namespace printing
-#endif // CHROME_BROWSER_PRINTING_PRINTED_DOCUMENT_H__
+#endif // PRINTING_PRINTED_DOCUMENT_H_
diff --git a/chrome/browser/printing/printed_page.cc b/printing/printed_page.cc
index 4c44acc..441690a 100644
--- a/chrome/browser/printing/printed_page.cc
+++ b/printing/printed_page.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "chrome/browser/printing/printed_page.h"
+#include "printing/printed_page.h"
namespace printing {
diff --git a/chrome/browser/printing/printed_page.h b/printing/printed_page.h
index b60c93d..3c954ac 100644
--- a/chrome/browser/printing/printed_page.h
+++ b/printing/printed_page.h
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CHROME_BROWSER_PRINTING_PRINTED_PAGE_H__
-#define CHROME_BROWSER_PRINTING_PRINTED_PAGE_H__
+#ifndef PRINTING_PRINTED_PAGE_H_
+#define PRINTING_PRINTED_PAGE_H_
#include "base/gfx/rect.h"
#include "base/gfx/size.h"
@@ -47,4 +47,4 @@ class PrintedPage : public base::RefCountedThreadSafe<PrintedPage> {
} // namespace printing
-#endif // CHROME_BROWSER_PRINTING_PRINTED_PAGE_H__
+#endif // PRINTING_PRINTED_PAGE_H_
diff --git a/chrome/browser/printing/printed_pages_source.h b/printing/printed_pages_source.h
index c23bd34..4ae6549 100644
--- a/chrome/browser/printing/printed_pages_source.h
+++ b/printing/printed_pages_source.h
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CHROME_BROWSER_PRINTING_PRINTED_PAGES_SOURCE_H__
-#define CHROME_BROWSER_PRINTING_PRINTED_PAGES_SOURCE_H__
+#ifndef PRINTING_PRINTED_PAGES_SOURCE_H_
+#define PRINTING_PRINTED_PAGES_SOURCE_H_
#include <string>
@@ -26,4 +26,4 @@ class PrintedPagesSource {
} // namespace printing
-#endif // CHROME_BROWSER_PRINTING_PRINTED_PAGES_SOURCE_H__
+#endif // PRINTING_PRINTED_PAGES_SOURCE_H_
diff --git a/printing/printing.gyp b/printing/printing.gyp
index 899bded..e0f1d38 100644
--- a/printing/printing.gyp
+++ b/printing/printing.gyp
@@ -14,9 +14,13 @@
'target_name': 'printing',
'type': '<(library)',
'dependencies': [
+ '../app/app.gyp:app_base', # Only required for Font support
'../base/base.gyp:base',
'../base/base.gyp:base_gfx',
-
+ '../build/temp_gyp/googleurl.gyp:googleurl',
+ '../skia/skia.gyp:skia',
+ '../third_party/icu38/icu38.gyp:icui18n',
+ '../third_party/icu38/icu38.gyp:icuuc',
],
'msvs_guid': '9E5416B9-B91B-4029-93F4-102C1AD5CAF4',
'include_dirs': [
@@ -26,6 +30,25 @@
'emf_win.cc',
'emf_win.h',
'native_metafile.h',
+ 'page_number.cc',
+ 'page_number.h',
+ 'page_overlays.cc',
+ 'page_overlays.h',
+ 'page_range.cc',
+ 'page_range.h',
+ 'page_setup.cc',
+ 'page_setup.h',
+ 'print_settings.cc',
+ 'print_settings.h',
+ 'printed_document.cc',
+ 'printed_document.h',
+ 'printed_page.cc',
+ 'printed_page.h',
+ 'printed_pages_source.h',
+ 'printing_context.h',
+ 'printing_context_linux.cc',
+ 'printing_context_mac.cc',
+ 'printing_context_win.cc',
'units.cc',
'units.h',
],
@@ -38,7 +61,12 @@
['OS!="linux"', {'sources/': [['exclude', '_linux\\.cc$']]}],
['OS!="mac"', {'sources/': [['exclude', '_mac\\.(cc|mm?)$']]}],
['OS!="win"', {
- 'sources/': [['exclude', '_win\\.cc$']]
+ 'sources/': [
+ ['exclude', '_win\\.cc$'],
+ ['exclude',
+ 'printed_document.cc',
+ ]
+ ]
}, { # else: OS=="win"
'sources/': [['exclude', '_posix\\.cc$']]
}],
@@ -55,17 +83,31 @@
],
'sources': [
'emf_win_unittest.cc',
+ 'printing_test.h',
+ 'page_number_unittest.cc',
+ 'page_overlays_unittest.cc',
+ 'page_range_unittest.cc',
+ 'page_setup_unittest.cc',
+ 'printing_context_win_unittest.cc',
'units_unittest.cc',
],
'conditions': [
['OS!="linux"', {'sources/': [['exclude', '_linux_unittest\\.cc$']]}],
['OS!="mac"', {'sources/': [['exclude', '_mac_unittest\\.(cc|mm?)$']]}],
['OS!="win"', {
- 'sources/': [['exclude', '_win_unittest\\.cc$']]
+ 'sources/': [
+ ['exclude', '_win_unittest\\.cc$'],
+
+ # Most of the printing functionailty is Windows only for now.
+ ['exclude', '.*'],
+ ['include', 'page_range_unittest.cc'],
+ ['include', 'page_setup_unittest.cc'],
+ ['include', 'units_unittest.cc'],
+ ]
}, { # else: OS=="win"
'sources/': [['exclude', '_posix_unittest\\.cc$']]
}],
],
},
],
-}
+} \ No newline at end of file
diff --git a/chrome/browser/printing/win_printing_context.h b/printing/printing_context.h
index 320a512..06ad9af 100644
--- a/chrome/browser/printing/win_printing_context.h
+++ b/printing/printing_context.h
@@ -2,15 +2,20 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CHROME_BROWSER_PRINTING_WIN_PRINTING_CONTEXT_H__
-#define CHROME_BROWSER_PRINTING_WIN_PRINTING_CONTEXT_H__
+#ifndef PRINTING_PRINTING_CONTEXT_H_
+#define PRINTING_PRINTING_CONTEXT_H_
+#include "build/build_config.h"
+
+#if defined(OS_WIN)
#include <ocidl.h>
#include <commdlg.h>
+#endif
+
#include <string>
#include "base/basictypes.h"
-#include "chrome/browser/printing/print_settings.h"
+#include "printing/print_settings.h"
namespace printing {
@@ -29,9 +34,11 @@ class PrintingContext {
PrintingContext();
~PrintingContext();
+#if defined(OS_WIN)
// Asks the user what printer and format should be used to print. Updates the
// context with the select device settings.
Result AskUserForSettings(HWND window, int max_pages, bool has_selection);
+#endif
// Selects the user's default printer and format. Updates the context with the
// default device settings.
@@ -61,16 +68,18 @@ class PrintingContext {
// document.
Result DocumentDone();
- // Cancels printing. Can be used in a multithreaded context. Takes effect
+ // Cancels printing. Can be used in a multi-threaded context. Takes effect
// immediately.
void Cancel();
// Dismiss the Print... dialog box if shown.
void DismissDialog();
+#if defined(OS_WIN)
HDC context() {
return hdc_;
}
+#endif
const PrintSettings& settings() const {
return settings_;
@@ -84,6 +93,7 @@ class PrintingContext {
// Does bookkeeping when an error occurs.
PrintingContext::Result OnError();
+#if defined(OS_WIN)
// Used in response to the user canceling the printing.
static BOOL CALLBACK AbortProc(HDC hdc, int nCode);
@@ -110,6 +120,7 @@ class PrintingContext {
// The selected printer context.
HDC hdc_;
+#endif
// Complete print context settings.
PrintSettings settings_;
@@ -119,8 +130,10 @@ class PrintingContext {
int page_number_;
#endif
+#if defined(OS_WIN)
// The dialog box for the time it is shown.
volatile HWND dialog_box_;
+#endif
// The dialog box has been dismissed.
volatile bool dialog_box_dismissed_;
@@ -136,4 +149,4 @@ class PrintingContext {
} // namespace printing
-#endif // CHROME_BROWSER_PRINTING_WIN_PRINTING_CONTEXT_H__
+#endif // PRINTING_PRINTING_CONTEXT_H_
diff --git a/printing/printing_context_linux.cc b/printing/printing_context_linux.cc
new file mode 100644
index 0000000..fcc51f7
--- /dev/null
+++ b/printing/printing_context_linux.cc
@@ -0,0 +1,117 @@
+// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "printing/printing_context.h"
+
+#include "base/logging.h"
+
+namespace printing {
+
+PrintingContext::PrintingContext()
+ :
+#ifndef NDEBUG
+ page_number_(-1),
+#endif
+ dialog_box_dismissed_(false),
+ in_print_job_(false),
+ abort_printing_(false) {
+}
+
+PrintingContext::~PrintingContext() {
+ ResetSettings();
+}
+
+
+PrintingContext::Result PrintingContext::UseDefaultSettings() {
+ DCHECK(!in_print_job_);
+
+ NOTIMPLEMENTED();
+
+ return FAILED;
+}
+
+PrintingContext::Result PrintingContext::InitWithSettings(
+ const PrintSettings& settings) {
+ DCHECK(!in_print_job_);
+ settings_ = settings;
+
+ NOTIMPLEMENTED();
+
+ return FAILED;
+}
+
+void PrintingContext::ResetSettings() {
+#ifndef NDEBUG
+ page_number_ = -1;
+#endif
+ dialog_box_dismissed_ = false;
+ abort_printing_ = false;
+ in_print_job_ = false;
+}
+
+PrintingContext::Result PrintingContext::NewDocument(
+ const std::wstring& document_name) {
+ DCHECK(!in_print_job_);
+
+ NOTIMPLEMENTED();
+
+#ifndef NDEBUG
+ page_number_ = 0;
+#endif
+
+ return FAILED;
+}
+
+PrintingContext::Result PrintingContext::NewPage() {
+ if (abort_printing_)
+ return CANCEL;
+ DCHECK(in_print_job_);
+
+ NOTIMPLEMENTED();
+
+#ifndef NDEBUG
+ ++page_number_;
+#endif
+
+ return FAILED;
+}
+
+PrintingContext::Result PrintingContext::PageDone() {
+ if (abort_printing_)
+ return CANCEL;
+ DCHECK(in_print_job_);
+
+ NOTIMPLEMENTED();
+
+ return FAILED;
+}
+
+PrintingContext::Result PrintingContext::DocumentDone() {
+ if (abort_printing_)
+ return CANCEL;
+ DCHECK(in_print_job_);
+
+ NOTIMPLEMENTED();
+
+ ResetSettings();
+ return FAILED;
+}
+
+void PrintingContext::Cancel() {
+ abort_printing_ = true;
+ in_print_job_ = false;
+
+ NOTIMPLEMENTED();
+}
+
+void PrintingContext::DismissDialog() {
+ NOTIMPLEMENTED();
+}
+
+PrintingContext::Result PrintingContext::OnError() {
+ ResetSettings();
+ return abort_printing_ ? CANCEL : FAILED;
+}
+
+} // namespace printing
diff --git a/printing/printing_context_mac.cc b/printing/printing_context_mac.cc
new file mode 100644
index 0000000..fcc51f7
--- /dev/null
+++ b/printing/printing_context_mac.cc
@@ -0,0 +1,117 @@
+// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "printing/printing_context.h"
+
+#include "base/logging.h"
+
+namespace printing {
+
+PrintingContext::PrintingContext()
+ :
+#ifndef NDEBUG
+ page_number_(-1),
+#endif
+ dialog_box_dismissed_(false),
+ in_print_job_(false),
+ abort_printing_(false) {
+}
+
+PrintingContext::~PrintingContext() {
+ ResetSettings();
+}
+
+
+PrintingContext::Result PrintingContext::UseDefaultSettings() {
+ DCHECK(!in_print_job_);
+
+ NOTIMPLEMENTED();
+
+ return FAILED;
+}
+
+PrintingContext::Result PrintingContext::InitWithSettings(
+ const PrintSettings& settings) {
+ DCHECK(!in_print_job_);
+ settings_ = settings;
+
+ NOTIMPLEMENTED();
+
+ return FAILED;
+}
+
+void PrintingContext::ResetSettings() {
+#ifndef NDEBUG
+ page_number_ = -1;
+#endif
+ dialog_box_dismissed_ = false;
+ abort_printing_ = false;
+ in_print_job_ = false;
+}
+
+PrintingContext::Result PrintingContext::NewDocument(
+ const std::wstring& document_name) {
+ DCHECK(!in_print_job_);
+
+ NOTIMPLEMENTED();
+
+#ifndef NDEBUG
+ page_number_ = 0;
+#endif
+
+ return FAILED;
+}
+
+PrintingContext::Result PrintingContext::NewPage() {
+ if (abort_printing_)
+ return CANCEL;
+ DCHECK(in_print_job_);
+
+ NOTIMPLEMENTED();
+
+#ifndef NDEBUG
+ ++page_number_;
+#endif
+
+ return FAILED;
+}
+
+PrintingContext::Result PrintingContext::PageDone() {
+ if (abort_printing_)
+ return CANCEL;
+ DCHECK(in_print_job_);
+
+ NOTIMPLEMENTED();
+
+ return FAILED;
+}
+
+PrintingContext::Result PrintingContext::DocumentDone() {
+ if (abort_printing_)
+ return CANCEL;
+ DCHECK(in_print_job_);
+
+ NOTIMPLEMENTED();
+
+ ResetSettings();
+ return FAILED;
+}
+
+void PrintingContext::Cancel() {
+ abort_printing_ = true;
+ in_print_job_ = false;
+
+ NOTIMPLEMENTED();
+}
+
+void PrintingContext::DismissDialog() {
+ NOTIMPLEMENTED();
+}
+
+PrintingContext::Result PrintingContext::OnError() {
+ ResetSettings();
+ return abort_printing_ ? CANCEL : FAILED;
+}
+
+} // namespace printing
diff --git a/chrome/browser/printing/win_printing_context.cc b/printing/printing_context_win.cc
index 0182417..4e506a5 100644
--- a/chrome/browser/printing/win_printing_context.cc
+++ b/printing/printing_context_win.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "chrome/browser/printing/win_printing_context.h"
+#include "printing/printing_context.h"
#include <winspool.h>
@@ -10,8 +10,7 @@
#include "base/message_loop.h"
#include "base/time.h"
#include "base/time_format.h"
-#include "chrome/browser/browser_process.h"
-#include "chrome/browser/printing/printed_document.h"
+#include "printing/printed_document.h"
#include "skia/ext/platform_device_win.h"
using base::Time;
@@ -144,8 +143,8 @@ PrintingContext::PrintingContext()
#endif
dialog_box_(NULL),
dialog_box_dismissed_(false),
- abort_printing_(false),
- in_print_job_(false) {
+ in_print_job_(false),
+ abort_printing_(false) {
}
PrintingContext::~PrintingContext() {
diff --git a/chrome/browser/printing/win_printing_context_unittest.cc b/printing/printing_context_win_unittest.cc
index e2a03a1..9e19e3b 100644
--- a/chrome/browser/printing/win_printing_context_unittest.cc
+++ b/printing/printing_context_win_unittest.cc
@@ -2,11 +2,11 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "chrome/browser/printing/win_printing_context.h"
+#include "printing/printing_context.h"
+#include "printing/printing_test.h"
+#include "printing/print_settings.h"
#include "testing/gtest/include/gtest/gtest.h"
-#include "chrome/browser/printing/printing_test.h"
-#include "chrome/browser/printing/print_settings.h"
// This test is automatically disabled if no printer is available.
class PrintingContextTest : public PrintingTest<testing::Test> {
@@ -20,7 +20,6 @@ TEST_F(PrintingContextTest, Base) {
printing::PrintingContext context;
EXPECT_EQ(context.InitWithSettings(settings), printing::PrintingContext::OK);
- ;
// The print may lie to use and may not support world transformation.
// Verify right now.
XFORM random_matrix = { 1, 0.1f, 0, 1.5f, 0, 1 };
diff --git a/chrome/browser/printing/printing_test.h b/printing/printing_test.h
index 3237813..3237813 100644
--- a/chrome/browser/printing/printing_test.h
+++ b/printing/printing_test.h