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_PRINTING_PRINTER_QUERY_H_ | 5 #ifndef CHROME_BROWSER_PRINTING_PRINTER_QUERY_H_ |
6 #define CHROME_BROWSER_PRINTING_PRINTER_QUERY_H_ | 6 #define CHROME_BROWSER_PRINTING_PRINTER_QUERY_H_ |
7 | 7 |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
11 #include "chrome/browser/printing/print_job_worker_owner.h" | 11 #include "chrome/browser/printing/print_job_worker_owner.h" |
12 #include "printing/print_job_constants.h" | 12 #include "printing/print_job_constants.h" |
13 #include "ui/gfx/native_widget_types.h" | 13 |
| 14 class PrintingUIWebContentsObserver; |
14 | 15 |
15 namespace base { | 16 namespace base { |
16 class DictionaryValue; | 17 class DictionaryValue; |
17 class MessageLoop; | 18 class MessageLoop; |
18 } | 19 } |
19 | 20 |
20 namespace printing { | 21 namespace printing { |
21 | 22 |
22 class PrintDestinationInterface; | 23 class PrintDestinationInterface; |
23 class PrintJobWorker; | 24 class PrintJobWorker; |
24 | 25 |
25 // Query the printer for settings. | 26 // Query the printer for settings. |
26 class PrinterQuery : public PrintJobWorkerOwner { | 27 class PrinterQuery : public PrintJobWorkerOwner { |
27 public: | 28 public: |
28 // GetSettings() UI parameter. | 29 // GetSettings() UI parameter. |
29 enum GetSettingsAskParam { | 30 enum GetSettingsAskParam { |
30 DEFAULTS, | 31 DEFAULTS, |
31 ASK_USER, | 32 ASK_USER, |
32 }; | 33 }; |
33 | 34 |
34 PrinterQuery(); | 35 PrinterQuery(); |
35 | 36 |
36 // PrintJobWorkerOwner implementation. | 37 // PrintJobWorkerOwner implementation. |
37 virtual void GetSettingsDone(const PrintSettings& new_settings, | 38 virtual void GetSettingsDone(const PrintSettings& new_settings, |
38 PrintingContext::Result result) OVERRIDE; | 39 PrintingContext::Result result) OVERRIDE; |
39 virtual PrintJobWorker* DetachWorker(PrintJobWorkerOwner* new_owner) OVERRIDE; | 40 virtual PrintJobWorker* DetachWorker(PrintJobWorkerOwner* new_owner) OVERRIDE; |
40 virtual base::MessageLoop* message_loop() OVERRIDE; | 41 virtual base::MessageLoop* message_loop() OVERRIDE; |
41 virtual const PrintSettings& settings() const OVERRIDE; | 42 virtual const PrintSettings& settings() const OVERRIDE; |
42 virtual int cookie() const OVERRIDE; | 43 virtual int cookie() const OVERRIDE; |
43 | 44 |
44 // Initializes the printing context. It is fine to call this function multiple | 45 // Initializes the printing context. It is fine to call this function multiple |
45 // times to reinitialize the settings. |parent_view| parameter's window will | 46 // times to reinitialize the settings. |web_contents_observer| can be queried |
46 // be the owner of the print setting dialog box. It is unused when | 47 // to find the owner of the print setting dialog box. It is unused when |
47 // |ask_for_user_settings| is DEFAULTS. | 48 // |ask_for_user_settings| is DEFAULTS. |
48 void GetSettings(GetSettingsAskParam ask_user_for_settings, | 49 void GetSettings( |
49 gfx::NativeView parent_view, | 50 GetSettingsAskParam ask_user_for_settings, |
50 int expected_page_count, | 51 scoped_ptr<PrintingUIWebContentsObserver> web_contents_observer, |
51 bool has_selection, | 52 int expected_page_count, |
52 MarginType margin_type, | 53 bool has_selection, |
53 const base::Closure& callback); | 54 MarginType margin_type, |
| 55 const base::Closure& callback); |
54 | 56 |
55 // Updates the current settings with |new_settings| dictionary values. | 57 // Updates the current settings with |new_settings| dictionary values. |
56 void SetSettings(const base::DictionaryValue& new_settings, | 58 void SetSettings(const base::DictionaryValue& new_settings, |
57 const base::Closure& callback); | 59 const base::Closure& callback); |
58 | 60 |
59 // Set a destination for the worker. | 61 // Set a destination for the worker. |
60 void SetWorkerDestination(PrintDestinationInterface* destination); | 62 void SetWorkerDestination(PrintDestinationInterface* destination); |
61 | 63 |
62 // Stops the worker thread since the client is done with this object. | 64 // Stops the worker thread since the client is done with this object. |
63 void StopWorker(); | 65 void StopWorker(); |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 | 101 |
100 // Callback waiting to be run. | 102 // Callback waiting to be run. |
101 base::Closure callback_; | 103 base::Closure callback_; |
102 | 104 |
103 DISALLOW_COPY_AND_ASSIGN(PrinterQuery); | 105 DISALLOW_COPY_AND_ASSIGN(PrinterQuery); |
104 }; | 106 }; |
105 | 107 |
106 } // namespace printing | 108 } // namespace printing |
107 | 109 |
108 #endif // CHROME_BROWSER_PRINTING_PRINTER_QUERY_H_ | 110 #endif // CHROME_BROWSER_PRINTING_PRINTER_QUERY_H_ |
OLD | NEW |