| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "printing/printed_document.h" | 5 #include "printing/printed_document.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <set> | 8 #include <set> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "app/text_elider.h" | |
| 13 #include "base/file_path.h" | 12 #include "base/file_path.h" |
| 14 #include "base/file_util.h" | 13 #include "base/file_util.h" |
| 15 #include "base/i18n/file_util_icu.h" | 14 #include "base/i18n/file_util_icu.h" |
| 16 #include "base/lazy_instance.h" | 15 #include "base/lazy_instance.h" |
| 17 #include "base/message_loop.h" | 16 #include "base/message_loop.h" |
| 18 #include "base/string_util.h" | 17 #include "base/string_util.h" |
| 19 #include "base/utf_string_conversions.h" | 18 #include "base/utf_string_conversions.h" |
| 20 #include "base/i18n/time_formatting.h" | 19 #include "base/i18n/time_formatting.h" |
| 21 #include "gfx/font.h" | 20 #include "gfx/font.h" |
| 22 #include "printing/page_number.h" | 21 #include "printing/page_number.h" |
| 23 #include "printing/page_overlays.h" | 22 #include "printing/page_overlays.h" |
| 24 #include "printing/printed_pages_source.h" | 23 #include "printing/printed_pages_source.h" |
| 25 #include "printing/printed_page.h" | 24 #include "printing/printed_page.h" |
| 26 #include "printing/units.h" | 25 #include "printing/units.h" |
| 27 #include "skia/ext/platform_device.h" | 26 #include "skia/ext/platform_device.h" |
| 27 #include "ui/base/text/text_elider.h" |
| 28 | 28 |
| 29 namespace { | 29 namespace { |
| 30 | 30 |
| 31 struct PrintDebugDumpPath { | 31 struct PrintDebugDumpPath { |
| 32 PrintDebugDumpPath() | 32 PrintDebugDumpPath() |
| 33 : enabled(false) { | 33 : enabled(false) { |
| 34 } | 34 } |
| 35 | 35 |
| 36 bool enabled; | 36 bool enabled; |
| 37 FilePath debug_dump_path; | 37 FilePath debug_dump_path; |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 218 case PageOverlays::BOTTOM: | 218 case PageOverlays::BOTTOM: |
| 219 bounding.set_y(overlay_area.bottom() - string_size.height()); | 219 bounding.set_y(overlay_area.bottom() - string_size.height()); |
| 220 break; | 220 break; |
| 221 case PageOverlays::TOP: | 221 case PageOverlays::TOP: |
| 222 bounding.set_y(overlay_area.y()); | 222 bounding.set_y(overlay_area.y()); |
| 223 break; | 223 break; |
| 224 } | 224 } |
| 225 | 225 |
| 226 if (string_size.width() > bounding.width()) { | 226 if (string_size.width() > bounding.width()) { |
| 227 if (line == PageOverlays::kUrl) { | 227 if (line == PageOverlays::kUrl) { |
| 228 output = UTF16ToWideHack(gfx::ElideUrl(url(), font, bounding.width(), | 228 output = UTF16ToWideHack(ui::ElideUrl(url(), font, bounding.width(), |
| 229 std::wstring())); | 229 std::wstring())); |
| 230 } else { | 230 } else { |
| 231 output = UTF16ToWideHack(gfx::ElideText(WideToUTF16Hack(output), | 231 output = UTF16ToWideHack(ui::ElideText(WideToUTF16Hack(output), |
| 232 font, bounding.width(), false)); | 232 font, bounding.width(), false)); |
| 233 } | 233 } |
| 234 } | 234 } |
| 235 | 235 |
| 236 DrawHeaderFooter(context, output, bounding); | 236 DrawHeaderFooter(context, output, bounding); |
| 237 } | 237 } |
| 238 | 238 |
| 239 void PrintedDocument::DebugDump(const PrintedPage& page) { | 239 void PrintedDocument::DebugDump(const PrintedPage& page) { |
| 240 if (!g_debug_dump_info.Get().enabled) | 240 if (!g_debug_dump_info.Get().enabled) |
| 241 return; | 241 return; |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 284 name_(source->RenderSourceName()), | 284 name_(source->RenderSourceName()), |
| 285 url_(source->RenderSourceUrl()), | 285 url_(source->RenderSourceUrl()), |
| 286 cookie_(cookie) { | 286 cookie_(cookie) { |
| 287 SetDocumentDate(); | 287 SetDocumentDate(); |
| 288 } | 288 } |
| 289 | 289 |
| 290 PrintedDocument::Immutable::~Immutable() { | 290 PrintedDocument::Immutable::~Immutable() { |
| 291 } | 291 } |
| 292 | 292 |
| 293 } // namespace printing | 293 } // namespace printing |
| OLD | NEW |