p2p_invalidation_forwarder.h revision a1401311d1ab56c4ed0a474bd38c108f75cb0cd9
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
3// found in the LICENSE file.
4
5#ifndef CHROME_BROWSER_SYNC_TEST_INTEGRATION_P2P_INVALIDATION_FORWARDER_H_
6#define CHROME_BROWSER_SYNC_TEST_INTEGRATION_P2P_INVALIDATION_FORWARDER_H_
7
8#include "base/compiler_specific.h"
9#include "chrome/browser/sync/profile_sync_service_observer.h"
10
11class ProfileSyncService;
12
13namespace invalidation {
14class P2PInvalidationService;
15};
16
17// This class links the ProfileSyncService to a P2PInvalidationService.
18//
19// It will observe ProfileSyncService events and emit invalidation events for
20// any committed changes in observes.
21//
22// It register and unregisters in its constructor and destructor.  This is
23// intended to make it easy to manage with a scoped_ptr.
24class P2PInvalidationForwarder : public ProfileSyncServiceObserver {
25 public:
26  P2PInvalidationForwarder(
27      ProfileSyncService* sync_service,
28      invalidation::P2PInvalidationService* invalidation_service);
29  virtual ~P2PInvalidationForwarder();
30
31  // Implementation of ProfileSyncServiceObserver
32  virtual void OnStateChanged() OVERRIDE;
33  virtual void OnSyncCycleCompleted() OVERRIDE;
34
35 private:
36  ProfileSyncService* sync_service_;
37  invalidation::P2PInvalidationService* invalidation_service_;
38};
39
40#endif  // CHROME_BROWSER_SYNC_TEST_INTEGRATION_P2P_INVALIDATION_FORWARDER_H_
41