Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(109)

Side by Side Diff: chrome/browser/android/chrome_backup_watcher.cc

Issue 2496693002: Implement Android key/value backup (Closed)
Patch Set: More review comments Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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
OLDNEW
« no previous file with comments | « chrome/browser/android/chrome_backup_watcher.h ('k') | chrome/browser/android/chrome_jni_registrar.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698