OLD | NEW |
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_EXTENSIONS_API_CLOUD_PRINT_PRIVATE_CLOUD_PRINT_PRIVATE_AP
I_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_CLOUD_PRINT_PRIVATE_CLOUD_PRINT_PRIVATE_AP
I_H_ |
6 #define CHROME_BROWSER_EXTENSIONS_API_CLOUD_PRINT_PRIVATE_CLOUD_PRINT_PRIVATE_AP
I_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_API_CLOUD_PRINT_PRIVATE_CLOUD_PRINT_PRIVATE_AP
I_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
| 9 #include <vector> |
| 10 |
9 #include "chrome/browser/extensions/extension_function.h" | 11 #include "chrome/browser/extensions/extension_function.h" |
10 | 12 |
11 namespace extensions { | 13 namespace extensions { |
12 | 14 |
13 class CloudPrintSetCredentialsFunction : public AsyncExtensionFunction { | 15 // For use only in tests. |
| 16 class CloudPrintTestsDelegate { |
14 public: | 17 public: |
15 DECLARE_EXTENSION_FUNCTION_NAME("cloudPrintPrivate.setCredentials"); | 18 CloudPrintTestsDelegate(); |
| 19 virtual ~CloudPrintTestsDelegate(); |
16 | 20 |
17 CloudPrintSetCredentialsFunction(); | 21 virtual void SetupConnector( |
| 22 const std::string& user_email, |
| 23 const std::string& robot_email, |
| 24 const std::string& credentials, |
| 25 bool connect_new_printers, |
| 26 const base::ListValue* printer_blacklist) = 0; |
18 | 27 |
19 // For use only in tests - sets a flag that can cause this function to not | 28 virtual std::string GetHostName() = 0; |
20 // actually set the credentials but instead simply reflect the passed in | 29 |
21 // arguments appended together as one string back in results_. | 30 virtual std::vector<std::string> GetPrinters() = 0; |
22 static void SetTestMode(bool test_mode_enabled); | 31 |
| 32 private: |
| 33 DISALLOW_COPY_AND_ASSIGN(CloudPrintTestsDelegate); |
| 34 }; |
| 35 |
| 36 class CloudPrintSetupConnectorFunction : public AsyncExtensionFunction { |
| 37 public: |
| 38 DECLARE_EXTENSION_FUNCTION_NAME("cloudPrintPrivate.setupConnector"); |
| 39 |
| 40 CloudPrintSetupConnectorFunction(); |
23 | 41 |
24 protected: | 42 protected: |
25 virtual ~CloudPrintSetCredentialsFunction(); | 43 virtual ~CloudPrintSetupConnectorFunction(); |
26 | 44 |
27 // ExtensionFunction: | 45 // ExtensionFunction: |
28 virtual bool RunImpl() OVERRIDE; | 46 virtual bool RunImpl() OVERRIDE; |
| 47 }; |
| 48 |
| 49 class CloudPrintGetHostNameFunction : public AsyncExtensionFunction { |
| 50 public: |
| 51 DECLARE_EXTENSION_FUNCTION_NAME("cloudPrintPrivate.getHostName"); |
| 52 |
| 53 CloudPrintGetHostNameFunction(); |
| 54 |
| 55 protected: |
| 56 virtual ~CloudPrintGetHostNameFunction(); |
| 57 |
| 58 // ExtensionFunction: |
| 59 virtual bool RunImpl() OVERRIDE; |
| 60 }; |
| 61 |
| 62 class CloudPrintGetPrintersFunction : public AsyncExtensionFunction { |
| 63 public: |
| 64 DECLARE_EXTENSION_FUNCTION_NAME("cloudPrintPrivate.getPrinters"); |
| 65 |
| 66 CloudPrintGetPrintersFunction(); |
| 67 |
| 68 protected: |
| 69 virtual ~CloudPrintGetPrintersFunction(); |
| 70 |
| 71 void CollectPrinters(); |
| 72 void ReturnResult(const base::ListValue* printers); |
| 73 |
| 74 // ExtensionFunction: |
| 75 virtual bool RunImpl() OVERRIDE; |
29 }; | 76 }; |
30 | 77 |
31 } // namespace extensions | 78 } // namespace extensions |
32 | 79 |
33 #endif // CHROME_BROWSER_EXTENSIONS_API_CLOUD_PRINT_PRIVATE_CLOUD_PRINT_PRIVATE
_API_H_ | 80 #endif // CHROME_BROWSER_EXTENSIONS_API_CLOUD_PRINT_PRIVATE_CLOUD_PRINT_PRIVATE
_API_H_ |
OLD | NEW |