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

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

Issue 13243003: Move MessageLoop to base namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 8 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) 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 #include "ui/gfx/native_widget_types.h"
14 14
15 class MessageLoop;
16
17 namespace base { 15 namespace base {
18 class DictionaryValue; 16 class DictionaryValue;
17 class MessageLoop;
19 } 18 }
20 19
21 namespace printing { 20 namespace printing {
22 21
23 class PrintDestinationInterface; 22 class PrintDestinationInterface;
24 class PrintJobWorker; 23 class PrintJobWorker;
25 24
26 // Query the printer for settings. 25 // Query the printer for settings.
27 class PrinterQuery : public PrintJobWorkerOwner { 26 class PrinterQuery : public PrintJobWorkerOwner {
28 public: 27 public:
29 // GetSettings() UI parameter. 28 // GetSettings() UI parameter.
30 enum GetSettingsAskParam { 29 enum GetSettingsAskParam {
31 DEFAULTS, 30 DEFAULTS,
32 ASK_USER, 31 ASK_USER,
33 }; 32 };
34 33
35 PrinterQuery(); 34 PrinterQuery();
36 35
37 // PrintJobWorkerOwner implementation. 36 // PrintJobWorkerOwner implementation.
38 virtual void GetSettingsDone(const PrintSettings& new_settings, 37 virtual void GetSettingsDone(const PrintSettings& new_settings,
39 PrintingContext::Result result) OVERRIDE; 38 PrintingContext::Result result) OVERRIDE;
40 virtual PrintJobWorker* DetachWorker(PrintJobWorkerOwner* new_owner) OVERRIDE; 39 virtual PrintJobWorker* DetachWorker(PrintJobWorkerOwner* new_owner) OVERRIDE;
41 virtual MessageLoop* message_loop() OVERRIDE; 40 virtual base::MessageLoop* message_loop() OVERRIDE;
42 virtual const PrintSettings& settings() const OVERRIDE; 41 virtual const PrintSettings& settings() const OVERRIDE;
43 virtual int cookie() const OVERRIDE; 42 virtual int cookie() const OVERRIDE;
44 43
45 // Initializes the printing context. It is fine to call this function multiple 44 // Initializes the printing context. It is fine to call this function multiple
46 // times to reinitialize the settings. |parent_view| parameter's window will 45 // times to reinitialize the settings. |parent_view| parameter's window will
47 // be the owner of the print setting dialog box. It is unused when 46 // be the owner of the print setting dialog box. It is unused when
48 // |ask_for_user_settings| is DEFAULTS. 47 // |ask_for_user_settings| is DEFAULTS.
49 void GetSettings(GetSettingsAskParam ask_user_for_settings, 48 void GetSettings(GetSettingsAskParam ask_user_for_settings,
50 gfx::NativeView parent_view, 49 gfx::NativeView parent_view,
51 int expected_page_count, 50 int expected_page_count,
(...skipping 20 matching lines...) Expand all
72 bool is_valid() const; 71 bool is_valid() const;
73 72
74 private: 73 private:
75 virtual ~PrinterQuery(); 74 virtual ~PrinterQuery();
76 75
77 // Lazy create the worker thread. There is one worker thread per print job. 76 // Lazy create the worker thread. There is one worker thread per print job.
78 void StartWorker(const base::Closure& callback); 77 void StartWorker(const base::Closure& callback);
79 78
80 // Main message loop reference. Used to send notifications in the right 79 // Main message loop reference. Used to send notifications in the right
81 // thread. 80 // thread.
82 MessageLoop* const io_message_loop_; 81 base::MessageLoop* const io_message_loop_;
83 82
84 // All the UI is done in a worker thread because many Win32 print functions 83 // All the UI is done in a worker thread because many Win32 print functions
85 // are blocking and enters a message loop without your consent. There is one 84 // are blocking and enters a message loop without your consent. There is one
86 // worker thread per print job. 85 // worker thread per print job.
87 scoped_ptr<PrintJobWorker> worker_; 86 scoped_ptr<PrintJobWorker> worker_;
88 87
89 // Cache of the print context settings for access in the UI thread. 88 // Cache of the print context settings for access in the UI thread.
90 PrintSettings settings_; 89 PrintSettings settings_;
91 90
92 // Is the Print... dialog box currently shown. 91 // Is the Print... dialog box currently shown.
93 bool is_print_dialog_box_shown_; 92 bool is_print_dialog_box_shown_;
94 93
95 // Cookie that make this instance unique. 94 // Cookie that make this instance unique.
96 int cookie_; 95 int cookie_;
97 96
98 // Results from the last GetSettingsDone() callback. 97 // Results from the last GetSettingsDone() callback.
99 PrintingContext::Result last_status_; 98 PrintingContext::Result last_status_;
100 99
101 // Callback waiting to be run. 100 // Callback waiting to be run.
102 base::Closure callback_; 101 base::Closure callback_;
103 102
104 DISALLOW_COPY_AND_ASSIGN(PrinterQuery); 103 DISALLOW_COPY_AND_ASSIGN(PrinterQuery);
105 }; 104 };
106 105
107 } // namespace printing 106 } // namespace printing
108 107
109 #endif // CHROME_BROWSER_PRINTING_PRINTER_QUERY_H_ 108 #endif // CHROME_BROWSER_PRINTING_PRINTER_QUERY_H_
OLDNEW
« no previous file with comments | « chrome/browser/printing/print_job_worker_owner.h ('k') | chrome/browser/safe_browsing/safe_browsing_blocking_page.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698