| 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 #include <vector> | 
|   10  |   10  | 
|   11 #include "base/basictypes.h" |   11 #include "base/basictypes.h" | 
|   12 #include "base/callback_forward.h" |   12 #include "base/callback_forward.h" | 
|   13 #include "base/memory/weak_ptr.h" |   13 #include "base/memory/weak_ptr.h" | 
|   14 #include "base/observer_list.h" |   14 #include "base/observer_list.h" | 
|   15 #include "base/prefs/public/pref_change_registrar.h" |   15 #include "base/prefs/public/pref_change_registrar.h" | 
|   16 #include "base/prefs/public/pref_observer.h" |  | 
|   17 #include "chrome/browser/printing/cloud_print/cloud_print_setup_handler.h" |   16 #include "chrome/browser/printing/cloud_print/cloud_print_setup_handler.h" | 
|   18 #include "chrome/browser/profiles/profile_keyed_service.h" |   17 #include "chrome/browser/profiles/profile_keyed_service.h" | 
|   19  |   18  | 
|   20 class Profile; |   19 class Profile; | 
|   21 class ServiceProcessControl; |   20 class ServiceProcessControl; | 
|   22  |   21  | 
|   23 namespace cloud_print { |   22 namespace cloud_print { | 
|   24 struct CloudPrintProxyInfo; |   23 struct CloudPrintProxyInfo; | 
|   25 }  // namespace cloud_print |   24 }  // namespace cloud_print | 
|   26  |   25  | 
|   27 // Layer between the browser user interface and the cloud print proxy code |   26 // Layer between the browser user interface and the cloud print proxy code | 
|   28 // running in the service process. |   27 // running in the service process. | 
|   29 class CloudPrintProxyService |   28 class CloudPrintProxyService | 
|   30     : public CloudPrintSetupHandlerDelegate, |   29     : public CloudPrintSetupHandlerDelegate, | 
|   31       public ProfileKeyedService, |   30       public ProfileKeyedService { | 
|   32       public PrefObserver { |  | 
|   33  public: |   31  public: | 
|   34   explicit CloudPrintProxyService(Profile* profile); |   32   explicit CloudPrintProxyService(Profile* profile); | 
|   35   virtual ~CloudPrintProxyService(); |   33   virtual ~CloudPrintProxyService(); | 
|   36  |   34  | 
|   37   // Initializes the object. This should be called every time an object of this |   35   // Initializes the object. This should be called every time an object of this | 
|   38   // class is constructed. |   36   // class is constructed. | 
|   39   void Initialize(); |   37   void Initialize(); | 
|   40  |   38  | 
|   41   // Enables/disables cloud printing for the user |   39   // Enables/disables cloud printing for the user | 
|   42   virtual void EnableForUser(const std::string& lsid, const std::string& email); |   40   virtual void EnableForUser(const std::string& lsid, const std::string& email); | 
| (...skipping 13 matching lines...) Expand all  Loading... | 
|   56   // disablement is verified, quit the browser. Returns true if the policy is |   54   // disablement is verified, quit the browser. Returns true if the policy is | 
|   57   // not set or the connector was not enabled. |   55   // not set or the connector was not enabled. | 
|   58   bool EnforceCloudPrintConnectorPolicyAndQuit(); |   56   bool EnforceCloudPrintConnectorPolicyAndQuit(); | 
|   59  |   57  | 
|   60   bool ShowTokenExpiredNotification(); |   58   bool ShowTokenExpiredNotification(); | 
|   61   std::string proxy_id() const { return proxy_id_; } |   59   std::string proxy_id() const { return proxy_id_; } | 
|   62  |   60  | 
|   63   // CloudPrintSetupHandler::Delegate implementation. |   61   // CloudPrintSetupHandler::Delegate implementation. | 
|   64   virtual void OnCloudPrintSetupClosed() OVERRIDE; |   62   virtual void OnCloudPrintSetupClosed() OVERRIDE; | 
|   65  |   63  | 
|   66   // PrefObserver implementation. |  | 
|   67   virtual void OnPreferenceChanged(PrefServiceBase* service, |  | 
|   68                                    const std::string& pref_name) OVERRIDE; |  | 
|   69  |  | 
|   70  private: |   64  private: | 
|   71   // NotificationDelegate implementation for the token expired notification. |   65   // NotificationDelegate implementation for the token expired notification. | 
|   72   class TokenExpiredNotificationDelegate; |   66   class TokenExpiredNotificationDelegate; | 
|   73   friend class TokenExpiredNotificationDelegate; |   67   friend class TokenExpiredNotificationDelegate; | 
|   74  |   68  | 
|   75   Profile* profile_; |   69   Profile* profile_; | 
|   76   scoped_refptr<TokenExpiredNotificationDelegate> token_expired_delegate_; |   70   scoped_refptr<TokenExpiredNotificationDelegate> token_expired_delegate_; | 
|   77   scoped_ptr<CloudPrintSetupHandler> cloud_print_setup_handler_; |   71   scoped_ptr<CloudPrintSetupHandler> cloud_print_setup_handler_; | 
|   78   std::string proxy_id_; |   72   std::string proxy_id_; | 
|   79  |   73  | 
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  115   PrefChangeRegistrar pref_change_registrar_; |  109   PrefChangeRegistrar pref_change_registrar_; | 
|  116  |  110  | 
|  117   // If set, continue trying to disable the connector, and quit the process |  111   // If set, continue trying to disable the connector, and quit the process | 
|  118   // once successful. |  112   // once successful. | 
|  119   bool enforcing_connector_policy_; |  113   bool enforcing_connector_policy_; | 
|  120  |  114  | 
|  121   DISALLOW_COPY_AND_ASSIGN(CloudPrintProxyService); |  115   DISALLOW_COPY_AND_ASSIGN(CloudPrintProxyService); | 
|  122 }; |  116 }; | 
|  123  |  117  | 
|  124 #endif  // CHROME_BROWSER_PRINTING_CLOUD_PRINT_CLOUD_PRINT_PROXY_SERVICE_H_ |  118 #endif  // CHROME_BROWSER_PRINTING_CLOUD_PRINT_CLOUD_PRINT_PROXY_SERVICE_H_ | 
| OLD | NEW |