OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "chrome/browser/ui/webui/print_preview_ui.h" | 5 #include "chrome/browser/ui/webui/print_preview_ui.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 | 8 |
9 #include "base/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 | 97 |
98 void PrintPreviewUI::SetPrintPreviewDataForIndex(int index, | 98 void PrintPreviewUI::SetPrintPreviewDataForIndex(int index, |
99 const RefCountedBytes* data) { | 99 const RefCountedBytes* data) { |
100 print_preview_data_service()->SetDataEntry(preview_ui_addr_str_, index, data); | 100 print_preview_data_service()->SetDataEntry(preview_ui_addr_str_, index, data); |
101 } | 101 } |
102 | 102 |
103 void PrintPreviewUI::ClearAllPreviewData() { | 103 void PrintPreviewUI::ClearAllPreviewData() { |
104 print_preview_data_service()->RemoveEntry(preview_ui_addr_str_); | 104 print_preview_data_service()->RemoveEntry(preview_ui_addr_str_); |
105 } | 105 } |
106 | 106 |
| 107 int PrintPreviewUI::GetAvailableDraftPageCount() { |
| 108 return print_preview_data_service()->GetAvailableDraftPageCount( |
| 109 preview_ui_addr_str_); |
| 110 } |
| 111 |
107 void PrintPreviewUI::SetInitiatorTabURLAndTitle( | 112 void PrintPreviewUI::SetInitiatorTabURLAndTitle( |
108 const std::string& initiator_url, | 113 const std::string& initiator_url, |
109 const string16& job_title) { | 114 const string16& job_title) { |
110 initiator_url_ = initiator_url; | 115 initiator_url_ = initiator_url; |
111 initiator_tab_title_ = job_title; | 116 initiator_tab_title_ = job_title; |
112 } | 117 } |
113 | 118 |
114 // static | 119 // static |
115 void PrintPreviewUI::GetCurrentPrintPreviewStatus( | 120 void PrintPreviewUI::GetCurrentPrintPreviewStatus( |
116 const std::string& preview_ui_addr, | 121 const std::string& preview_ui_addr, |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
228 } | 233 } |
229 | 234 |
230 void PrintPreviewUI::OnPrintPreviewFailed() { | 235 void PrintPreviewUI::OnPrintPreviewFailed() { |
231 handler_->OnPrintPreviewFailed(); | 236 handler_->OnPrintPreviewFailed(); |
232 CallJavascriptFunction("printPreviewFailed"); | 237 CallJavascriptFunction("printPreviewFailed"); |
233 } | 238 } |
234 | 239 |
235 PrintPreviewDataService* PrintPreviewUI::print_preview_data_service() { | 240 PrintPreviewDataService* PrintPreviewUI::print_preview_data_service() { |
236 return PrintPreviewDataService::GetInstance(); | 241 return PrintPreviewDataService::GetInstance(); |
237 } | 242 } |
OLD | NEW |