Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(254)

Side by Side Diff: chrome/browser/extensions/api/cloud_print_private/cloud_print_private_api.h

Issue 11037005: New Cloud Print Private API. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/extensions/api/cloud_print_private/cloud_print_private_api.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 std::vector<std::string>& 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 static CloudPrintTestsDelegate* instance();
33
34 private:
35 // Points to single instance of this class during testing.
36 static CloudPrintTestsDelegate* instance_;
37 };
38
39 class CloudPrintSetupConnectorFunction : public AsyncExtensionFunction {
40 public:
41 DECLARE_EXTENSION_FUNCTION_NAME("cloudPrintPrivate.setupConnector");
42
43 CloudPrintSetupConnectorFunction();
23 44
24 protected: 45 protected:
25 virtual ~CloudPrintSetCredentialsFunction(); 46 virtual ~CloudPrintSetupConnectorFunction();
26 47
27 // ExtensionFunction: 48 // ExtensionFunction:
28 virtual bool RunImpl() OVERRIDE; 49 virtual bool RunImpl() OVERRIDE;
50 };
51
52 class CloudPrintGetHostNameFunction : public AsyncExtensionFunction {
53 public:
54 DECLARE_EXTENSION_FUNCTION_NAME("cloudPrintPrivate.getHostName");
55
56 CloudPrintGetHostNameFunction();
57
58 protected:
59 virtual ~CloudPrintGetHostNameFunction();
60
61 // ExtensionFunction:
62 virtual bool RunImpl() OVERRIDE;
63 };
64
65 class CloudPrintGetPrintersFunction : public AsyncExtensionFunction {
66 public:
67 DECLARE_EXTENSION_FUNCTION_NAME("cloudPrintPrivate.getPrinters");
68
69 CloudPrintGetPrintersFunction();
70
71 protected:
72 virtual ~CloudPrintGetPrintersFunction();
73
74 void CollectPrinters();
75 void ReturnResult(const base::ListValue* printers);
76
77 // ExtensionFunction:
78 virtual bool RunImpl() OVERRIDE;
29 }; 79 };
30 80
31 } // namespace extensions 81 } // namespace extensions
32 82
33 #endif // CHROME_BROWSER_EXTENSIONS_API_CLOUD_PRINT_PRIVATE_CLOUD_PRINT_PRIVATE _API_H_ 83 #endif // CHROME_BROWSER_EXTENSIONS_API_CLOUD_PRINT_PRIVATE_CLOUD_PRINT_PRIVATE _API_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/extensions/api/cloud_print_private/cloud_print_private_api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698