OLD | NEW |
---|---|
(Empty) | |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef CONTENT_BROWSER_RENDERER_HOST_PEPPER_PEPPER_PRINT_SETTINGS_MANAGER_H_ | |
6 #define CONTENT_BROWSER_RENDERER_HOST_PEPPER_PEPPER_PRINT_SETTINGS_MANAGER_H_ | |
7 | |
8 #include "base/bind.h" | |
9 #include "base/compiler_specific.h" | |
10 #include "content/common/content_export.h" | |
11 #include "ppapi/c/dev/pp_print_settings_dev.h" | |
12 | |
13 namespace content { | |
14 | |
15 // A class for getting the default print settings for the default printer. | |
16 class CONTENT_EXPORT PepperPrintSettingsManager { | |
17 public: | |
18 typedef std::pair<PP_PrintSettings_Dev, int32_t> Result; | |
19 typedef base::Callback<void(Result)> Callback; | |
20 | |
21 // The default print settings are obtained asynchronously and |callback| | |
22 // is called with the the print settings when they are available. |callback| | |
23 // will always be called on the same thread from which | |
24 // |GetDefaultPrintSettings| was issued. | |
25 virtual void GetDefaultPrintSettings(Callback callback) = 0; | |
26 | |
27 virtual ~PepperPrintSettingsManager() {}; | |
brettw
2012/09/18 21:41:38
Remove ;
raymes
2012/09/18 23:43:57
Done.
| |
28 }; | |
29 | |
30 // Real implementation for getting the default print settings. | |
31 class CONTENT_EXPORT PepperPrintSettingsManagerImpl | |
32 : public PepperPrintSettingsManager { | |
33 public: | |
34 PepperPrintSettingsManagerImpl() {} | |
35 virtual ~PepperPrintSettingsManagerImpl() {} | |
36 | |
37 // PepperPrintSettingsManager implementation. | |
38 virtual void GetDefaultPrintSettings( | |
39 PepperPrintSettingsManager::Callback callback) OVERRIDE; | |
40 | |
41 private: | |
42 DISALLOW_COPY_AND_ASSIGN(PepperPrintSettingsManagerImpl); | |
43 }; | |
44 | |
45 // Mock implementation for test purposes. | |
brettw
2012/09/18 21:41:38
Is it possible to just define this in the unit tes
raymes
2012/09/18 23:43:57
Done.
| |
46 class CONTENT_EXPORT MockPepperPrintSettingsManager | |
47 : public PepperPrintSettingsManager { | |
48 public: | |
49 MockPepperPrintSettingsManager(const PP_PrintSettings_Dev& settings); | |
50 virtual ~MockPepperPrintSettingsManager() {} | |
51 | |
52 // PepperPrintSettingsManager implementation. | |
53 virtual void GetDefaultPrintSettings( | |
54 PepperPrintSettingsManager::Callback callback) OVERRIDE; | |
55 private: | |
56 PP_PrintSettings_Dev settings_; | |
57 | |
58 DISALLOW_COPY_AND_ASSIGN(MockPepperPrintSettingsManager); | |
59 }; | |
60 | |
61 } // namespace content | |
62 | |
63 #endif // CONTENT_BROWSER_RENDERER_HOST_PEPPER_PEPPER_PRINT_SETTINGS_MANAGER_H_ | |
OLD | NEW |