OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 #include "chrome/browser/services/gcm/gcm_profile_service_factory.h" | 5 #include "chrome/browser/services/gcm/gcm_profile_service_factory.h" |
6 | 6 |
7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
8 #include "chrome/browser/profiles/incognito_helpers.h" | 8 #include "chrome/browser/profiles/incognito_helpers.h" |
9 #include "chrome/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
10 #include "chrome/browser/services/gcm/gcm_profile_service.h" | 10 #include "chrome/browser/services/gcm/gcm_profile_service.h" |
11 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" | 11 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" |
12 #include "chrome/browser/signin/signin_manager_factory.h" | 12 #include "chrome/browser/signin/signin_manager_factory.h" |
13 #include "components/gcm_driver/gcm_client_factory.h" | |
14 #include "components/keyed_service/content/browser_context_dependency_manager.h" | 13 #include "components/keyed_service/content/browser_context_dependency_manager.h" |
15 | 14 |
16 #if !defined(OS_ANDROID) | 15 #if !defined(OS_ANDROID) |
17 #include "chrome/browser/ui/webui/signin/login_ui_service_factory.h" | 16 #include "chrome/browser/ui/webui/signin/login_ui_service_factory.h" |
| 17 #include "components/gcm_driver/gcm_client_factory.h" |
18 #endif | 18 #endif |
19 | 19 |
20 namespace gcm { | 20 namespace gcm { |
21 | 21 |
22 // static | 22 // static |
23 GCMProfileService* GCMProfileServiceFactory::GetForProfile(Profile* profile) { | 23 GCMProfileService* GCMProfileServiceFactory::GetForProfile(Profile* profile) { |
24 // GCM is not supported in incognito mode. | 24 // GCM is not supported in incognito mode. |
25 if (profile->IsOffTheRecord()) | 25 if (profile->IsOffTheRecord()) |
26 return NULL; | 26 return NULL; |
27 | 27 |
(...skipping 15 matching lines...) Expand all Loading... |
43 #if !defined(OS_ANDROID) | 43 #if !defined(OS_ANDROID) |
44 DependsOn(LoginUIServiceFactory::GetInstance()); | 44 DependsOn(LoginUIServiceFactory::GetInstance()); |
45 #endif | 45 #endif |
46 } | 46 } |
47 | 47 |
48 GCMProfileServiceFactory::~GCMProfileServiceFactory() { | 48 GCMProfileServiceFactory::~GCMProfileServiceFactory() { |
49 } | 49 } |
50 | 50 |
51 KeyedService* GCMProfileServiceFactory::BuildServiceInstanceFor( | 51 KeyedService* GCMProfileServiceFactory::BuildServiceInstanceFor( |
52 content::BrowserContext* context) const { | 52 content::BrowserContext* context) const { |
| 53 #if defined(OS_ANDROID) |
| 54 return new GCMProfileService(Profile::FromBrowserContext(context)); |
| 55 #else |
53 return new GCMProfileService( | 56 return new GCMProfileService( |
54 Profile::FromBrowserContext(context), | 57 Profile::FromBrowserContext(context), |
55 scoped_ptr<GCMClientFactory>(new GCMClientFactory)); | 58 scoped_ptr<GCMClientFactory>(new GCMClientFactory)); |
| 59 #endif |
56 } | 60 } |
57 | 61 |
58 content::BrowserContext* GCMProfileServiceFactory::GetBrowserContextToUse( | 62 content::BrowserContext* GCMProfileServiceFactory::GetBrowserContextToUse( |
59 content::BrowserContext* context) const { | 63 content::BrowserContext* context) const { |
60 return chrome::GetBrowserContextOwnInstanceInIncognito(context); | 64 return chrome::GetBrowserContextOwnInstanceInIncognito(context); |
61 } | 65 } |
62 | 66 |
63 } // namespace gcm | 67 } // namespace gcm |
OLD | NEW |