OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #ifndef CHROME_BROWSER_UI_WEBUI_PRINT_PREVIEW_PRINT_PREVIEW_HANDLER_H_ | 5 #ifndef CHROME_BROWSER_UI_WEBUI_PRINT_PREVIEW_PRINT_PREVIEW_HANDLER_H_ |
6 #define CHROME_BROWSER_UI_WEBUI_PRINT_PREVIEW_PRINT_PREVIEW_HANDLER_H_ | 6 #define CHROME_BROWSER_UI_WEBUI_PRINT_PREVIEW_PRINT_PREVIEW_HANDLER_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "base/gtest_prod_util.h" | 11 #include "base/gtest_prod_util.h" |
12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
14 #include "base/memory/weak_ptr.h" | 14 #include "base/memory/weak_ptr.h" |
15 #include "build/build_config.h" | 15 #include "build/build_config.h" |
16 #include "chrome/browser/printing/print_view_manager_observer.h" | 16 #include "chrome/browser/printing/print_view_manager_observer.h" |
17 #include "chrome/browser/ui/select_file_dialog.h" | 17 #include "chrome/browser/ui/select_file_dialog.h" |
18 #include "content/public/browser/web_ui_message_handler.h" | 18 #include "content/public/browser/web_ui_message_handler.h" |
19 #include "printing/print_job_constants.h" | 19 #include "printing/print_job_constants.h" |
20 | 20 |
21 class FilePath; | 21 class FilePath; |
22 class PrintSystemTaskProxy; | 22 class PrintSystemTaskProxy; |
23 class TabContents; | 23 class TabContents; |
24 typedef TabContents TabContentsWrapper; | |
25 | 24 |
26 namespace base { | 25 namespace base { |
27 class DictionaryValue; | 26 class DictionaryValue; |
28 class RefCountedBytes; | 27 class RefCountedBytes; |
29 } | 28 } |
30 | 29 |
31 namespace printing { | 30 namespace printing { |
32 struct PageSizeMargins; | 31 struct PageSizeMargins; |
33 class PrintBackend; | 32 class PrintBackend; |
34 class StickySettings; | 33 class StickySettings; |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 friend class PrintSystemTaskProxy; | 74 friend class PrintSystemTaskProxy; |
76 FRIEND_TEST_ALL_PREFIXES(PrintPreviewHandlerTest, StickyMarginsCustom); | 75 FRIEND_TEST_ALL_PREFIXES(PrintPreviewHandlerTest, StickyMarginsCustom); |
77 FRIEND_TEST_ALL_PREFIXES(PrintPreviewHandlerTest, StickyMarginsDefault); | 76 FRIEND_TEST_ALL_PREFIXES(PrintPreviewHandlerTest, StickyMarginsDefault); |
78 FRIEND_TEST_ALL_PREFIXES(PrintPreviewHandlerTest, | 77 FRIEND_TEST_ALL_PREFIXES(PrintPreviewHandlerTest, |
79 StickyMarginsCustomThenDefault); | 78 StickyMarginsCustomThenDefault); |
80 FRIEND_TEST_ALL_PREFIXES(PrintPreviewHandlerTest, | 79 FRIEND_TEST_ALL_PREFIXES(PrintPreviewHandlerTest, |
81 GetLastUsedMarginSettingsCustom); | 80 GetLastUsedMarginSettingsCustom); |
82 FRIEND_TEST_ALL_PREFIXES(PrintPreviewHandlerTest, | 81 FRIEND_TEST_ALL_PREFIXES(PrintPreviewHandlerTest, |
83 GetLastUsedMarginSettingsDefault); | 82 GetLastUsedMarginSettingsDefault); |
84 | 83 |
85 TabContentsWrapper* preview_tab_wrapper() const; | 84 TabContents* preview_tab_contents() const; |
86 content::WebContents* preview_tab() const; | 85 content::WebContents* preview_web_contents() const; |
87 | 86 |
88 // Gets the list of printers. |args| is unused. | 87 // Gets the list of printers. |args| is unused. |
89 void HandleGetPrinters(const base::ListValue* args); | 88 void HandleGetPrinters(const base::ListValue* args); |
90 | 89 |
91 // Asks the initiator renderer to generate a preview. First element of |args| | 90 // Asks the initiator renderer to generate a preview. First element of |args| |
92 // is a job settings JSON string. | 91 // is a job settings JSON string. |
93 void HandleGetPreview(const base::ListValue* args); | 92 void HandleGetPreview(const base::ListValue* args); |
94 | 93 |
95 // Gets the job settings from Web UI and initiate printing. First element of | 94 // Gets the job settings from Web UI and initiate printing. First element of |
96 // |args| is a job settings JSON string. | 95 // |args| is a job settings JSON string. |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 void SetupPrinterList(const base::ListValue& printers); | 160 void SetupPrinterList(const base::ListValue& printers); |
162 | 161 |
163 // Send whether cloud print integration should be enabled. | 162 // Send whether cloud print integration should be enabled. |
164 void SendCloudPrintEnabled(); | 163 void SendCloudPrintEnabled(); |
165 | 164 |
166 // Send the PDF data to the cloud to print. | 165 // Send the PDF data to the cloud to print. |
167 void SendCloudPrintJob(const base::DictionaryValue& settings, | 166 void SendCloudPrintJob(const base::DictionaryValue& settings, |
168 std::string print_ticket); | 167 std::string print_ticket); |
169 | 168 |
170 // Gets the initiator tab for the print preview tab. | 169 // Gets the initiator tab for the print preview tab. |
171 TabContentsWrapper* GetInitiatorTab() const; | 170 TabContents* GetInitiatorTab() const; |
172 | 171 |
173 // Activates the initiator tab and close the preview tab. | 172 // Activates the initiator tab and close the preview tab. |
174 void ActivateInitiatorTabAndClosePreviewTab(); | 173 void ActivateInitiatorTabAndClosePreviewTab(); |
175 | 174 |
176 // Adds all the recorded stats taken so far to histogram counts. | 175 // Adds all the recorded stats taken so far to histogram counts. |
177 void ReportStats(); | 176 void ReportStats(); |
178 | 177 |
179 // Clears initiator tab details for this preview tab. | 178 // Clears initiator tab details for this preview tab. |
180 void ClearInitiatorTabDetails(); | 179 void ClearInitiatorTabDetails(); |
181 | 180 |
(...skipping 26 matching lines...) Expand all Loading... |
208 bool has_logged_printers_count_; | 207 bool has_logged_printers_count_; |
209 | 208 |
210 // Holds the path to the print to pdf request. It is empty if no such request | 209 // Holds the path to the print to pdf request. It is empty if no such request |
211 // exists. | 210 // exists. |
212 scoped_ptr<FilePath> print_to_pdf_path_; | 211 scoped_ptr<FilePath> print_to_pdf_path_; |
213 | 212 |
214 DISALLOW_COPY_AND_ASSIGN(PrintPreviewHandler); | 213 DISALLOW_COPY_AND_ASSIGN(PrintPreviewHandler); |
215 }; | 214 }; |
216 | 215 |
217 #endif // CHROME_BROWSER_UI_WEBUI_PRINT_PREVIEW_PRINT_PREVIEW_HANDLER_H_ | 216 #endif // CHROME_BROWSER_UI_WEBUI_PRINT_PREVIEW_PRINT_PREVIEW_HANDLER_H_ |
OLD | NEW |