| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/sync/profile_sync_service_android.h" | 5 #include "chrome/browser/sync/profile_sync_service_android.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <string> | 10 #include <string> |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 } | 116 } |
| 117 | 117 |
| 118 ProfileSyncServiceAndroid::~ProfileSyncServiceAndroid() { | 118 ProfileSyncServiceAndroid::~ProfileSyncServiceAndroid() { |
| 119 if (sync_service_) { | 119 if (sync_service_) { |
| 120 sync_service_->RemoveObserver(this); | 120 sync_service_->RemoveObserver(this); |
| 121 sync_service_->SetPlatformSyncAllowedProvider( | 121 sync_service_->SetPlatformSyncAllowedProvider( |
| 122 ProfileSyncService::PlatformSyncAllowedProvider()); | 122 ProfileSyncService::PlatformSyncAllowedProvider()); |
| 123 } | 123 } |
| 124 } | 124 } |
| 125 | 125 |
| 126 void ProfileSyncServiceAndroid::OnStateChanged() { | 126 void ProfileSyncServiceAndroid::OnStateChanged(syncer::SyncService* sync) { |
| 127 // Notify the java world that our sync state has changed. | 127 // Notify the java world that our sync state has changed. |
| 128 JNIEnv* env = AttachCurrentThread(); | 128 JNIEnv* env = AttachCurrentThread(); |
| 129 Java_ProfileSyncService_syncStateChanged( | 129 Java_ProfileSyncService_syncStateChanged( |
| 130 env, weak_java_profile_sync_service_.get(env)); | 130 env, weak_java_profile_sync_service_.get(env)); |
| 131 } | 131 } |
| 132 | 132 |
| 133 bool ProfileSyncServiceAndroid::IsSyncAllowedByAndroid() const { | 133 bool ProfileSyncServiceAndroid::IsSyncAllowedByAndroid() const { |
| 134 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 134 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 135 JNIEnv* env = AttachCurrentThread(); | 135 JNIEnv* env = AttachCurrentThread(); |
| 136 return Java_ProfileSyncService_isMasterSyncEnabled( | 136 return Java_ProfileSyncService_isMasterSyncEnabled( |
| (...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 511 static jlong Init(JNIEnv* env, const JavaParamRef<jobject>& obj) { | 511 static jlong Init(JNIEnv* env, const JavaParamRef<jobject>& obj) { |
| 512 ProfileSyncServiceAndroid* profile_sync_service_android = | 512 ProfileSyncServiceAndroid* profile_sync_service_android = |
| 513 new ProfileSyncServiceAndroid(env, obj); | 513 new ProfileSyncServiceAndroid(env, obj); |
| 514 if (profile_sync_service_android->Init()) { | 514 if (profile_sync_service_android->Init()) { |
| 515 return reinterpret_cast<intptr_t>(profile_sync_service_android); | 515 return reinterpret_cast<intptr_t>(profile_sync_service_android); |
| 516 } else { | 516 } else { |
| 517 delete profile_sync_service_android; | 517 delete profile_sync_service_android; |
| 518 return 0; | 518 return 0; |
| 519 } | 519 } |
| 520 } | 520 } |
| OLD | NEW |