Chromium Code Reviews| 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_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/event_router.h" | |
| 16 #include "chrome/browser/extensions/extension_function.h" | 17 #include "chrome/browser/extensions/extension_function.h" |
| 18 #include "chrome/browser/profiles/profile_keyed_service.h" | |
| 17 #include "chrome/browser/ui/webui/signin/login_ui_service.h" | 19 #include "chrome/browser/ui/webui/signin/login_ui_service.h" |
| 18 #include "content/public/browser/notification_observer.h" | 20 #include "content/public/browser/notification_observer.h" |
| 19 #include "content/public/browser/notification_registrar.h" | 21 #include "content/public/browser/notification_registrar.h" |
| 20 #include "google_apis/gaia/google_service_auth_error.h" | 22 #include "google_apis/gaia/google_service_auth_error.h" |
| 21 | 23 |
| 22 class Profile; | 24 class Profile; |
| 23 | 25 |
| 24 namespace extensions { | 26 namespace extensions { |
| 25 | 27 |
| 26 class PushMessagingInvalidationMapper; | 28 class PushMessagingInvalidationMapper; |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 97 virtual void OnObfuscatedGaiaIdFetchSuccess(const std::string& gaia_id) | 99 virtual void OnObfuscatedGaiaIdFetchSuccess(const std::string& gaia_id) |
| 98 OVERRIDE; | 100 OVERRIDE; |
| 99 virtual void OnObfuscatedGaiaIdFetchFailure( | 101 virtual void OnObfuscatedGaiaIdFetchFailure( |
| 100 const GoogleServiceAuthError& error) OVERRIDE; | 102 const GoogleServiceAuthError& error) OVERRIDE; |
| 101 scoped_ptr<ObfuscatedGaiaIdFetcher> fetcher_; | 103 scoped_ptr<ObfuscatedGaiaIdFetcher> fetcher_; |
| 102 bool interactive_; | 104 bool interactive_; |
| 103 | 105 |
| 104 DISALLOW_COPY_AND_ASSIGN(PushMessagingGetChannelIdFunction); | 106 DISALLOW_COPY_AND_ASSIGN(PushMessagingGetChannelIdFunction); |
| 105 }; | 107 }; |
| 106 | 108 |
| 109 class PushMessagingAPI : public ProfileKeyedService, | |
| 110 public extensions::EventRouter::Observer { | |
|
akalin
2012/12/10 20:37:12
indent with 'public' on the previous line
Joe Thomas
2012/12/10 22:43:58
Done.
| |
| 111 public: | |
| 112 explicit PushMessagingAPI(Profile* profile); | |
| 113 virtual ~PushMessagingAPI(); | |
| 114 | |
| 115 // Convenience method to get the ProcessesAPI for a profile. | |
| 116 static PushMessagingAPI* Get(Profile* profile); | |
| 117 | |
| 118 PushMessagingEventRouter* push_messaging_event_router(); | |
| 119 | |
| 120 // Called when the ProfileSyncService for the associated Profile is | |
| 121 // going to be destroyed. This is guaranteed to be called exactly | |
| 122 // once before Shutdown() is called. | |
| 123 // | |
| 124 // TODO(akalin): Remove this once http://crbug.com/153827 is fixed. | |
| 125 void OnProfileSyncServiceShutdown(); | |
| 126 | |
| 127 // ProfileKeyedService implementation. | |
| 128 virtual void Shutdown() OVERRIDE; | |
| 129 | |
| 130 // EventRouter::Observer implementation. | |
| 131 virtual void OnListenerAdded(const extensions::EventListenerInfo& details) | |
| 132 OVERRIDE; | |
| 133 | |
| 134 private: | |
| 135 Profile* profile_; | |
| 136 | |
| 137 // Created lazily upon OnListenerAdded. | |
| 138 scoped_ptr<PushMessagingEventRouter> push_messaging_event_router_; | |
| 139 }; | |
| 140 | |
| 107 } // namespace extension | 141 } // namespace extension |
| 108 | 142 |
| 109 #endif // CHROME_BROWSER_EXTENSIONS_API_PUSH_MESSAGING_PUSH_MESSAGING_API_H__ | 143 #endif // CHROME_BROWSER_EXTENSIONS_API_PUSH_MESSAGING_PUSH_MESSAGING_API_H__ |
| OLD | NEW |