Chromium Code Reviews| 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 } | |
|
Bernhard Bauer
2016/11/14 10:05:39
Add an empty line after this one.
aberent
2016/11/14 17:23:40
Done.
| |
| 20 } | |
| 21 | |
| 22 ChromeBackupWatcher::ChromeBackupWatcher(Profile* profile) | |
| 23 : registrar_(new PrefChangeRegistrar) { | |
| 24 JNIEnv* env = base::android::AttachCurrentThread(); | |
| 25 // Create the Java class, and start watching the Android (Java) preferences | |
| 26 java_watcher_.Reset(Java_ChromeBackupWatcher_createChromeBackupWatcher(env)); | |
| 27 // Now watch the Chrome C++ preferences | |
| 28 registrar_->Init(profile->GetPrefs()); | |
| 29 base::Closure callback = base::Bind(&BackupPrefsChanged, java_watcher_); | |
|
Bernhard Bauer
2016/11/14 10:05:39
In the interest of future-proofing the code, use a
aberent
2016/11/14 17:23:40
Done.
| |
| 30 for (const std::string pref_name : GetBackupPrefNames()) { | |
| 31 registrar_->Add(pref_name, callback); | |
| 32 } | |
| 33 } | |
| 34 | |
| 35 } // namespace android | |
| 36 } // namespace chrome | |
| OLD | NEW |