| Index: chrome/browser/printing/print_preview_data_service.cc
|
| diff --git a/chrome/browser/printing/print_preview_data_service.cc b/chrome/browser/printing/print_preview_data_service.cc
|
| index 53ba36f81e00e1d493b537171e8a319568e3f184..cd692162ecf444c5396612b7b1f8391bf4a82668 100644
|
| --- a/chrome/browser/printing/print_preview_data_service.cc
|
| +++ b/chrome/browser/printing/print_preview_data_service.cc
|
| @@ -49,6 +49,15 @@ class PrintPreviewDataStore : public base::RefCounted<PrintPreviewDataStore> {
|
| page_data_map_[index] = const_cast<RefCountedBytes*>(data);
|
| }
|
|
|
| + // Returns true if the draft pages is available.
|
| + bool IsDraftPagesAvailable(int draft_page_count) {
|
| + int page_data_map_size = page_data_map_.size();
|
| + return (page_data_map_size > draft_page_count ||
|
| + (page_data_map_size == draft_page_count &&
|
| + (page_data_map_.find(printing::COMPLETE_PREVIEW_DOCUMENT_INDEX) ==
|
| + page_data_map_.end())));
|
| + }
|
| +
|
| private:
|
| friend class base::RefCounted<PrintPreviewDataStore>;
|
|
|
| @@ -105,3 +114,13 @@ void PrintPreviewDataService::RemoveEntry(
|
| if (it != data_store_map_.end())
|
| data_store_map_.erase(it);
|
| }
|
| +
|
| +bool PrintPreviewDataService::IsDraftPagesAvailable(
|
| + const std::string& preview_ui_addr_str,
|
| + int draft_page_count) {
|
| + if (data_store_map_.find(preview_ui_addr_str) != data_store_map_.end()) {
|
| + return data_store_map_[preview_ui_addr_str]->IsDraftPagesAvailable(
|
| + draft_page_count);
|
| + }
|
| + return false;
|
| +}
|
|
|