Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(356)

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

Issue 8138020: PrintPreview: Fix printer color settings issues based on printer ppd/schema information. (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. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | 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"
18 19
19 class FilePath; 20 class FilePath;
20 class PrintSystemTaskProxy; 21 class PrintSystemTaskProxy;
21 class TabContentsWrapper; 22 class TabContentsWrapper;
22 23
23 namespace base { 24 namespace base {
24 class DictionaryValue; 25 class DictionaryValue;
25 class FundamentalValue; 26 class FundamentalValue;
26 class StringValue; 27 class StringValue;
27 } 28 }
28 29
29 namespace printing { 30 namespace printing {
30 class PrintBackend; 31 class PrintBackend;
31 } 32 }
32 33
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
48 // The handler for Javascript messages related to the print preview dialog. 34 // The handler for Javascript messages related to the print preview dialog.
49 class PrintPreviewHandler : public WebUIMessageHandler, 35 class PrintPreviewHandler : public WebUIMessageHandler,
50 public base::SupportsWeakPtr<PrintPreviewHandler>, 36 public base::SupportsWeakPtr<PrintPreviewHandler>,
51 public SelectFileDialog::Listener, 37 public SelectFileDialog::Listener,
52 public printing::PrintViewManagerObserver { 38 public printing::PrintViewManagerObserver {
53 public: 39 public:
54 PrintPreviewHandler(); 40 PrintPreviewHandler();
55 virtual ~PrintPreviewHandler(); 41 virtual ~PrintPreviewHandler();
56 42
57 // WebUIMessageHandler implementation. 43 // WebUIMessageHandler implementation.
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 177
192 // Pointer to current print system. 178 // Pointer to current print system.
193 scoped_refptr<printing::PrintBackend> print_backend_; 179 scoped_refptr<printing::PrintBackend> print_backend_;
194 180
195 // The underlying dialog object. 181 // The underlying dialog object.
196 scoped_refptr<SelectFileDialog> select_file_dialog_; 182 scoped_refptr<SelectFileDialog> select_file_dialog_;
197 183
198 static FilePath* last_saved_path_; 184 static FilePath* last_saved_path_;
199 static std::string* last_used_printer_cloud_print_data_; 185 static std::string* last_used_printer_cloud_print_data_;
200 static std::string* last_used_printer_name_; 186 static std::string* last_used_printer_name_;
201 static bool last_used_color_setting_; 187 static printing::ColorModels last_used_color_model_;
vandebo (ex-Chrome) 2011/10/11 19:11:42 Does this mean that we could have used color (CMYK
kmadhusu 2011/10/11 21:36:03 (repeating our conversation): I don't compare the
202 188
203 // A count of how many requests received to regenerate preview data. 189 // A count of how many requests received to regenerate preview data.
204 // Initialized to 0 then incremented and emitted to a histogram. 190 // Initialized to 0 then incremented and emitted to a histogram.
205 int regenerate_preview_request_count_; 191 int regenerate_preview_request_count_;
206 192
207 // A count of how many requests received to show manage printers dialog. 193 // A count of how many requests received to show manage printers dialog.
208 int manage_printers_dialog_request_count_; 194 int manage_printers_dialog_request_count_;
209 195
210 // Whether we have already logged a failed print preview. 196 // Whether we have already logged a failed print preview.
211 bool reported_failed_preview_; 197 bool reported_failed_preview_;
212 198
213 // Whether we have already logged the number of printers this session. 199 // Whether we have already logged the number of printers this session.
214 bool has_logged_printers_count_; 200 bool has_logged_printers_count_;
215 201
216 // Holds the path to the print to pdf request. It is empty if no such request 202 // Holds the path to the print to pdf request. It is empty if no such request
217 // exists. 203 // exists.
218 scoped_ptr<FilePath> print_to_pdf_path_; 204 scoped_ptr<FilePath> print_to_pdf_path_;
219 205
220 DISALLOW_COPY_AND_ASSIGN(PrintPreviewHandler); 206 DISALLOW_COPY_AND_ASSIGN(PrintPreviewHandler);
221 }; 207 };
222 208
223 #endif // CHROME_BROWSER_UI_WEBUI_PRINT_PREVIEW_HANDLER_H_ 209 #endif // CHROME_BROWSER_UI_WEBUI_PRINT_PREVIEW_HANDLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698