| OLD | NEW |
| (Empty) | |
| 1 // Copyright 2016 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 #include "chrome/browser/android/chrome_backup_agent.h" |
| 6 #include "chrome/browser/android/chrome_backup_watcher.h" |
| 7 #include "chrome/browser/profiles/profile.h" |
| 8 #include "jni/ChromeBackupWatcher_jni.h" |
| 9 |
| 10 namespace chrome { |
| 11 namespace android { |
| 12 |
| 13 namespace { |
| 14 |
| 15 void BackupPrefsChanged( |
| 16 const base::android::ScopedJavaGlobalRef<jobject>& java_watcher) { |
| 17 Java_ChromeBackupWatcher_onBackupPrefsChanged( |
| 18 base::android::AttachCurrentThread(), java_watcher); |
| 19 } |
| 20 } |
| 21 |
| 22 ChromeBackupWatcher::ChromeBackupWatcher(Profile* profile) { |
| 23 JNIEnv* env = base::android::AttachCurrentThread(); |
| 24 // Create the Java class, and start watching the Android (Java) preferences |
| 25 java_watcher_.Reset(Java_ChromeBackupWatcher_createChromeBackupWatcher(env)); |
| 26 // Now watch the Chrome C++ preferences |
| 27 registrar_.Init(profile->GetPrefs()); |
| 28 base::RepeatingClosure callback = |
| 29 base::BindRepeating(&BackupPrefsChanged, java_watcher_); |
| 30 for (const std::string pref_name : GetBackupPrefNames()) { |
| 31 registrar_.Add(pref_name, callback); |
| 32 } |
| 33 } |
| 34 |
| 35 ChromeBackupWatcher::~ChromeBackupWatcher() {} |
| 36 |
| 37 } // namespace android |
| 38 } // namespace chrome |
| OLD | NEW |