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

Side by Side Diff: chrome/browser/printing/cloud_print/cloud_print_proxy_service.h

Issue 11345008: Remove content::NotificationObserver dependency from most Prefs code. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge to head for commit Created 8 years, 1 month 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
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_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"
16 #include "chrome/browser/printing/cloud_print/cloud_print_setup_handler.h" 17 #include "chrome/browser/printing/cloud_print/cloud_print_setup_handler.h"
17 #include "chrome/browser/profiles/profile_keyed_service.h" 18 #include "chrome/browser/profiles/profile_keyed_service.h"
18 #include "content/public/browser/notification_observer.h"
19 19
20 class Profile; 20 class Profile;
21 class ServiceProcessControl; 21 class ServiceProcessControl;
22 22
23 namespace cloud_print { 23 namespace cloud_print {
24 struct CloudPrintProxyInfo; 24 struct CloudPrintProxyInfo;
25 } // namespace cloud_print 25 } // namespace cloud_print
26 26
27 // Layer between the browser user interface and the cloud print proxy code 27 // Layer between the browser user interface and the cloud print proxy code
28 // running in the service process. 28 // running in the service process.
29 class CloudPrintProxyService 29 class CloudPrintProxyService
30 : public CloudPrintSetupHandlerDelegate, 30 : public CloudPrintSetupHandlerDelegate,
31 public ProfileKeyedService, 31 public ProfileKeyedService,
32 public content::NotificationObserver { 32 public PrefObserver {
33 public: 33 public:
34 explicit CloudPrintProxyService(Profile* profile); 34 explicit CloudPrintProxyService(Profile* profile);
35 virtual ~CloudPrintProxyService(); 35 virtual ~CloudPrintProxyService();
36 36
37 // 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
38 // class is constructed. 38 // class is constructed.
39 void Initialize(); 39 void Initialize();
40 40
41 // Enables/disables cloud printing for the user 41 // Enables/disables cloud printing for the user
42 virtual void EnableForUser(const std::string& lsid, const std::string& email); 42 virtual void EnableForUser(const std::string& lsid, const std::string& email);
(...skipping 13 matching lines...) Expand all
56 // 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
57 // not set or the connector was not enabled. 57 // not set or the connector was not enabled.
58 bool EnforceCloudPrintConnectorPolicyAndQuit(); 58 bool EnforceCloudPrintConnectorPolicyAndQuit();
59 59
60 bool ShowTokenExpiredNotification(); 60 bool ShowTokenExpiredNotification();
61 std::string proxy_id() const { return proxy_id_; } 61 std::string proxy_id() const { return proxy_id_; }
62 62
63 // CloudPrintSetupHandler::Delegate implementation. 63 // CloudPrintSetupHandler::Delegate implementation.
64 virtual void OnCloudPrintSetupClosed() OVERRIDE; 64 virtual void OnCloudPrintSetupClosed() OVERRIDE;
65 65
66 // content::NotificationObserver implementation. 66 // PrefObserver implementation.
67 virtual void Observe(int type, 67 virtual void OnPreferenceChanged(PrefServiceBase* service,
68 const content::NotificationSource& source, 68 const std::string& pref_name) OVERRIDE;
69 const content::NotificationDetails& details) OVERRIDE;
70 69
71 private: 70 private:
72 // NotificationDelegate implementation for the token expired notification. 71 // NotificationDelegate implementation for the token expired notification.
73 class TokenExpiredNotificationDelegate; 72 class TokenExpiredNotificationDelegate;
74 friend class TokenExpiredNotificationDelegate; 73 friend class TokenExpiredNotificationDelegate;
75 74
76 Profile* profile_; 75 Profile* profile_;
77 scoped_refptr<TokenExpiredNotificationDelegate> token_expired_delegate_; 76 scoped_refptr<TokenExpiredNotificationDelegate> token_expired_delegate_;
78 scoped_ptr<CloudPrintSetupHandler> cloud_print_setup_handler_; 77 scoped_ptr<CloudPrintSetupHandler> cloud_print_setup_handler_;
79 std::string proxy_id_; 78 std::string proxy_id_;
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 PrefChangeRegistrar pref_change_registrar_; 115 PrefChangeRegistrar pref_change_registrar_;
117 116
118 // If set, continue trying to disable the connector, and quit the process 117 // If set, continue trying to disable the connector, and quit the process
119 // once successful. 118 // once successful.
120 bool enforcing_connector_policy_; 119 bool enforcing_connector_policy_;
121 120
122 DISALLOW_COPY_AND_ASSIGN(CloudPrintProxyService); 121 DISALLOW_COPY_AND_ASSIGN(CloudPrintProxyService);
123 }; 122 };
124 123
125 #endif // CHROME_BROWSER_PRINTING_CLOUD_PRINT_CLOUD_PRINT_PROXY_SERVICE_H_ 124 #endif // CHROME_BROWSER_PRINTING_CLOUD_PRINT_CLOUD_PRINT_PROXY_SERVICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698