Componentize HistoryURLProvider/ScoredHistoryMatch.
[chromium-blink-merge.git] / chrome / browser / services / gcm / gcm_profile_service.h
blob7eba5eafd5cdb9f70117f4bc2f793f94b8d38aa9
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_
8 #include <string>
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"
15 class Profile;
17 namespace user_prefs {
18 class PrefRegistrySyncable;
21 namespace gcm {
23 class GCMClientFactory;
24 class GCMDriver;
26 #if defined(OS_CHROMEOS)
27 class GCMConnectionObserver;
28 #endif
30 // Providing GCM service, via GCMDriver, to a profile.
31 class GCMProfileService : public KeyedService {
32 public:
33 // Returns whether GCM is enabled for |profile|.
34 static bool IsGCMEnabled(Profile* profile);
36 #if defined(OS_ANDROID)
37 explicit GCMProfileService(Profile* profile);
38 #else
39 GCMProfileService(Profile* profile,
40 scoped_ptr<GCMClientFactory> gcm_client_factory);
41 #endif
42 ~GCMProfileService() override;
44 // KeyedService:
45 void Shutdown() override;
47 // For testing purpose.
48 void SetDriverForTesting(GCMDriver* driver);
50 GCMDriver* driver() const { return driver_.get(); }
52 protected:
53 // Used for constructing fake GCMProfileService for testing purpose.
54 GCMProfileService();
56 private:
57 // The profile which owns this object.
58 Profile* profile_;
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_;
66 #endif
68 DISALLOW_COPY_AND_ASSIGN(GCMProfileService);
71 } // namespace gcm
73 #endif // CHROME_BROWSER_SERVICES_GCM_GCM_PROFILE_SERVICE_H_