OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_EXTENSION_GCM_APP_HANDLER_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_GCM_APP_HANDLER_H_ |
6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_GCM_APP_HANDLER_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_GCM_APP_HANDLER_H_ |
7 | 7 |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "base/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
10 #include "chrome/browser/services/gcm/gcm_app_handler.h" | 10 #include "chrome/browser/services/gcm/gcm_app_handler.h" |
11 #include "content/public/browser/notification_observer.h" | 11 #include "content/public/browser/notification_observer.h" |
12 #include "content/public/browser/notification_registrar.h" | 12 #include "content/public/browser/notification_registrar.h" |
13 #include "extensions/browser/browser_context_keyed_api_factory.h" | 13 #include "extensions/browser/browser_context_keyed_api_factory.h" |
14 #include "google_apis/gcm/gcm_client.h" | 14 #include "google_apis/gcm/gcm_client.h" |
15 | 15 |
16 class Profile; | 16 class Profile; |
17 namespace content { | 17 namespace content { |
18 class BrowserContext; | 18 class BrowserContext; |
19 } | 19 } |
20 namespace gcm { | 20 namespace gcm { |
21 class GCMProfileService; | 21 class GCMService; |
22 } | 22 } |
23 | 23 |
24 namespace extensions { | 24 namespace extensions { |
25 | 25 |
26 class GcmJsEventRouter; | 26 class GcmJsEventRouter; |
27 | 27 |
28 // Defines the interface to provide handling logic for a given app. | 28 // Defines the interface to provide handling logic for a given app. |
29 class ExtensionGCMAppHandler : public gcm::GCMAppHandler, | 29 class ExtensionGCMAppHandler : public gcm::GCMAppHandler, |
30 public BrowserContextKeyedAPI, | 30 public BrowserContextKeyedAPI, |
31 public content::NotificationObserver { | 31 public content::NotificationObserver { |
(...skipping 20 matching lines...) Expand all Loading... |
52 gcm::GCMClient::Result result); | 52 gcm::GCMClient::Result result); |
53 | 53 |
54 private: | 54 private: |
55 friend class BrowserContextKeyedAPIFactory<ExtensionGCMAppHandler>; | 55 friend class BrowserContextKeyedAPIFactory<ExtensionGCMAppHandler>; |
56 | 56 |
57 // content::NotificationObserver implementation. | 57 // content::NotificationObserver implementation. |
58 virtual void Observe(int type, | 58 virtual void Observe(int type, |
59 const content::NotificationSource& source, | 59 const content::NotificationSource& source, |
60 const content::NotificationDetails& details) OVERRIDE; | 60 const content::NotificationDetails& details) OVERRIDE; |
61 | 61 |
62 gcm::GCMProfileService* GetGCMProfileService() const; | 62 gcm::GCMService* GetGCMService() const; |
63 | 63 |
64 // BrowserContextKeyedAPI implementation. | 64 // BrowserContextKeyedAPI implementation. |
65 static const char* service_name() { return "ExtensionGCMAppHandler"; } | 65 static const char* service_name() { return "ExtensionGCMAppHandler"; } |
66 static const bool kServiceIsNULLWhileTesting = true; | 66 static const bool kServiceIsNULLWhileTesting = true; |
67 | 67 |
68 Profile* profile_; | 68 Profile* profile_; |
69 content::NotificationRegistrar registrar_; | 69 content::NotificationRegistrar registrar_; |
70 | 70 |
71 #if !defined(OS_ANDROID) | 71 #if !defined(OS_ANDROID) |
72 scoped_ptr<extensions::GcmJsEventRouter> js_event_router_; | 72 scoped_ptr<extensions::GcmJsEventRouter> js_event_router_; |
73 #endif | 73 #endif |
74 | 74 |
75 base::WeakPtrFactory<ExtensionGCMAppHandler> weak_factory_; | 75 base::WeakPtrFactory<ExtensionGCMAppHandler> weak_factory_; |
76 | 76 |
77 DISALLOW_COPY_AND_ASSIGN(ExtensionGCMAppHandler); | 77 DISALLOW_COPY_AND_ASSIGN(ExtensionGCMAppHandler); |
78 }; | 78 }; |
79 | 79 |
80 } // namespace extensions | 80 } // namespace extensions |
81 | 81 |
82 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_GCM_APP_HANDLER_H_ | 82 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_GCM_APP_HANDLER_H_ |
OLD | NEW |