OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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/scoped_ptr.h" | 8 #include "base/scoped_ptr.h" |
| 9 #include "base/ref_counted.h" |
9 #include "chrome/browser/printing/print_job_worker_owner.h" | 10 #include "chrome/browser/printing/print_job_worker_owner.h" |
10 | 11 |
11 class CancelableTask; | 12 class CancelableTask; |
12 class MessageLoop; | 13 class MessageLoop; |
13 | 14 |
14 namespace base { | 15 namespace base { |
15 class Thread; | 16 class Thread; |
16 } | 17 } |
17 | 18 |
18 namespace printing { | 19 namespace printing { |
19 | 20 |
20 class PrintJobWorker; | 21 class PrintJobWorker; |
21 | 22 |
22 // Query the printer for settings. | 23 // Query the printer for settings. |
23 class PrinterQuery : public PrintJobWorkerOwner { | 24 class PrinterQuery : public base::RefCountedThreadSafe<PrinterQuery>, |
| 25 public PrintJobWorkerOwner { |
24 public: | 26 public: |
25 // GetSettings() UI parameter. | 27 // GetSettings() UI parameter. |
26 enum GetSettingsAskParam { | 28 enum GetSettingsAskParam { |
27 DEFAULTS, | 29 DEFAULTS, |
28 ASK_USER, | 30 ASK_USER, |
29 }; | 31 }; |
30 | 32 |
31 PrinterQuery(); | 33 PrinterQuery(); |
32 virtual ~PrinterQuery(); | 34 virtual ~PrinterQuery(); |
33 | 35 |
34 // PrintJobWorkerOwner | 36 // PrintJobWorkerOwner |
| 37 virtual void AddRef() { |
| 38 return base::RefCountedThreadSafe<PrinterQuery>::AddRef(); |
| 39 } |
| 40 virtual void Release() { |
| 41 return base::RefCountedThreadSafe<PrinterQuery>::Release(); |
| 42 } |
35 virtual void GetSettingsDone(const PrintSettings& new_settings, | 43 virtual void GetSettingsDone(const PrintSettings& new_settings, |
36 PrintingContext::Result result); | 44 PrintingContext::Result result); |
37 virtual PrintJobWorker* DetachWorker(PrintJobWorkerOwner* new_owner); | 45 virtual PrintJobWorker* DetachWorker(PrintJobWorkerOwner* new_owner); |
38 virtual MessageLoop* message_loop() { | 46 virtual MessageLoop* message_loop() { |
39 return ui_message_loop_; | 47 return ui_message_loop_; |
40 } | 48 } |
41 virtual const PrintSettings& settings() const { return settings_; } | 49 virtual const PrintSettings& settings() const { return settings_; } |
42 | 50 |
43 virtual int cookie() const { return cookie_; } | 51 virtual int cookie() const { return cookie_; } |
44 | 52 |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 | 98 |
91 // Task waiting to be executed. | 99 // Task waiting to be executed. |
92 scoped_ptr<CancelableTask> callback_; | 100 scoped_ptr<CancelableTask> callback_; |
93 | 101 |
94 DISALLOW_COPY_AND_ASSIGN(PrinterQuery); | 102 DISALLOW_COPY_AND_ASSIGN(PrinterQuery); |
95 }; | 103 }; |
96 | 104 |
97 } // namespace printing | 105 } // namespace printing |
98 | 106 |
99 #endif // CHROME_BROWSER_PRINTING_PRINTER_QUERY_H_ | 107 #endif // CHROME_BROWSER_PRINTING_PRINTER_QUERY_H_ |
OLD | NEW |