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
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_SERVICES_GCM_GCM_PROFILE_SERVICE_H_
6 #define CHROME_BROWSER_SERVICES_GCM_GCM_PROFILE_SERVICE_H_
10 #include "base/compiler_specific.h"
11 #include "base/macros.h"
12 #include "base/memory/scoped_ptr.h"
13 #include "components/keyed_service/core/keyed_service.h"
17 namespace user_prefs
{
18 class PrefRegistrySyncable
;
23 class GCMClientFactory
;
26 #if defined(OS_CHROMEOS)
27 class GCMConnectionObserver
;
30 // Providing GCM service, via GCMDriver, to a profile.
31 class GCMProfileService
: public KeyedService
{
33 // Returns whether GCM is enabled for |profile|.
34 static bool IsGCMEnabled(Profile
* profile
);
36 #if defined(OS_ANDROID)
37 explicit GCMProfileService(Profile
* profile
);
39 GCMProfileService(Profile
* profile
,
40 scoped_ptr
<GCMClientFactory
> gcm_client_factory
);
42 ~GCMProfileService() override
;
45 void Shutdown() override
;
47 // For testing purpose.
48 void SetDriverForTesting(GCMDriver
* driver
);
50 GCMDriver
* driver() const { return driver_
.get(); }
53 // Used for constructing fake GCMProfileService for testing purpose.
57 // The profile which owns this object.
60 scoped_ptr
<GCMDriver
> driver_
;
62 // Used for both account tracker and GCM.UserSignedIn UMA.
63 #if !defined(OS_ANDROID)
64 class IdentityObserver
;
65 scoped_ptr
<IdentityObserver
> identity_observer_
;
68 DISALLOW_COPY_AND_ASSIGN(GCMProfileService
);
73 #endif // CHROME_BROWSER_SERVICES_GCM_GCM_PROFILE_SERVICE_H_