summaryrefslogtreecommitdiffstats
path: root/printing
diff options
context:
space:
mode:
authorthestig@chromium.org <thestig@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-10-18 20:58:51 +0000
committerthestig@chromium.org <thestig@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-10-18 20:58:51 +0000
commitd91db11a358380d9581130cd785f824282207d42 (patch)
treea2c0f521aba51b95d195b8d45c38aa647c13e8b8 /printing
parentc54c43e735b1e3e5e6900700d1accec4fcbf5926 (diff)
downloadchromium_src-d91db11a358380d9581130cd785f824282207d42.zip
chromium_src-d91db11a358380d9581130cd785f824282207d42.tar.gz
chromium_src-d91db11a358380d9581130cd785f824282207d42.tar.bz2
Cleanup: Remove unneeded namespaces.
BUG=none TEST=none Review URL: http://codereview.chromium.org/8334007 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@106129 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'printing')
-rw-r--r--printing/emf_win_unittest.cc29
-rw-r--r--printing/image.cc4
-rw-r--r--printing/pdf_metafile_cg_mac_unittest.cc4
-rw-r--r--printing/pdf_metafile_skia.cc2
-rw-r--r--printing/print_settings.cc94
-rw-r--r--printing/print_settings_initializer.cc23
-rw-r--r--printing/printed_document_mac.cc5
-rw-r--r--printing/printed_document_win.cc3
-rw-r--r--printing/printing_context.cc19
-rw-r--r--printing/printing_context_mac.mm4
-rw-r--r--printing/printing_context_win.cc4
-rw-r--r--printing/units.cc9
12 files changed, 95 insertions, 105 deletions
diff --git a/printing/emf_win_unittest.cc b/printing/emf_win_unittest.cc
index 01395a9..add23f9 100644
--- a/printing/emf_win_unittest.cc
+++ b/printing/emf_win_unittest.cc
@@ -50,7 +50,7 @@ TEST(EmfTest, DC) {
uint32 size;
std::vector<BYTE> data;
{
- printing::Emf emf;
+ Emf emf;
EXPECT_TRUE(emf.Init());
EXPECT_TRUE(emf.context() != NULL);
// An empty EMF is invalid, so we put at least a rectangle in it.
@@ -63,7 +63,7 @@ TEST(EmfTest, DC) {
}
// Playback the data.
- printing::Emf emf;
+ Emf emf;
EXPECT_TRUE(emf.InitFromData(&data.front(), size));
HDC hdc = CreateCompatibleDC(NULL);
EXPECT_TRUE(hdc);
@@ -77,15 +77,14 @@ TEST_F(EmfPrintingTest, Enumerate) {
if (IsTestCaseDisabled())
return;
- printing::PrintSettings settings;
+ PrintSettings settings;
// My test case is a HP Color LaserJet 4550 PCL.
settings.set_device_name(L"UnitTest Printer");
// Initialize it.
- scoped_ptr<printing::PrintingContext> context(
- printing::PrintingContext::Create(std::string()));
- EXPECT_EQ(context->InitWithSettings(settings), printing::PrintingContext::OK);
+ scoped_ptr<PrintingContext> context(PrintingContext::Create(std::string()));
+ EXPECT_EQ(context->InitWithSettings(settings), PrintingContext::OK);
FilePath emf_file;
EXPECT_TRUE(PathService::Get(base::DIR_SOURCE_ROOT, &emf_file));
@@ -94,22 +93,22 @@ TEST_F(EmfPrintingTest, Enumerate) {
.Append(FILE_PATH_LITERAL("data"))
.Append(FILE_PATH_LITERAL("test4.emf"));
// Load any EMF with an image.
- printing::Emf emf;
+ Emf emf;
std::string emf_data;
file_util::ReadFileToString(emf_file, &emf_data);
ASSERT_TRUE(emf_data.size());
EXPECT_TRUE(emf.InitFromData(&emf_data[0], emf_data.size()));
// This will print to file. The reason is that when running inside a
- // unit_test, printing::PrintingContext automatically dumps its files to the
+ // unit_test, PrintingContext automatically dumps its files to the
// current directory.
// TODO(maruel): Clean the .PRN file generated in current directory.
context->NewDocument(L"EmfTest.Enumerate");
context->NewPage();
// Process one at a time.
- printing::Emf::Enumerator emf_enum(emf, context->context(),
- &emf.GetPageBounds(1).ToRECT());
- for (printing::Emf::Enumerator::const_iterator itr = emf_enum.begin();
+ Emf::Enumerator emf_enum(emf, context->context(),
+ &emf.GetPageBounds(1).ToRECT());
+ for (Emf::Enumerator::const_iterator itr = emf_enum.begin();
itr != emf_enum.end();
++itr) {
// To help debugging.
@@ -133,7 +132,7 @@ TEST_F(EmfPrintingTest, PageBreak) {
uint32 size;
std::vector<BYTE> data;
{
- printing::Emf emf;
+ Emf emf;
EXPECT_TRUE(emf.Init());
EXPECT_TRUE(emf.context() != NULL);
int pages = 3;
@@ -155,7 +154,7 @@ TEST_F(EmfPrintingTest, PageBreak) {
di.cbSize = sizeof(DOCINFO);
di.lpszDocName = L"Test Job";
int job_id = ::StartDoc(dc.Get(), &di);
- printing::Emf emf;
+ Emf emf;
EXPECT_TRUE(emf.InitFromData(&data.front(), size));
EXPECT_TRUE(emf.SafePlayback(dc.Get()));
::EndDoc(dc.Get());
@@ -178,7 +177,7 @@ TEST(EmfTest, FileBackedEmf) {
uint32 size;
std::vector<BYTE> data;
{
- printing::Emf emf;
+ Emf emf;
EXPECT_TRUE(emf.InitToFile(metafile_path));
EXPECT_TRUE(emf.context() != NULL);
// An empty EMF is invalid, so we put at least a rectangle in it.
@@ -196,7 +195,7 @@ TEST(EmfTest, FileBackedEmf) {
// Playback the data.
HDC hdc = CreateCompatibleDC(NULL);
EXPECT_TRUE(hdc);
- printing::Emf emf;
+ Emf emf;
EXPECT_TRUE(emf.InitFromFile(metafile_path));
RECT output_rect = {0, 0, 10, 10};
EXPECT_TRUE(emf.Playback(hdc, &output_rect));
diff --git a/printing/image.cc b/printing/image.cc
index f9b177b..ee1956c 100644
--- a/printing/image.cc
+++ b/printing/image.cc
@@ -4,6 +4,8 @@
#include "printing/image.h"
+#include <algorithm>
+
#include "base/file_util.h"
#include "base/md5.h"
#include "base/string_number_conversions.h"
@@ -146,7 +148,7 @@ bool Image::LoadPng(const std::string& compressed) {
bool Image::LoadMetafile(const std::string& data) {
DCHECK(!data.empty());
- printing::NativeMetafile metafile;
+ NativeMetafile metafile;
if (!metafile.InitFromData(data.data(), data.size()))
return false;
return LoadMetafile(metafile);
diff --git a/printing/pdf_metafile_cg_mac_unittest.cc b/printing/pdf_metafile_cg_mac_unittest.cc
index 3948aa9..1a213ae 100644
--- a/printing/pdf_metafile_cg_mac_unittest.cc
+++ b/printing/pdf_metafile_cg_mac_unittest.cc
@@ -16,7 +16,7 @@ namespace printing {
TEST(PdfMetafileCgTest, Pdf) {
// Test in-renderer constructor.
- printing::PdfMetafileCg pdf;
+ PdfMetafileCg pdf;
EXPECT_TRUE(pdf.Init());
EXPECT_TRUE(pdf.context() != NULL);
@@ -43,7 +43,7 @@ TEST(PdfMetafileCgTest, Pdf) {
pdf.GetData(&buffer.front(), size);
// Test browser-side constructor.
- printing::PdfMetafileCg pdf2;
+ PdfMetafileCg pdf2;
EXPECT_TRUE(pdf2.InitFromData(&buffer.front(), size));
// Get the first 4 characters from pdf2.
diff --git a/printing/pdf_metafile_skia.cc b/printing/pdf_metafile_skia.cc
index 0ec540e..e2409b9 100644
--- a/printing/pdf_metafile_skia.cc
+++ b/printing/pdf_metafile_skia.cc
@@ -249,7 +249,7 @@ PdfMetafileSkia* PdfMetafileSkia::GetMetafileForCurrentPage() {
if (data.size() == 0)
return NULL;
- PdfMetafileSkia* metafile = new printing::PdfMetafileSkia;
+ PdfMetafileSkia* metafile = new PdfMetafileSkia;
metafile->InitFromData(data.bytes(), data.size());
return metafile;
}
diff --git a/printing/print_settings.cc b/printing/print_settings.cc
index d5a0a78..11828e2 100644
--- a/printing/print_settings.cc
+++ b/printing/print_settings.cc
@@ -28,83 +28,83 @@ void GetColorModelForMode(
color_setting_name->assign(kCUPSColorModel);
switch (color_mode) {
- case printing::COLOR:
- color_value->assign(printing::kColor);
+ case COLOR:
+ color_value->assign(kColor);
break;
- case printing::CMYK:
- color_value->assign(printing::kCMYK);
+ case CMYK:
+ color_value->assign(kCMYK);
break;
- case printing::PRINTOUTMODE_NORMAL:
- color_value->assign(printing::kNormal);
+ case PRINTOUTMODE_NORMAL:
+ color_value->assign(kNormal);
color_setting_name->assign(kCUPSPrintoutMode);
break;
- case printing::PRINTOUTMODE_NORMAL_GRAY:
- color_value->assign(printing::kNormalGray);
+ case PRINTOUTMODE_NORMAL_GRAY:
+ color_value->assign(kNormalGray);
color_setting_name->assign(kCUPSPrintoutMode);
break;
- case printing::RGB16:
- color_value->assign(printing::kRGB16);
+ case RGB16:
+ color_value->assign(kRGB16);
break;
- case printing::RGBA:
- color_value->assign(printing::kRGBA);
+ case RGBA:
+ color_value->assign(kRGBA);
break;
- case printing::RGB:
- color_value->assign(printing::kRGB);
+ case RGB:
+ color_value->assign(kRGB);
break;
- case printing::CMY:
- color_value->assign(printing::kCMY);
+ case CMY:
+ color_value->assign(kCMY);
break;
- case printing::CMY_K:
- color_value->assign(printing::kCMY_K);
+ case CMY_K:
+ color_value->assign(kCMY_K);
break;
- case printing::BLACK:
- color_value->assign(printing::kBlack);
+ case BLACK:
+ color_value->assign(kBlack);
break;
- case printing::GRAY:
- color_value->assign(printing::kGray);
+ case GRAY:
+ color_value->assign(kGray);
break;
- case printing::COLORMODE_COLOR:
+ case COLORMODE_COLOR:
color_setting_name->assign(kCUPSColorMode);
- color_value->assign(printing::kColor);
+ color_value->assign(kColor);
break;
- case printing::COLORMODE_MONOCHROME:
+ case COLORMODE_MONOCHROME:
color_setting_name->assign(kCUPSColorMode);
- color_value->assign(printing::kMonochrome);
+ color_value->assign(kMonochrome);
break;
- case printing::HP_COLOR_COLOR:
+ case HP_COLOR_COLOR:
color_setting_name->assign(kColor);
- color_value->assign(printing::kColor);
+ color_value->assign(kColor);
break;
- case printing::HP_COLOR_BLACK:
+ case HP_COLOR_BLACK:
color_setting_name->assign(kColor);
- color_value->assign(printing::kBlack);
+ color_value->assign(kBlack);
break;
- case printing::PROCESSCOLORMODEL_CMYK:
+ case PROCESSCOLORMODEL_CMYK:
color_setting_name->assign(kCUPSProcessColorModel);
- color_value->assign(printing::kCMYK);
+ color_value->assign(kCMYK);
break;
- case printing::PROCESSCOLORMODEL_GREYSCALE:
+ case PROCESSCOLORMODEL_GREYSCALE:
color_setting_name->assign(kCUPSProcessColorModel);
- color_value->assign(printing::kGreyscale);
+ color_value->assign(kGreyscale);
break;
- case printing::PROCESSCOLORMODEL_RGB:
+ case PROCESSCOLORMODEL_RGB:
color_setting_name->assign(kCUPSProcessColorModel);
- color_value->assign(printing::kRGB);
+ color_value->assign(kRGB);
break;
default:
- color_value->assign(printing::kGrayscale);
+ color_value->assign(kGrayscale);
break;
}
}
#endif
bool isColorModelSelected(int model) {
- return (model != printing::GRAY &&
- model != printing::BLACK &&
- model != printing::PRINTOUTMODE_NORMAL_GRAY &&
- model != printing::COLORMODE_MONOCHROME &&
- model != printing::PROCESSCOLORMODEL_GREYSCALE &&
- model != printing::HP_COLOR_BLACK);
+ return (model != GRAY &&
+ model != BLACK &&
+ model != PRINTOUTMODE_NORMAL_GRAY &&
+ model != COLORMODE_MONOCHROME &&
+ model != PROCESSCOLORMODEL_GREYSCALE &&
+ model != HP_COLOR_BLACK);
}
// Global SequenceNumber used for generating unique cookie values.
@@ -185,16 +185,16 @@ void PrintSettings::SetPrinterPrintableArea(
margins.header = 0;
margins.footer = 0;
margins.top = ConvertUnitDouble(custom_margins_in_points_.top,
- printing::kPointsPerInch,
+ kPointsPerInch,
units_per_inch);
margins.bottom = ConvertUnitDouble(custom_margins_in_points_.bottom,
- printing::kPointsPerInch,
+ kPointsPerInch,
units_per_inch);
margins.left = ConvertUnitDouble(custom_margins_in_points_.left,
- printing::kPointsPerInch,
+ kPointsPerInch,
units_per_inch);
margins.right = ConvertUnitDouble(custom_margins_in_points_.right,
- printing::kPointsPerInch,
+ kPointsPerInch,
units_per_inch);
break;
}
diff --git a/printing/print_settings_initializer.cc b/printing/print_settings_initializer.cc
index 82d6955..7a0f0e3c 100644
--- a/printing/print_settings_initializer.cc
+++ b/printing/print_settings_initializer.cc
@@ -6,6 +6,7 @@
#include <algorithm>
#include <cmath>
+#include <string>
#include "base/i18n/time_formatting.h"
#include "base/string_number_conversions.h"
@@ -19,38 +20,33 @@
#include "ui/base/text/text_elider.h"
using base::DictionaryValue;
-using base::Time;
-using printing::ConvertPointsToPixelDouble;
-using printing::ConvertUnitDouble;
-using printing::GetHeaderFooterSegmentWidth;
namespace printing {
void PrintSettingsInitializer::InitHeaderFooterStrings(
const DictionaryValue& job_settings,
PrintSettings* print_settings) {
- if (!job_settings.GetBoolean(printing::kSettingHeaderFooterEnabled,
+ if (!job_settings.GetBoolean(kSettingHeaderFooterEnabled,
&print_settings->display_header_footer)) {
NOTREACHED();
}
if (!print_settings->display_header_footer)
return;
- string16 date = base::TimeFormatShortDateNumeric(Time::Now());
+ string16 date = base::TimeFormatShortDateNumeric(base::Time::Now());
string16 title;
std::string url;
- if (!job_settings.GetString(printing::kSettingHeaderFooterTitle, &title) ||
- !job_settings.GetString(printing::kSettingHeaderFooterURL, &url)) {
+ if (!job_settings.GetString(kSettingHeaderFooterTitle, &title) ||
+ !job_settings.GetString(kSettingHeaderFooterURL, &url)) {
NOTREACHED();
}
- gfx::Font font(UTF8ToUTF16(printing::kSettingHeaderFooterFontName),
- ceil(ConvertPointsToPixelDouble(
- printing::kSettingHeaderFooterFontSize)));
+ gfx::Font font(
+ UTF8ToUTF16(kSettingHeaderFooterFontName),
+ ceil(ConvertPointsToPixelDouble(kSettingHeaderFooterFontSize)));
double segment_width = GetHeaderFooterSegmentWidth(ConvertUnitDouble(
print_settings->page_setup_device_units().physical_size().width(),
- print_settings->device_units_per_inch(),
- printing::kPixelsPerInch));
+ print_settings->device_units_per_inch(), kPixelsPerInch));
date = ui::ElideText(date, font, segment_width, false);
print_settings->date = date;
@@ -69,4 +65,3 @@ void PrintSettingsInitializer::InitHeaderFooterStrings(
}
} // namespace printing
-
diff --git a/printing/printed_document_mac.cc b/printing/printed_document_mac.cc
index 6915eac..3a7a1f0b 100644
--- a/printing/printed_document_mac.cc
+++ b/printing/printed_document_mac.cc
@@ -25,12 +25,11 @@ void PrintedDocument::RenderPrintedPage(
DCHECK(context);
- const printing::PageSetup& page_setup(
- immutable_.settings_.page_setup_device_units());
+ const PageSetup& page_setup(immutable_.settings_.page_setup_device_units());
gfx::Rect content_area;
page.GetCenteredPageContentRect(page_setup.physical_size(), &content_area);
- const printing::Metafile* metafile = page.metafile();
+ const Metafile* metafile = page.metafile();
// Each Metafile is a one-page PDF, and pages use 1-based indexing.
const int page_number = 1;
metafile->RenderPage(page_number, context, content_area.ToCGRect(),
diff --git a/printing/printed_document_win.cc b/printing/printed_document_win.cc
index 0a1e8b8..2d1a117 100644
--- a/printing/printed_document_win.cc
+++ b/printing/printed_document_win.cc
@@ -45,8 +45,7 @@ void PrintedDocument::RenderPrintedPage(
DCHECK(context);
- const printing::PageSetup& page_setup(
- immutable_.settings_.page_setup_device_units());
+ const PageSetup& page_setup(immutable_.settings_.page_setup_device_units());
gfx::Rect content_area;
page.GetCenteredPageContentRect(page_setup.physical_size(), &content_area);
diff --git a/printing/printing_context.cc b/printing/printing_context.cc
index 46c0e6e..cc39e6c 100644
--- a/printing/printing_context.cc
+++ b/printing/printing_context.cc
@@ -46,13 +46,13 @@ PrintingContext::Result PrintingContext::UpdatePrintSettings(
const PageRanges& ranges) {
ResetSettings();
- if (!job_settings.GetBoolean(printing::kSettingHeaderFooterEnabled,
+ if (!job_settings.GetBoolean(kSettingHeaderFooterEnabled,
&settings_.display_header_footer)) {
NOTREACHED();
}
int margin_type = DEFAULT_MARGINS;
- if (!job_settings.GetInteger(printing::kSettingMarginsType, &margin_type) ||
+ if (!job_settings.GetInteger(kSettingMarginsType, &margin_type) ||
(margin_type != DEFAULT_MARGINS &&
margin_type != NO_MARGINS &&
margin_type != CUSTOM_MARGINS &&
@@ -67,15 +67,13 @@ PrintingContext::Result PrintingContext::UpdatePrintSettings(
double left_margin_in_points = 0;
double right_margin_in_points = 0;
DictionaryValue* custom_margins;
- if (!job_settings.GetDictionary(printing::kSettingMarginsCustom,
- &custom_margins) ||
- !custom_margins->GetDouble(printing::kSettingMarginTop,
- &top_margin_in_points) ||
- !custom_margins->GetDouble(printing::kSettingMarginBottom,
+ if (!job_settings.GetDictionary(kSettingMarginsCustom, &custom_margins) ||
+ !custom_margins->GetDouble(kSettingMarginTop, &top_margin_in_points) ||
+ !custom_margins->GetDouble(kSettingMarginBottom,
&bottom_margin_in_points) ||
- !custom_margins->GetDouble(printing::kSettingMarginLeft,
+ !custom_margins->GetDouble(kSettingMarginLeft,
&left_margin_in_points) ||
- !custom_margins->GetDouble(printing::kSettingMarginRight,
+ !custom_margins->GetDouble(kSettingMarginRight,
&right_margin_in_points)) {
NOTREACHED();
}
@@ -90,8 +88,7 @@ PrintingContext::Result PrintingContext::UpdatePrintSettings(
}
PrintingContext::Result result = UpdatePrinterSettings(job_settings, ranges);
- printing::PrintSettingsInitializer::InitHeaderFooterStrings(job_settings,
- &settings_);
+ PrintSettingsInitializer::InitHeaderFooterStrings(job_settings, &settings_);
return result;
}
diff --git a/printing/printing_context_mac.mm b/printing/printing_context_mac.mm
index bfb9817..9008ead 100644
--- a/printing/printing_context_mac.mm
+++ b/printing/printing_context_mac.mm
@@ -123,7 +123,7 @@ PrintingContext::Result PrintingContextMac::UpdatePrinterSettings(
return OnError();
}
- bool print_to_cloud = job_settings.HasKey(printing::kSettingCloudPrintId);
+ bool print_to_cloud = job_settings.HasKey(kSettingCloudPrintId);
if (!print_to_pdf && !print_to_cloud && !is_cloud_dialog) {
if (!SetPrinter(device_name))
@@ -251,7 +251,7 @@ bool PrintingContextMac::SetOutputColor(int color_mode) {
static_cast<PMPrintSettings>([print_info_.get() PMPrintSettings]);
std::string color_setting_name;
std::string color_value;
- printing::GetColorModelForMode(color_mode, &color_setting_name, &color_value);
+ GetColorModelForMode(color_mode, &color_setting_name, &color_value);
base::mac::ScopedCFTypeRef<CFStringRef> color_setting(
base::SysUTF8ToCFStringRef(color_setting_name));
base::mac::ScopedCFTypeRef<CFStringRef> output_color(
diff --git a/printing/printing_context_win.cc b/printing/printing_context_win.cc
index e7c0f56..04b6481 100644
--- a/printing/printing_context_win.cc
+++ b/printing/printing_context_win.cc
@@ -346,7 +346,7 @@ PrintingContext::Result PrintingContextWin::UpdatePrinterSettings(
return OnError();
}
- bool print_to_cloud = job_settings.HasKey(printing::kSettingCloudPrintId);
+ bool print_to_cloud = job_settings.HasKey(kSettingCloudPrintId);
if (print_to_pdf || print_to_cloud || is_cloud_dialog) {
// Default fallback to Letter size.
@@ -409,7 +409,7 @@ PrintingContext::Result PrintingContextWin::UpdatePrinterSettings(
return OnError();
}
- if (color == printing::GRAY)
+ if (color == GRAY)
dev_mode->dmColor = DMCOLOR_MONOCHROME;
else
dev_mode->dmColor = DMCOLOR_COLOR;
diff --git a/printing/units.cc b/printing/units.cc
index 84d78bb..f1ec616 100644
--- a/printing/units.cc
+++ b/printing/units.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 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.
@@ -55,11 +55,10 @@ double ConvertPointsToPixelDouble(double points) {
double GetHeaderFooterSegmentWidth(double page_width) {
// Interstice is left at both ends of the page as well as between
// each region, so 1 is added.
- double total_interstice_width =
- (printing::kSettingHeaderFooterHorizontalRegions + 1) *
- printing::kSettingHeaderFooterInterstice;
+ double total_interstice_width = (kSettingHeaderFooterHorizontalRegions + 1) *
+ kSettingHeaderFooterInterstice;
return (page_width - total_interstice_width) /
- printing::kSettingHeaderFooterHorizontalRegions;
+ kSettingHeaderFooterHorizontalRegions;
}
} // namespace printing