summaryrefslogtreecommitdiffstats
path: root/chrome/browser/sync/glue/bridged_sync_notifier.cc
blob: e856758f6ec38f97f0356c6af760a5d6c32df84e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "chrome/browser/sync/glue/bridged_sync_notifier.h"

#include "chrome/browser/sync/glue/chrome_sync_notification_bridge.h"

namespace browser_sync {

BridgedSyncNotifier::BridgedSyncNotifier(
    ChromeSyncNotificationBridge* bridge,
    csync::SyncNotifier* delegate)
    : bridge_(bridge), delegate_(delegate) {
  DCHECK(bridge_);
}

BridgedSyncNotifier::~BridgedSyncNotifier() {
}

void BridgedSyncNotifier::AddObserver(
    csync::SyncNotifierObserver* observer) {
  if (delegate_.get())
   delegate_->AddObserver(observer);
  bridge_->AddObserver(observer);
}

void BridgedSyncNotifier::RemoveObserver(
    csync::SyncNotifierObserver* observer) {
  bridge_->RemoveObserver(observer);
  if (delegate_.get())
    delegate_->RemoveObserver(observer);
}

void BridgedSyncNotifier::SetUniqueId(const std::string& unique_id) {
  if (delegate_.get())
    delegate_->SetUniqueId(unique_id);
}

void BridgedSyncNotifier::SetStateDeprecated(const std::string& state) {
  if (delegate_.get())
    delegate_->SetStateDeprecated(state);
}

void BridgedSyncNotifier::UpdateCredentials(
    const std::string& email, const std::string& token) {
  if (delegate_.get())
    delegate_->UpdateCredentials(email, token);
}

void BridgedSyncNotifier::UpdateEnabledTypes(
    syncable::ModelTypeSet enabled_types) {
  if (delegate_.get())
    delegate_->UpdateEnabledTypes(enabled_types);
}

void BridgedSyncNotifier::SendNotification(
    syncable::ModelTypeSet changed_types) {
  if (delegate_.get())
    delegate_->SendNotification(changed_types);
}

}  // namespace browser_sync