Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / chrome / browser / extensions / api / cloud_print_private / cloud_print_private_api.h
blob52a369deb8e783885791355cfdca9d9536784676
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_
8 #include <string>
9 #include <vector>
11 #include "chrome/browser/extensions/chrome_extension_function.h"
13 namespace extensions {
15 namespace api {
16 namespace cloud_print_private {
18 struct UserSettings;
20 } // namespace cloud_print_private
21 } // namespace api
24 // For use only in tests.
25 class CloudPrintTestsDelegate {
26 public:
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();
44 private:
45 // Points to single instance of this class during testing.
46 static CloudPrintTestsDelegate* instance_;
49 class CloudPrintPrivateSetupConnectorFunction
50 : public ChromeAsyncExtensionFunction {
51 public:
52 DECLARE_EXTENSION_FUNCTION("cloudPrintPrivate.setupConnector",
53 CLOUDPRINTPRIVATE_SETUPCONNECTOR)
55 CloudPrintPrivateSetupConnectorFunction();
57 protected:
58 ~CloudPrintPrivateSetupConnectorFunction() override;
60 // ExtensionFunction:
61 bool RunAsync() override;
64 class CloudPrintPrivateGetHostNameFunction
65 : public ChromeAsyncExtensionFunction {
66 public:
67 DECLARE_EXTENSION_FUNCTION("cloudPrintPrivate.getHostName",
68 CLOUDPRINTPRIVATE_GETHOSTNAME)
70 CloudPrintPrivateGetHostNameFunction();
72 protected:
73 ~CloudPrintPrivateGetHostNameFunction() override;
75 // ExtensionFunction:
76 bool RunAsync() override;
79 class CloudPrintPrivateGetPrintersFunction
80 : public ChromeAsyncExtensionFunction {
81 public:
82 DECLARE_EXTENSION_FUNCTION("cloudPrintPrivate.getPrinters",
83 CLOUDPRINTPRIVATE_GETPRINTERS)
85 CloudPrintPrivateGetPrintersFunction();
87 protected:
88 ~CloudPrintPrivateGetPrintersFunction() override;
90 private:
91 void SendResults(const std::vector<std::string>& printers);
93 // ExtensionFunction:
94 bool RunAsync() override;
97 class CloudPrintPrivateGetClientIdFunction
98 : public ChromeAsyncExtensionFunction {
99 public:
100 DECLARE_EXTENSION_FUNCTION("cloudPrintPrivate.getClientId",
101 CLOUDPRINTPRIVATE_GETCLIENTID);
103 CloudPrintPrivateGetClientIdFunction();
105 protected:
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_