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/android/most_visited_sites.h" | 5 #include "chrome/browser/android/most_visited_sites.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/android/jni_android.h" | 10 #include "base/android/jni_android.h" |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 counter->Add(position); | 104 counter->Add(position); |
105 } | 105 } |
106 | 106 |
107 // Return the current SyncState for use with the SuggestionsService. | 107 // Return the current SyncState for use with the SuggestionsService. |
108 SyncState GetSyncState(Profile* profile) { | 108 SyncState GetSyncState(Profile* profile) { |
109 ProfileSyncService* sync = | 109 ProfileSyncService* sync = |
110 ProfileSyncServiceFactory::GetInstance()->GetForProfile(profile); | 110 ProfileSyncServiceFactory::GetInstance()->GetForProfile(profile); |
111 if (!sync) | 111 if (!sync) |
112 return SyncState::SYNC_OR_HISTORY_SYNC_DISABLED; | 112 return SyncState::SYNC_OR_HISTORY_SYNC_DISABLED; |
113 return suggestions::GetSyncState( | 113 return suggestions::GetSyncState( |
114 sync->IsSyncEnabledAndLoggedIn(), | 114 sync->CanSyncStart(), |
115 sync->IsSyncActive() && sync->ConfigurationDone(), | 115 sync->IsSyncActive() && sync->ConfigurationDone(), |
116 sync->GetActiveDataTypes().Has(syncer::HISTORY_DELETE_DIRECTIVES)); | 116 sync->GetActiveDataTypes().Has(syncer::HISTORY_DELETE_DIRECTIVES)); |
117 } | 117 } |
118 | 118 |
119 } // namespace | 119 } // namespace |
120 | 120 |
121 MostVisitedSites::MostVisitedSites(Profile* profile) | 121 MostVisitedSites::MostVisitedSites(Profile* profile) |
122 : profile_(profile), num_sites_(0), initial_load_done_(false), | 122 : profile_(profile), num_sites_(0), initial_load_done_(false), |
123 num_local_thumbs_(0), num_server_thumbs_(0), num_empty_thumbs_(0), | 123 num_local_thumbs_(0), num_server_thumbs_(0), num_empty_thumbs_(0), |
124 scoped_observer_(this), weak_ptr_factory_(this) { | 124 scoped_observer_(this), weak_ptr_factory_(this) { |
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
419 // The displayed suggestions are invalidated. | 419 // The displayed suggestions are invalidated. |
420 QueryMostVisitedURLs(); | 420 QueryMostVisitedURLs(); |
421 } | 421 } |
422 } | 422 } |
423 | 423 |
424 static jlong Init(JNIEnv* env, jobject obj, jobject jprofile) { | 424 static jlong Init(JNIEnv* env, jobject obj, jobject jprofile) { |
425 MostVisitedSites* most_visited_sites = | 425 MostVisitedSites* most_visited_sites = |
426 new MostVisitedSites(ProfileAndroid::FromProfileAndroid(jprofile)); | 426 new MostVisitedSites(ProfileAndroid::FromProfileAndroid(jprofile)); |
427 return reinterpret_cast<intptr_t>(most_visited_sites); | 427 return reinterpret_cast<intptr_t>(most_visited_sites); |
428 } | 428 } |
OLD | NEW |