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.
5 #ifndef CHROME_BROWSER_EXTENSIONS_API_CLOUD_PRINT_PRIVATE_CLOUD_PRINT_PRIVATE_API_H_
6 #define CHROME_BROWSER_EXTENSIONS_API_CLOUD_PRINT_PRIVATE_CLOUD_PRINT_PRIVATE_API_H_
11 #include "chrome/browser/extensions/chrome_extension_function.h"
13 namespace extensions
{
16 namespace cloud_print_private
{
20 } // namespace cloud_print_private
24 // For use only in tests.
25 class CloudPrintTestsDelegate
{
27 CloudPrintTestsDelegate();
28 virtual ~CloudPrintTestsDelegate();
30 virtual void SetupConnector(
31 const std::string
& user_email
,
32 const std::string
& robot_email
,
33 const std::string
& credentials
,
34 const api::cloud_print_private::UserSettings
& user_settings
) = 0;
36 virtual std::string
GetHostName() = 0;
38 virtual std::string
GetClientId() = 0;
40 virtual std::vector
<std::string
> GetPrinters() = 0;
42 static CloudPrintTestsDelegate
* instance();
45 // Points to single instance of this class during testing.
46 static CloudPrintTestsDelegate
* instance_
;
49 class CloudPrintPrivateSetupConnectorFunction
50 : public ChromeAsyncExtensionFunction
{
52 DECLARE_EXTENSION_FUNCTION("cloudPrintPrivate.setupConnector",
53 CLOUDPRINTPRIVATE_SETUPCONNECTOR
)
55 CloudPrintPrivateSetupConnectorFunction();
58 ~CloudPrintPrivateSetupConnectorFunction() override
;
61 bool RunAsync() override
;
64 class CloudPrintPrivateGetHostNameFunction
65 : public ChromeAsyncExtensionFunction
{
67 DECLARE_EXTENSION_FUNCTION("cloudPrintPrivate.getHostName",
68 CLOUDPRINTPRIVATE_GETHOSTNAME
)
70 CloudPrintPrivateGetHostNameFunction();
73 ~CloudPrintPrivateGetHostNameFunction() override
;
76 bool RunAsync() override
;
79 class CloudPrintPrivateGetPrintersFunction
80 : public ChromeAsyncExtensionFunction
{
82 DECLARE_EXTENSION_FUNCTION("cloudPrintPrivate.getPrinters",
83 CLOUDPRINTPRIVATE_GETPRINTERS
)
85 CloudPrintPrivateGetPrintersFunction();
88 ~CloudPrintPrivateGetPrintersFunction() override
;
91 void SendResults(const std::vector
<std::string
>& printers
);
94 bool RunAsync() override
;
97 class CloudPrintPrivateGetClientIdFunction
98 : public ChromeAsyncExtensionFunction
{
100 DECLARE_EXTENSION_FUNCTION("cloudPrintPrivate.getClientId",
101 CLOUDPRINTPRIVATE_GETCLIENTID
);
103 CloudPrintPrivateGetClientIdFunction();
106 ~CloudPrintPrivateGetClientIdFunction() override
;
108 // ExtensionFunction:
109 bool RunAsync() override
;
112 } // namespace extensions
114 #endif // CHROME_BROWSER_EXTENSIONS_API_CLOUD_PRINT_PRIVATE_CLOUD_PRINT_PRIVATE_API_H_