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

Side by Side Diff: chrome/browser/printing/print_job_worker.h

Issue 3610013: Printing: Convert PrintingContext into an interface implemented by the separate (Closed)
Patch Set: Comment cleanup only. Created 10 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
OLDNEW
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_PRINT_JOB_WORKER_H__ 5 #ifndef CHROME_BROWSER_PRINTING_PRINT_JOB_WORKER_H__
6 #define CHROME_BROWSER_PRINTING_PRINT_JOB_WORKER_H__ 6 #define CHROME_BROWSER_PRINTING_PRINT_JOB_WORKER_H__
7 #pragma once 7 #pragma once
8 8
9 #include "base/ref_counted.h"
10 #include "base/scoped_ptr.h"
9 #include "base/task.h" 11 #include "base/task.h"
10 #include "base/thread.h" 12 #include "base/thread.h"
11 #include "gfx/native_widget_types.h" 13 #include "gfx/native_widget_types.h"
12 #include "printing/page_number.h" 14 #include "printing/page_number.h"
13 #include "printing/printing_context.h" 15 #include "printing/printing_context.h"
14 16
15 namespace printing { 17 namespace printing {
16 18
17 class PrintedDocument; 19 class PrintedDocument;
18 class PrintedPage; 20 class PrintedPage;
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 void OnNewPage(); 55 void OnNewPage();
54 56
55 // This is the only function that can be called in a thread. 57 // This is the only function that can be called in a thread.
56 void Cancel(); 58 void Cancel();
57 59
58 // Cancels the Print... dialog box if shown, noop otherwise. 60 // Cancels the Print... dialog box if shown, noop otherwise.
59 void DismissDialog(); 61 void DismissDialog();
60 62
61 protected: 63 protected:
62 // Retrieves the context for testing only. 64 // Retrieves the context for testing only.
63 PrintingContext& printing_context() { return printing_context_; } 65 PrintingContext* printing_context() { return printing_context_.get(); }
64 66
65 private: 67 private:
66 // The shared NotificationService service can only be accessed from the UI 68 // The shared NotificationService service can only be accessed from the UI
67 // thread, so this class encloses the necessary information to send the 69 // thread, so this class encloses the necessary information to send the
68 // notification from the right thread. Most NOTIFY_PRINT_JOB_EVENT 70 // notification from the right thread. Most NOTIFY_PRINT_JOB_EVENT
69 // notifications are sent this way, except USER_INIT_DONE, USER_INIT_CANCELED 71 // notifications are sent this way, except USER_INIT_DONE, USER_INIT_CANCELED
70 // and DEFAULT_INIT_DONE. These three are sent through PrintJob::InitDone(). 72 // and DEFAULT_INIT_DONE. These three are sent through PrintJob::InitDone().
71 class NotificationTask; 73 class NotificationTask;
72 friend struct RunnableMethodTraits<PrintJobWorker>; 74 friend struct RunnableMethodTraits<PrintJobWorker>;
73 75
(...skipping 17 matching lines...) Expand all
91 // The callback used by PrintingContext::GetSettingsWithUI() to notify this 93 // The callback used by PrintingContext::GetSettingsWithUI() to notify this
92 // object that the print settings are set. This is needed in order to bounce 94 // object that the print settings are set. This is needed in order to bounce
93 // back into the IO thread for GetSettingsDone(). 95 // back into the IO thread for GetSettingsDone().
94 void GetSettingsWithUIDone(PrintingContext::Result result); 96 void GetSettingsWithUIDone(PrintingContext::Result result);
95 #endif 97 #endif
96 98
97 // Reports settings back to owner_. 99 // Reports settings back to owner_.
98 void GetSettingsDone(PrintingContext::Result result); 100 void GetSettingsDone(PrintingContext::Result result);
99 101
100 // Information about the printer setting. 102 // Information about the printer setting.
101 PrintingContext printing_context_; 103 scoped_ptr<PrintingContext> printing_context_;
102 104
103 // The printed document. Only has read-only access. 105 // The printed document. Only has read-only access.
104 scoped_refptr<PrintedDocument> document_; 106 scoped_refptr<PrintedDocument> document_;
105 107
106 // The print job owning this worker thread. It is guaranteed to outlive this 108 // The print job owning this worker thread. It is guaranteed to outlive this
107 // object. 109 // object.
108 PrintJobWorkerOwner* owner_; 110 PrintJobWorkerOwner* owner_;
109 111
110 // Current page number to print. 112 // Current page number to print.
111 PageNumber page_number_; 113 PageNumber page_number_;
112 114
113 DISALLOW_COPY_AND_ASSIGN(PrintJobWorker); 115 DISALLOW_COPY_AND_ASSIGN(PrintJobWorker);
114 }; 116 };
115 117
116 } // namespace printing 118 } // namespace printing
117 119
118 template <> 120 template <>
119 struct RunnableMethodTraits<printing::PrintJobWorker> { 121 struct RunnableMethodTraits<printing::PrintJobWorker> {
120 void RetainCallee(printing::PrintJobWorker* obj); 122 void RetainCallee(printing::PrintJobWorker* obj);
121 void ReleaseCallee(printing::PrintJobWorker* obj); 123 void ReleaseCallee(printing::PrintJobWorker* obj);
122 private: 124 private:
123 scoped_refptr<printing::PrintJobWorkerOwner> owner_; 125 scoped_refptr<printing::PrintJobWorkerOwner> owner_;
124 }; 126 };
125 127
126 #endif // CHROME_BROWSER_PRINTING_PRINT_JOB_WORKER_H__ 128 #endif // CHROME_BROWSER_PRINTING_PRINT_JOB_WORKER_H__
OLDNEW
« no previous file with comments | « chrome/browser/printing/print_job_unittest.cc ('k') | chrome/browser/printing/print_job_worker.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698