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 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 NOTREACHED() << "Browser process or profile manager not initialized"; | 90 NOTREACHED() << "Browser process or profile manager not initialized"; |
91 return; | 91 return; |
92 } | 92 } |
93 | 93 |
94 profile_ = ProfileManager::GetActiveUserProfile(); | 94 profile_ = ProfileManager::GetActiveUserProfile(); |
95 if (profile_ == nullptr) { | 95 if (profile_ == nullptr) { |
96 NOTREACHED() << "Sync Init: Profile not found."; | 96 NOTREACHED() << "Sync Init: Profile not found."; |
97 return; | 97 return; |
98 } | 98 } |
99 | 99 |
100 sync_prefs_.reset(new syncer::SyncPrefs(profile_->GetPrefs())); | 100 sync_prefs_ = base::MakeUnique<syncer::SyncPrefs>(profile_->GetPrefs()); |
101 | 101 |
102 sync_service_ = | 102 sync_service_ = |
103 ProfileSyncServiceFactory::GetInstance()->GetForProfile(profile_); | 103 ProfileSyncServiceFactory::GetInstance()->GetForProfile(profile_); |
104 } | 104 } |
105 | 105 |
106 bool ProfileSyncServiceAndroid::Init() { | 106 bool ProfileSyncServiceAndroid::Init() { |
107 if (sync_service_) { | 107 if (sync_service_) { |
108 sync_service_->AddObserver(this); | 108 sync_service_->AddObserver(this); |
109 sync_service_->SetPlatformSyncAllowedProvider( | 109 sync_service_->SetPlatformSyncAllowedProvider( |
110 base::Bind(&ProfileSyncServiceAndroid::IsSyncAllowedByAndroid, | 110 base::Bind(&ProfileSyncServiceAndroid::IsSyncAllowedByAndroid, |
(...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
512 static jlong Init(JNIEnv* env, const JavaParamRef<jobject>& obj) { | 512 static jlong Init(JNIEnv* env, const JavaParamRef<jobject>& obj) { |
513 ProfileSyncServiceAndroid* profile_sync_service_android = | 513 ProfileSyncServiceAndroid* profile_sync_service_android = |
514 new ProfileSyncServiceAndroid(env, obj); | 514 new ProfileSyncServiceAndroid(env, obj); |
515 if (profile_sync_service_android->Init()) { | 515 if (profile_sync_service_android->Init()) { |
516 return reinterpret_cast<intptr_t>(profile_sync_service_android); | 516 return reinterpret_cast<intptr_t>(profile_sync_service_android); |
517 } else { | 517 } else { |
518 delete profile_sync_service_android; | 518 delete profile_sync_service_android; |
519 return 0; | 519 return 0; |
520 } | 520 } |
521 } | 521 } |
OLD | NEW |