Index: chrome/browser/extensions/api/cloud_print_private/cloud_print_private_api.h |
diff --git a/chrome/browser/extensions/api/cloud_print_private/cloud_print_private_api.h b/chrome/browser/extensions/api/cloud_print_private/cloud_print_private_api.h |
index d5c9739a8d0095aa350a6b318b3444af54364e7c..2a23b9e83b2878e7bb1018d37636a2837d303375 100644 |
--- a/chrome/browser/extensions/api/cloud_print_private/cloud_print_private_api.h |
+++ b/chrome/browser/extensions/api/cloud_print_private/cloud_print_private_api.h |
@@ -6,23 +6,73 @@ |
#define CHROME_BROWSER_EXTENSIONS_API_CLOUD_PRINT_PRIVATE_CLOUD_PRINT_PRIVATE_API_H_ |
#include <string> |
+#include <vector> |
+ |
#include "chrome/browser/extensions/extension_function.h" |
namespace extensions { |
-class CloudPrintSetCredentialsFunction : public AsyncExtensionFunction { |
+// For use only in tests. |
+class CloudPrintTestsDelegate { |
public: |
- DECLARE_EXTENSION_FUNCTION_NAME("cloudPrintPrivate.setCredentials"); |
+ CloudPrintTestsDelegate(); |
+ virtual ~CloudPrintTestsDelegate(); |
+ |
+ virtual void SetupConnector( |
+ const std::string& user_email, |
+ const std::string& robot_email, |
+ const std::string& credentials, |
+ bool connect_new_printers, |
+ const std::vector<std::string>& printer_blacklist) = 0; |
+ |
+ virtual std::string GetHostName() = 0; |
+ |
+ virtual std::vector<std::string> GetPrinters() = 0; |
+ |
+ static CloudPrintTestsDelegate* instance(); |
+ |
+ private: |
+ // Points to single instance of this class during testing. |
+ static CloudPrintTestsDelegate* instance_; |
+}; |
- CloudPrintSetCredentialsFunction(); |
+class CloudPrintSetupConnectorFunction : public AsyncExtensionFunction { |
+ public: |
+ DECLARE_EXTENSION_FUNCTION_NAME("cloudPrintPrivate.setupConnector"); |
- // For use only in tests - sets a flag that can cause this function to not |
- // actually set the credentials but instead simply reflect the passed in |
- // arguments appended together as one string back in results_. |
- static void SetTestMode(bool test_mode_enabled); |
+ CloudPrintSetupConnectorFunction(); |
protected: |
- virtual ~CloudPrintSetCredentialsFunction(); |
+ virtual ~CloudPrintSetupConnectorFunction(); |
+ |
+ // ExtensionFunction: |
+ virtual bool RunImpl() OVERRIDE; |
+}; |
+ |
+class CloudPrintGetHostNameFunction : public AsyncExtensionFunction { |
+ public: |
+ DECLARE_EXTENSION_FUNCTION_NAME("cloudPrintPrivate.getHostName"); |
+ |
+ CloudPrintGetHostNameFunction(); |
+ |
+ protected: |
+ virtual ~CloudPrintGetHostNameFunction(); |
+ |
+ // ExtensionFunction: |
+ virtual bool RunImpl() OVERRIDE; |
+}; |
+ |
+class CloudPrintGetPrintersFunction : public AsyncExtensionFunction { |
+ public: |
+ DECLARE_EXTENSION_FUNCTION_NAME("cloudPrintPrivate.getPrinters"); |
+ |
+ CloudPrintGetPrintersFunction(); |
+ |
+ protected: |
+ virtual ~CloudPrintGetPrintersFunction(); |
+ |
+ void CollectPrinters(); |
+ void ReturnResult(const base::ListValue* printers); |
// ExtensionFunction: |
virtual bool RunImpl() OVERRIDE; |