| 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/ui/sync/profile_signin_confirmation_helper.h" | 5 #include "chrome/browser/ui/sync/profile_signin_confirmation_helper.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
| 9 #include "base/prefs/pref_service.h" | 9 #include "base/prefs/pref_service.h" |
| 10 #include "base/strings/string16.h" | 10 #include "base/strings/string16.h" |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 148 | 148 |
| 149 void ProfileSigninConfirmationHelper::CheckHasTypedURLs() { | 149 void ProfileSigninConfirmationHelper::CheckHasTypedURLs() { |
| 150 HistoryService* service = | 150 HistoryService* service = |
| 151 HistoryServiceFactory::GetForProfileWithoutCreating(profile_); | 151 HistoryServiceFactory::GetForProfileWithoutCreating(profile_); |
| 152 pending_requests_++; | 152 pending_requests_++; |
| 153 if (!service) { | 153 if (!service) { |
| 154 ReturnResult(false); | 154 ReturnResult(false); |
| 155 return; | 155 return; |
| 156 } | 156 } |
| 157 service->ScheduleDBTask( | 157 service->ScheduleDBTask( |
| 158 scoped_ptr<history::HistoryDBTask>(new HasTypedURLsTask( | 158 new HasTypedURLsTask( |
| 159 base::Bind(&ProfileSigninConfirmationHelper::ReturnResult, | 159 base::Bind(&ProfileSigninConfirmationHelper::ReturnResult, |
| 160 base::Unretained(this)))), | 160 base::Unretained(this))), |
| 161 &task_tracker_); | 161 &task_tracker_); |
| 162 } | 162 } |
| 163 | 163 |
| 164 void ProfileSigninConfirmationHelper::ReturnResult(bool result) { | 164 void ProfileSigninConfirmationHelper::ReturnResult(bool result) { |
| 165 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); | 165 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); |
| 166 // Pass |true| into the callback as soon as one of the tasks passes a | 166 // Pass |true| into the callback as soon as one of the tasks passes a |
| 167 // result of |true|, otherwise pass the last returned result. | 167 // result of |true|, otherwise pass the last returned result. |
| 168 if (--pending_requests_ == 0 || result) { | 168 if (--pending_requests_ == 0 || result) { |
| 169 return_result_.Run(result); | 169 return_result_.Run(result); |
| 170 | 170 |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 227 return; | 227 return; |
| 228 } | 228 } |
| 229 // Fire asynchronous queries for profile data. | 229 // Fire asynchronous queries for profile data. |
| 230 ProfileSigninConfirmationHelper* helper = | 230 ProfileSigninConfirmationHelper* helper = |
| 231 new ProfileSigninConfirmationHelper(profile, return_result); | 231 new ProfileSigninConfirmationHelper(profile, return_result); |
| 232 helper->CheckHasHistory(kHistoryEntriesBeforeNewProfilePrompt); | 232 helper->CheckHasHistory(kHistoryEntriesBeforeNewProfilePrompt); |
| 233 helper->CheckHasTypedURLs(); | 233 helper->CheckHasTypedURLs(); |
| 234 } | 234 } |
| 235 | 235 |
| 236 } // namespace ui | 236 } // namespace ui |
| OLD | NEW |