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

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

Issue 179843002: Make invalidations work for Chrome OS Kiosk Apps. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Restore TestingProfile boilerplate in gcm_invalidation_bridge_unittest.cc Created 6 years, 9 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/push_messaging/obfuscated_gaia_id_fetche r.h" 14 #include "chrome/browser/extensions/api/push_messaging/obfuscated_gaia_id_fetche r.h"
15 #include "chrome/browser/extensions/api/push_messaging/push_messaging_invalidati on_handler_delegate.h" 15 #include "chrome/browser/extensions/api/push_messaging/push_messaging_invalidati on_handler_delegate.h"
16 #include "chrome/browser/extensions/chrome_extension_function.h" 16 #include "chrome/browser/extensions/chrome_extension_function.h"
17 #include "chrome/browser/ui/webui/signin/login_ui_service.h" 17 #include "chrome/browser/ui/webui/signin/login_ui_service.h"
18 #include "content/public/browser/notification_observer.h" 18 #include "content/public/browser/notification_observer.h"
19 #include "content/public/browser/notification_registrar.h" 19 #include "content/public/browser/notification_registrar.h"
20 #include "extensions/browser/browser_context_keyed_api_factory.h" 20 #include "extensions/browser/browser_context_keyed_api_factory.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 { 26 namespace content {
27 class BrowserContext; 27 class BrowserContext;
28 } 28 }
29 29
30 namespace invalidation {
31 class InvalidationAuthProvider;
32 }
33
30 namespace extensions { 34 namespace extensions {
31 35
36 class ObfuscatedGaiaIdFetcher;
dcheng 2014/03/20 17:33:36 Do we need this forward declare at all, since we i
Mattias Nissler (ping if slow) 2014/03/20 17:40:09 Nope, good point. I had just mechanically alphabet
32 class PushMessagingInvalidationMapper; 37 class PushMessagingInvalidationMapper;
33 class ObfuscatedGaiaIdFetcher;
34 38
35 // Observes a single InvalidationHandler and generates onMessage events. 39 // Observes a single InvalidationHandler and generates onMessage events.
36 class PushMessagingEventRouter 40 class PushMessagingEventRouter
37 : public PushMessagingInvalidationHandlerDelegate { 41 : public PushMessagingInvalidationHandlerDelegate {
38 public: 42 public:
39 explicit PushMessagingEventRouter(Profile* profile); 43 explicit PushMessagingEventRouter(Profile* profile);
40 virtual ~PushMessagingEventRouter(); 44 virtual ~PushMessagingEventRouter();
41 45
42 // For testing purposes. 46 // For testing purposes.
43 void TriggerMessageForTest(const std::string& extension_id, 47 void TriggerMessageForTest(const std::string& extension_id,
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 // OAuth2TokenService::Consumer implementation. 94 // OAuth2TokenService::Consumer implementation.
91 virtual void OnGetTokenSuccess( 95 virtual void OnGetTokenSuccess(
92 const OAuth2TokenService::Request* request, 96 const OAuth2TokenService::Request* request,
93 const std::string& access_token, 97 const std::string& access_token,
94 const base::Time& expiration_time) OVERRIDE; 98 const base::Time& expiration_time) OVERRIDE;
95 virtual void OnGetTokenFailure( 99 virtual void OnGetTokenFailure(
96 const OAuth2TokenService::Request* request, 100 const OAuth2TokenService::Request* request,
97 const GoogleServiceAuthError& error) OVERRIDE; 101 const GoogleServiceAuthError& error) OVERRIDE;
98 102
99 // Check if the user is signed into chrome. 103 // Check if the user is signed into chrome.
100 bool IsUserLoggedIn() const; 104 bool IsUserLoggedIn();
101 105
102 // ObfuscatedGiaiaIdFetcher::Delegate implementation. 106 // ObfuscatedGiaiaIdFetcher::Delegate implementation.
103 virtual void OnObfuscatedGaiaIdFetchSuccess(const std::string& gaia_id) 107 virtual void OnObfuscatedGaiaIdFetchSuccess(const std::string& gaia_id)
104 OVERRIDE; 108 OVERRIDE;
105 virtual void OnObfuscatedGaiaIdFetchFailure( 109 virtual void OnObfuscatedGaiaIdFetchFailure(
106 const GoogleServiceAuthError& error) OVERRIDE; 110 const GoogleServiceAuthError& error) OVERRIDE;
111
112 // Convenience helper to get the invalidation auth provider.
113 invalidation::InvalidationAuthProvider* GetInvalidationAuthProvider();
114
107 scoped_ptr<ObfuscatedGaiaIdFetcher> fetcher_; 115 scoped_ptr<ObfuscatedGaiaIdFetcher> fetcher_;
108 bool interactive_; 116 bool interactive_;
109 scoped_ptr<OAuth2TokenService::Request> fetcher_access_token_request_; 117 scoped_ptr<OAuth2TokenService::Request> fetcher_access_token_request_;
110 118
111 DISALLOW_COPY_AND_ASSIGN(PushMessagingGetChannelIdFunction); 119 DISALLOW_COPY_AND_ASSIGN(PushMessagingGetChannelIdFunction);
112 }; 120 };
113 121
114 class PushMessagingAPI : public BrowserContextKeyedAPI, 122 class PushMessagingAPI : public BrowserContextKeyedAPI,
115 public content::NotificationObserver { 123 public content::NotificationObserver {
116 public: 124 public:
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 DISALLOW_COPY_AND_ASSIGN(PushMessagingAPI); 169 DISALLOW_COPY_AND_ASSIGN(PushMessagingAPI);
162 }; 170 };
163 171
164 template <> 172 template <>
165 void BrowserContextKeyedAPIFactory< 173 void BrowserContextKeyedAPIFactory<
166 PushMessagingAPI>::DeclareFactoryDependencies(); 174 PushMessagingAPI>::DeclareFactoryDependencies();
167 175
168 } // namespace extensions 176 } // namespace extensions
169 177
170 #endif // CHROME_BROWSER_EXTENSIONS_API_PUSH_MESSAGING_PUSH_MESSAGING_API_H__ 178 #endif // CHROME_BROWSER_EXTENSIONS_API_PUSH_MESSAGING_PUSH_MESSAGING_API_H__
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698