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 "base/metrics/histogram.h" | 7 #include "base/metrics/histogram.h" |
8 #include "base/string_util.h" | 8 #include "base/string_util.h" |
9 #include "base/values.h" | 9 #include "base/values.h" |
10 #include "chrome/browser/printing/print_preview_data_service.h" | 10 #include "chrome/browser/printing/print_preview_data_service.h" |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 | 46 |
47 void PrintPreviewUI::SetPrintPreviewDataForIndex(int index, | 47 void PrintPreviewUI::SetPrintPreviewDataForIndex(int index, |
48 const RefCountedBytes* data) { | 48 const RefCountedBytes* data) { |
49 print_preview_data_service()->SetDataEntry(preview_ui_addr_str_, index, data); | 49 print_preview_data_service()->SetDataEntry(preview_ui_addr_str_, index, data); |
50 } | 50 } |
51 | 51 |
52 void PrintPreviewUI::ClearAllPreviewData() { | 52 void PrintPreviewUI::ClearAllPreviewData() { |
53 print_preview_data_service()->RemoveEntry(preview_ui_addr_str_); | 53 print_preview_data_service()->RemoveEntry(preview_ui_addr_str_); |
54 } | 54 } |
55 | 55 |
56 void PrintPreviewUI::OnInitiatorTabClosed( | 56 void PrintPreviewUI::SetInitiatorTabURL(const std::string& initiator_url) { |
57 const std::string& initiator_url) { | 57 initiator_url_ = initiator_url; |
58 StringValue initiator_tab_url(initiator_url); | 58 } |
| 59 |
| 60 void PrintPreviewUI::OnInitiatorTabCrashed() { |
| 61 StringValue initiator_tab_url(initiator_url_); |
| 62 CallJavascriptFunction("onInitiatorTabCrashed", initiator_tab_url); |
| 63 } |
| 64 |
| 65 void PrintPreviewUI::OnInitiatorTabClosed() { |
| 66 StringValue initiator_tab_url(initiator_url_); |
59 CallJavascriptFunction("onInitiatorTabClosed", initiator_tab_url); | 67 CallJavascriptFunction("onInitiatorTabClosed", initiator_tab_url); |
60 } | 68 } |
61 | 69 |
62 void PrintPreviewUI::OnPrintPreviewRequest() { | 70 void PrintPreviewUI::OnPrintPreviewRequest() { |
63 request_count_++; | 71 request_count_++; |
64 } | 72 } |
65 | 73 |
66 void PrintPreviewUI::OnDidGetPreviewPageCount(int document_cookie, | 74 void PrintPreviewUI::OnDidGetPreviewPageCount(int document_cookie, |
67 int page_count, | 75 int page_count, |
68 bool is_modifiable) { | 76 bool is_modifiable) { |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 } | 144 } |
137 | 145 |
138 void PrintPreviewUI::DecrementRequestCount() { | 146 void PrintPreviewUI::DecrementRequestCount() { |
139 if (request_count_ > 0) | 147 if (request_count_ > 0) |
140 request_count_--; | 148 request_count_--; |
141 } | 149 } |
142 | 150 |
143 int PrintPreviewUI::document_cookie() { | 151 int PrintPreviewUI::document_cookie() { |
144 return document_cookie_; | 152 return document_cookie_; |
145 } | 153 } |
OLD | NEW |