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

Side by Side Diff: chrome/browser/extensions/api/push_messaging/push_messaging_api.h

Issue 166053003: Move ProfileKeyedAPI implementations to take BrowserContext in the constructor (part 2). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: | Created 6 years, 10 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
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_PUSH_MESSAGING_PUSH_MESSAGING_API_H__ 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_PUSH_MESSAGING_PUSH_MESSAGING_API_H__
6 #define CHROME_BROWSER_EXTENSIONS_API_PUSH_MESSAGING_PUSH_MESSAGING_API_H__ 6 #define CHROME_BROWSER_EXTENSIONS_API_PUSH_MESSAGING_PUSH_MESSAGING_API_H__
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
11 #include "base/compiler_specific.h" 11 #include "base/compiler_specific.h"
12 #include "base/gtest_prod_util.h" 12 #include "base/gtest_prod_util.h"
13 #include "base/memory/scoped_ptr.h" 13 #include "base/memory/scoped_ptr.h"
14 #include "chrome/browser/extensions/api/profile_keyed_api_factory.h" 14 #include "chrome/browser/extensions/api/profile_keyed_api_factory.h"
15 #include "chrome/browser/extensions/api/push_messaging/obfuscated_gaia_id_fetche r.h" 15 #include "chrome/browser/extensions/api/push_messaging/obfuscated_gaia_id_fetche r.h"
16 #include "chrome/browser/extensions/api/push_messaging/push_messaging_invalidati on_handler_delegate.h" 16 #include "chrome/browser/extensions/api/push_messaging/push_messaging_invalidati on_handler_delegate.h"
17 #include "chrome/browser/extensions/chrome_extension_function.h" 17 #include "chrome/browser/extensions/chrome_extension_function.h"
18 #include "chrome/browser/ui/webui/signin/login_ui_service.h" 18 #include "chrome/browser/ui/webui/signin/login_ui_service.h"
19 #include "content/public/browser/notification_observer.h" 19 #include "content/public/browser/notification_observer.h"
20 #include "content/public/browser/notification_registrar.h" 20 #include "content/public/browser/notification_registrar.h"
21 #include "google_apis/gaia/google_service_auth_error.h" 21 #include "google_apis/gaia/google_service_auth_error.h"
22 #include "google_apis/gaia/oauth2_token_service.h" 22 #include "google_apis/gaia/oauth2_token_service.h"
23 23
24 class Profile; 24 class Profile;
25 25
26 namespace content {
27 class BrowserContext;
28 }
29
26 namespace extensions { 30 namespace extensions {
27 31
28 class PushMessagingInvalidationMapper; 32 class PushMessagingInvalidationMapper;
29 class ObfuscatedGaiaIdFetcher; 33 class ObfuscatedGaiaIdFetcher;
30 34
31 // Observes a single InvalidationHandler and generates onMessage events. 35 // Observes a single InvalidationHandler and generates onMessage events.
32 class PushMessagingEventRouter 36 class PushMessagingEventRouter
33 : public PushMessagingInvalidationHandlerDelegate { 37 : public PushMessagingInvalidationHandlerDelegate {
34 public: 38 public:
35 explicit PushMessagingEventRouter(Profile* profile); 39 explicit PushMessagingEventRouter(Profile* profile);
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 scoped_ptr<ObfuscatedGaiaIdFetcher> fetcher_; 107 scoped_ptr<ObfuscatedGaiaIdFetcher> fetcher_;
104 bool interactive_; 108 bool interactive_;
105 scoped_ptr<OAuth2TokenService::Request> fetcher_access_token_request_; 109 scoped_ptr<OAuth2TokenService::Request> fetcher_access_token_request_;
106 110
107 DISALLOW_COPY_AND_ASSIGN(PushMessagingGetChannelIdFunction); 111 DISALLOW_COPY_AND_ASSIGN(PushMessagingGetChannelIdFunction);
108 }; 112 };
109 113
110 class PushMessagingAPI : public ProfileKeyedAPI, 114 class PushMessagingAPI : public ProfileKeyedAPI,
111 public content::NotificationObserver { 115 public content::NotificationObserver {
112 public: 116 public:
113 explicit PushMessagingAPI(Profile* profile); 117 explicit PushMessagingAPI(content::BrowserContext* context);
114 virtual ~PushMessagingAPI(); 118 virtual ~PushMessagingAPI();
115 119
116 // Convenience method to get the PushMessagingAPI for a profile. 120 // Convenience method to get the PushMessagingAPI for a profile.
117 static PushMessagingAPI* Get(Profile* profile); 121 static PushMessagingAPI* Get(content::BrowserContext* context);
118 122
119 // BrowserContextKeyedService implementation. 123 // BrowserContextKeyedService implementation.
120 virtual void Shutdown() OVERRIDE; 124 virtual void Shutdown() OVERRIDE;
121 125
122 // ProfileKeyedAPI implementation. 126 // ProfileKeyedAPI implementation.
123 static ProfileKeyedAPIFactory<PushMessagingAPI>* GetFactoryInstance(); 127 static ProfileKeyedAPIFactory<PushMessagingAPI>* GetFactoryInstance();
124 128
125 // For testing purposes. 129 // For testing purposes.
126 PushMessagingEventRouter* GetEventRouterForTest() const { 130 PushMessagingEventRouter* GetEventRouterForTest() const {
127 return event_router_.get(); 131 return event_router_.get();
(...skipping 28 matching lines...) Expand all
156 160
157 DISALLOW_COPY_AND_ASSIGN(PushMessagingAPI); 161 DISALLOW_COPY_AND_ASSIGN(PushMessagingAPI);
158 }; 162 };
159 163
160 template <> 164 template <>
161 void ProfileKeyedAPIFactory<PushMessagingAPI>::DeclareFactoryDependencies(); 165 void ProfileKeyedAPIFactory<PushMessagingAPI>::DeclareFactoryDependencies();
162 166
163 } // namespace extensions 167 } // namespace extensions
164 168
165 #endif // CHROME_BROWSER_EXTENSIONS_API_PUSH_MESSAGING_PUSH_MESSAGING_API_H__ 169 #endif // CHROME_BROWSER_EXTENSIONS_API_PUSH_MESSAGING_PUSH_MESSAGING_API_H__
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698