Chromium Code Reviews| Index: printing/backend/print_backend.cc |
| diff --git a/printing/backend/print_backend.cc b/printing/backend/print_backend.cc |
| index b993bfc2212a55cedfb31a31443deac1f27c21f8..71f917d44bf394cbce0e30fc5db363f61adcb36b 100644 |
| --- a/printing/backend/print_backend.cc |
| +++ b/printing/backend/print_backend.cc |
| @@ -4,6 +4,18 @@ |
| #include "printing/backend/print_backend.h" |
| +#include <algorithm> |
| + |
| +#include "third_party/icu/public/common/unicode/uchar.h" |
| +#include "ui/base/text/text_elider.h" |
| + |
| +namespace { |
| + |
| +const wchar_t kDefaultDocumentTitle[] = L"Untitled Document"; |
| +const int kMaxDocumentTitleLength = 25; |
|
Albert Bodenhamer
2012/09/20 00:25:20
Is 25 long enough? We can start with this for now
|
| + |
| +} // namespace |
| + |
| namespace printing { |
| PrinterBasicInfo::PrinterBasicInfo() |
| @@ -26,4 +38,14 @@ PrinterCapsAndDefaults::~PrinterCapsAndDefaults() {} |
| PrintBackend::~PrintBackend() {} |
| +string16 PrintBackend::SimplifyDocumentTitle(const string16& title) { |
| + string16 no_controls(title); |
| + no_controls.erase( |
| + std::remove_if(no_controls.begin(), no_controls.end(), &u_iscntrl), |
| + no_controls.end()); |
| + string16 result; |
| + ui::ElideString(no_controls, kMaxDocumentTitleLength, &result); |
| + return result; |
| +} |
| + |
| } // namespace printing |