| 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> |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 PrintedPages::const_iterator itr = mutable_.pages_.find(page_number); | 95 PrintedPages::const_iterator itr = mutable_.pages_.find(page_number); |
| 96 if (itr != mutable_.pages_.end()) { | 96 if (itr != mutable_.pages_.end()) { |
| 97 if (itr->second.get()) { | 97 if (itr->second.get()) { |
| 98 *page = itr->second; | 98 *page = itr->second; |
| 99 return true; | 99 return true; |
| 100 } | 100 } |
| 101 } | 101 } |
| 102 return false; | 102 return false; |
| 103 } | 103 } |
| 104 | 104 |
| 105 bool PrintedDocument::RenderPrintedPageNumber( | |
| 106 int page_number, gfx::NativeDrawingContext context) { | |
| 107 scoped_refptr<PrintedPage> page; | |
| 108 if (!GetPage(page_number, &page)) | |
| 109 return false; | |
| 110 RenderPrintedPage(*page.get(), context); | |
| 111 return true; | |
| 112 } | |
| 113 | |
| 114 bool PrintedDocument::IsComplete() const { | 105 bool PrintedDocument::IsComplete() const { |
| 115 AutoLock lock(lock_); | 106 AutoLock lock(lock_); |
| 116 if (!mutable_.page_count_) | 107 if (!mutable_.page_count_) |
| 117 return false; | 108 return false; |
| 118 PageNumber page(immutable_.settings_, mutable_.page_count_); | 109 PageNumber page(immutable_.settings_, mutable_.page_count_); |
| 119 if (page == PageNumber::npos()) | 110 if (page == PageNumber::npos()) |
| 120 return false; | 111 return false; |
| 121 for (; page != PageNumber::npos(); ++page) { | 112 for (; page != PageNumber::npos(); ++page) { |
| 122 PrintedPages::const_iterator itr = mutable_.pages_.find(page.ToInt()); | 113 PrintedPages::const_iterator itr = mutable_.pages_.find(page.ToInt()); |
| 123 if (itr == mutable_.pages_.end() || !itr->second.get() || | 114 if (itr == mutable_.pages_.end() || !itr->second.get() || |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 292 name_(source->RenderSourceName()), | 283 name_(source->RenderSourceName()), |
| 293 url_(source->RenderSourceUrl()), | 284 url_(source->RenderSourceUrl()), |
| 294 cookie_(cookie) { | 285 cookie_(cookie) { |
| 295 SetDocumentDate(); | 286 SetDocumentDate(); |
| 296 } | 287 } |
| 297 | 288 |
| 298 PrintedDocument::Immutable::~Immutable() { | 289 PrintedDocument::Immutable::~Immutable() { |
| 299 } | 290 } |
| 300 | 291 |
| 301 } // namespace printing | 292 } // namespace printing |
| OLD | NEW |