Chromium Code Reviews

Side by Side Diff: chrome/browser/ui/webui/print_preview_handler.h

Issue 8245012: Revert 105087 - PrintPreview: Fix printer color settings issues based on printer ppd/schema infor... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | | Annotate | Revision Log
OLDNEW
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 #ifndef CHROME_BROWSER_UI_WEBUI_PRINT_PREVIEW_HANDLER_H_ 5 #ifndef CHROME_BROWSER_UI_WEBUI_PRINT_PREVIEW_HANDLER_H_
6 #define CHROME_BROWSER_UI_WEBUI_PRINT_PREVIEW_HANDLER_H_ 6 #define CHROME_BROWSER_UI_WEBUI_PRINT_PREVIEW_HANDLER_H_
7 #pragma once 7 #pragma once
8 8
9 #include <string> 9 #include <string>
10 10
11 #include "base/memory/ref_counted.h" 11 #include "base/memory/ref_counted.h"
12 #include "base/memory/scoped_ptr.h" 12 #include "base/memory/scoped_ptr.h"
13 #include "base/memory/weak_ptr.h" 13 #include "base/memory/weak_ptr.h"
14 #include "build/build_config.h" 14 #include "build/build_config.h"
15 #include "chrome/browser/printing/print_view_manager_observer.h" 15 #include "chrome/browser/printing/print_view_manager_observer.h"
16 #include "chrome/browser/ui/shell_dialogs.h" 16 #include "chrome/browser/ui/shell_dialogs.h"
17 #include "content/browser/webui/web_ui.h" 17 #include "content/browser/webui/web_ui.h"
18 #include "printing/print_job_constants.h"
19 18
20 class FilePath; 19 class FilePath;
21 class PrintSystemTaskProxy; 20 class PrintSystemTaskProxy;
22 class TabContentsWrapper; 21 class TabContentsWrapper;
23 22
24 namespace base { 23 namespace base {
25 class DictionaryValue; 24 class DictionaryValue;
26 class FundamentalValue; 25 class FundamentalValue;
27 class StringValue; 26 class StringValue;
28 } 27 }
29 28
30 namespace printing { 29 namespace printing {
31 class PrintBackend; 30 class PrintBackend;
32 } 31 }
33 32
33 #if defined(UNIT_TEST) && defined(USE_CUPS) && !defined(OS_MACOSX)
34 typedef struct cups_option_s cups_option_t;
35
36 namespace printing_internal {
37
38 // Helper function to parse the lpoptions custom settings. |num_options| and
39 // |options| will be updated if the custom settings for |printer_name| are
40 // found, otherwise nothing is done.
41 // NOTE: This function is declared here so it can be exposed for unit testing.
42 void parse_lpoptions(const FilePath& filepath, const std::string& printer_name,
43 int* num_options, cups_option_t** options);
44
45 } // namespace printing_internal
46 #endif
47
34 // The handler for Javascript messages related to the print preview dialog. 48 // The handler for Javascript messages related to the print preview dialog.
35 class PrintPreviewHandler : public WebUIMessageHandler, 49 class PrintPreviewHandler : public WebUIMessageHandler,
36 public base::SupportsWeakPtr<PrintPreviewHandler>, 50 public base::SupportsWeakPtr<PrintPreviewHandler>,
37 public SelectFileDialog::Listener, 51 public SelectFileDialog::Listener,
38 public printing::PrintViewManagerObserver { 52 public printing::PrintViewManagerObserver {
39 public: 53 public:
40 PrintPreviewHandler(); 54 PrintPreviewHandler();
41 virtual ~PrintPreviewHandler(); 55 virtual ~PrintPreviewHandler();
42 56
43 // WebUIMessageHandler implementation. 57 // WebUIMessageHandler implementation.
(...skipping 133 matching lines...)
177 191
178 // Pointer to current print system. 192 // Pointer to current print system.
179 scoped_refptr<printing::PrintBackend> print_backend_; 193 scoped_refptr<printing::PrintBackend> print_backend_;
180 194
181 // The underlying dialog object. 195 // The underlying dialog object.
182 scoped_refptr<SelectFileDialog> select_file_dialog_; 196 scoped_refptr<SelectFileDialog> select_file_dialog_;
183 197
184 static FilePath* last_saved_path_; 198 static FilePath* last_saved_path_;
185 static std::string* last_used_printer_cloud_print_data_; 199 static std::string* last_used_printer_cloud_print_data_;
186 static std::string* last_used_printer_name_; 200 static std::string* last_used_printer_name_;
187 static printing::ColorModels last_used_color_model_; 201 static bool last_used_color_setting_;
188 202
189 // A count of how many requests received to regenerate preview data. 203 // A count of how many requests received to regenerate preview data.
190 // Initialized to 0 then incremented and emitted to a histogram. 204 // Initialized to 0 then incremented and emitted to a histogram.
191 int regenerate_preview_request_count_; 205 int regenerate_preview_request_count_;
192 206
193 // A count of how many requests received to show manage printers dialog. 207 // A count of how many requests received to show manage printers dialog.
194 int manage_printers_dialog_request_count_; 208 int manage_printers_dialog_request_count_;
195 209
196 // Whether we have already logged a failed print preview. 210 // Whether we have already logged a failed print preview.
197 bool reported_failed_preview_; 211 bool reported_failed_preview_;
198 212
199 // Whether we have already logged the number of printers this session. 213 // Whether we have already logged the number of printers this session.
200 bool has_logged_printers_count_; 214 bool has_logged_printers_count_;
201 215
202 // Holds the path to the print to pdf request. It is empty if no such request 216 // Holds the path to the print to pdf request. It is empty if no such request
203 // exists. 217 // exists.
204 scoped_ptr<FilePath> print_to_pdf_path_; 218 scoped_ptr<FilePath> print_to_pdf_path_;
205 219
206 DISALLOW_COPY_AND_ASSIGN(PrintPreviewHandler); 220 DISALLOW_COPY_AND_ASSIGN(PrintPreviewHandler);
207 }; 221 };
208 222
209 #endif // CHROME_BROWSER_UI_WEBUI_PRINT_PREVIEW_HANDLER_H_ 223 #endif // CHROME_BROWSER_UI_WEBUI_PRINT_PREVIEW_HANDLER_H_
OLDNEW
« no previous file with comments | « chrome/browser/resources/print_preview/print_preview.js ('k') | chrome/browser/ui/webui/print_preview_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine