summaryrefslogtreecommitdiffstats
path: root/chrome/browser/invalidation/invalidation_controller_android.h
blob: c55601faa43591db699ac7bc048cf9ae5326554d (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
// Copyright 2013 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.

#ifndef CHROME_BROWSER_INVALIDATION_INVALIDATION_CONTROLLER_ANDROID_H_
#define CHROME_BROWSER_INVALIDATION_INVALIDATION_CONTROLLER_ANDROID_H_

#include <string>

#include "base/android/jni_android.h"
#include "base/android/jni_weak_ref.h"
#include "components/invalidation/invalidation_util.h"

namespace invalidation {

// Controls invalidation registration on Android. This class is a wrapper for
// the Java class org.chromium.sync.notifier.InvalidationController.
class InvalidationControllerAndroid {
 public:
  InvalidationControllerAndroid();
  virtual ~InvalidationControllerAndroid();

  // Sets object ids for which the invalidation client should register for
  // notification.
  virtual void SetRegisteredObjectIds(const syncer::ObjectIdSet& ids);

  // Asks the Java code to return the client ID it chose to use.
  std::string GetInvalidatorClientId();

 private:
  // The Java invalidation controller.
  base::android::ScopedJavaGlobalRef<jobject> invalidation_controller_;

  DISALLOW_COPY_AND_ASSIGN(InvalidationControllerAndroid);
};

bool RegisterInvalidationController(JNIEnv* env);

}  // namespace invalidation

#endif  // CHROME_BROWSER_INVALIDATION_INVALIDATION_CONTROLLER_ANDROID_H_