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_PRINTING_CLOUD_PRINT_CLOUD_PRINT_PROXY_SERVICE_H_ | 5 #ifndef CHROME_BROWSER_PRINTING_CLOUD_PRINT_CLOUD_PRINT_PROXY_SERVICE_H_ |
6 #define CHROME_BROWSER_PRINTING_CLOUD_PRINT_CLOUD_PRINT_PROXY_SERVICE_H_ | 6 #define CHROME_BROWSER_PRINTING_CLOUD_PRINT_CLOUD_PRINT_PROXY_SERVICE_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
| 9 #include <vector> |
9 | 10 |
10 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
11 #include "base/callback_forward.h" | 12 #include "base/callback_forward.h" |
12 #include "base/memory/weak_ptr.h" | 13 #include "base/memory/weak_ptr.h" |
13 #include "base/observer_list.h" | 14 #include "base/observer_list.h" |
14 #include "chrome/browser/api/prefs/pref_change_registrar.h" | 15 #include "chrome/browser/api/prefs/pref_change_registrar.h" |
15 #include "chrome/browser/printing/cloud_print/cloud_print_setup_handler.h" | 16 #include "chrome/browser/printing/cloud_print/cloud_print_setup_handler.h" |
16 #include "chrome/browser/profiles/profile_keyed_service.h" | 17 #include "chrome/browser/profiles/profile_keyed_service.h" |
17 #include "content/public/browser/notification_observer.h" | 18 #include "content/public/browser/notification_observer.h" |
18 | 19 |
(...skipping 13 matching lines...) Expand all Loading... |
32 public: | 33 public: |
33 explicit CloudPrintProxyService(Profile* profile); | 34 explicit CloudPrintProxyService(Profile* profile); |
34 virtual ~CloudPrintProxyService(); | 35 virtual ~CloudPrintProxyService(); |
35 | 36 |
36 // Initializes the object. This should be called every time an object of this | 37 // Initializes the object. This should be called every time an object of this |
37 // class is constructed. | 38 // class is constructed. |
38 void Initialize(); | 39 void Initialize(); |
39 | 40 |
40 // Enables/disables cloud printing for the user | 41 // Enables/disables cloud printing for the user |
41 virtual void EnableForUser(const std::string& lsid, const std::string& email); | 42 virtual void EnableForUser(const std::string& lsid, const std::string& email); |
42 virtual void EnableForUserWithRobot(const std::string& robot_auth_code, | 43 virtual void EnableForUserWithRobot( |
43 const std::string& robot_email, | 44 const std::string& robot_auth_code, |
44 const std::string& user_email); | 45 const std::string& robot_email, |
| 46 const std::string& user_email, |
| 47 bool connect_new_printers, |
| 48 const std::vector<std::string>& printer_blacklist); |
45 virtual void DisableForUser(); | 49 virtual void DisableForUser(); |
46 | 50 |
47 // Query the service process for the status of the cloud print proxy and | 51 // Query the service process for the status of the cloud print proxy and |
48 // update the browser prefs. | 52 // update the browser prefs. |
49 void RefreshStatusFromService(); | 53 void RefreshStatusFromService(); |
50 | 54 |
51 // Disable the service if the policy to do so is set, and once the | 55 // Disable the service if the policy to do so is set, and once the |
52 // disablement is verified, quit the browser. Returns true if the policy is | 56 // disablement is verified, quit the browser. Returns true if the policy is |
53 // not set or the connector was not enabled. | 57 // not set or the connector was not enabled. |
54 bool EnforceCloudPrintConnectorPolicyAndQuit(); | 58 bool EnforceCloudPrintConnectorPolicyAndQuit(); |
(...skipping 15 matching lines...) Expand all Loading... |
70 friend class TokenExpiredNotificationDelegate; | 74 friend class TokenExpiredNotificationDelegate; |
71 | 75 |
72 Profile* profile_; | 76 Profile* profile_; |
73 scoped_refptr<TokenExpiredNotificationDelegate> token_expired_delegate_; | 77 scoped_refptr<TokenExpiredNotificationDelegate> token_expired_delegate_; |
74 scoped_ptr<CloudPrintSetupHandler> cloud_print_setup_handler_; | 78 scoped_ptr<CloudPrintSetupHandler> cloud_print_setup_handler_; |
75 std::string proxy_id_; | 79 std::string proxy_id_; |
76 | 80 |
77 // Methods that send an IPC to the service. | 81 // Methods that send an IPC to the service. |
78 void RefreshCloudPrintProxyStatus(); | 82 void RefreshCloudPrintProxyStatus(); |
79 void EnableCloudPrintProxy(const std::string& lsid, const std::string& email); | 83 void EnableCloudPrintProxy(const std::string& lsid, const std::string& email); |
80 void EnableCloudPrintProxyWithRobot(const std::string& robot_auth_code, | 84 void EnableCloudPrintProxyWithRobot( |
81 const std::string& robot_email, | 85 const std::string& robot_auth_code, |
82 const std::string& user_email); | 86 const std::string& robot_email, |
| 87 const std::string& user_email, |
| 88 bool connect_new_printers, |
| 89 const std::vector<std::string>& printer_blacklist); |
83 void DisableCloudPrintProxy(); | 90 void DisableCloudPrintProxy(); |
84 | 91 |
85 // Callback that gets the cloud print proxy info. | 92 // Callback that gets the cloud print proxy info. |
86 void ProxyInfoCallback( | 93 void ProxyInfoCallback( |
87 const cloud_print::CloudPrintProxyInfo& proxy_info); | 94 const cloud_print::CloudPrintProxyInfo& proxy_info); |
88 | 95 |
89 // Invoke a task that gets run after the service process successfully | 96 // Invoke a task that gets run after the service process successfully |
90 // launches. The task typically involves sending an IPC to the service | 97 // launches. The task typically involves sending an IPC to the service |
91 // process. | 98 // process. |
92 bool InvokeServiceTask(const base::Closure& task); | 99 bool InvokeServiceTask(const base::Closure& task); |
(...skipping 16 matching lines...) Expand all Loading... |
109 PrefChangeRegistrar pref_change_registrar_; | 116 PrefChangeRegistrar pref_change_registrar_; |
110 | 117 |
111 // If set, continue trying to disable the connector, and quit the process | 118 // If set, continue trying to disable the connector, and quit the process |
112 // once successful. | 119 // once successful. |
113 bool enforcing_connector_policy_; | 120 bool enforcing_connector_policy_; |
114 | 121 |
115 DISALLOW_COPY_AND_ASSIGN(CloudPrintProxyService); | 122 DISALLOW_COPY_AND_ASSIGN(CloudPrintProxyService); |
116 }; | 123 }; |
117 | 124 |
118 #endif // CHROME_BROWSER_PRINTING_CLOUD_PRINT_CLOUD_PRINT_PROXY_SERVICE_H_ | 125 #endif // CHROME_BROWSER_PRINTING_CLOUD_PRINT_CLOUD_PRINT_PROXY_SERVICE_H_ |
OLD | NEW |