| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 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 | 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 "components/browsing_data_ui/history_notice_utils.h" | 5 #include "components/browsing_data_ui/history_notice_utils.h" |
| 6 | 6 |
| 7 #include "base/callback.h" | 7 #include "base/callback.h" |
| 8 #include "components/browser_sync/browser/profile_sync_service.h" | 8 #include "components/browser_sync/browser/profile_sync_service.h" |
| 9 #include "components/history/core/browser/web_history_service.h" | 9 #include "components/history/core/browser/web_history_service.h" |
| 10 | 10 |
| 11 namespace browsing_data_ui { | 11 namespace browsing_data_ui { |
| 12 | 12 |
| 13 namespace testing { | 13 namespace testing { |
| 14 | 14 |
| 15 bool g_override_other_forms_of_browsing_history_query = false; | 15 bool g_override_other_forms_of_browsing_history_query = false; |
| 16 | 16 |
| 17 } | 17 } |
| 18 | 18 |
| 19 void ShouldShowNoticeAboutOtherFormsOfBrowsingHistory( | 19 void ShouldShowNoticeAboutOtherFormsOfBrowsingHistory( |
| 20 const ProfileSyncService* sync_service, | 20 const ProfileSyncService* sync_service, |
| 21 history::WebHistoryService* history_service, | 21 history::WebHistoryService* history_service, |
| 22 base::Callback<void(bool)> callback) { | 22 base::Callback<void(bool)> callback) { |
| 23 if (!sync_service || | 23 if (!sync_service || |
| 24 !sync_service->IsSyncActive() || | 24 !sync_service->IsSyncActive() || |
| 25 sync_service->IsUsingSecondaryPassphrase() || | 25 sync_service->IsUsingSecondaryPassphrase() || |
| 26 !history_service || | 26 !history_service) { |
| 27 (!testing::g_override_other_forms_of_browsing_history_query && | |
| 28 !history_service->HasOtherFormsOfBrowsingHistory())) { | |
| 29 callback.Run(false); | 27 callback.Run(false); |
| 30 return; | 28 return; |
| 31 } | 29 } |
| 32 | 30 |
| 33 history_service->QueryWebAndAppActivity(callback); | 31 history_service->QueryWebAndAppActivity(callback); |
| 34 } | 32 } |
| 35 | 33 |
| 36 void ShouldPopupDialogAboutOtherFormsOfBrowsingHistory( | 34 void ShouldPopupDialogAboutOtherFormsOfBrowsingHistory( |
| 37 const ProfileSyncService* sync_service, | 35 const ProfileSyncService* sync_service, |
| 38 history::WebHistoryService* history_service, | 36 history::WebHistoryService* history_service, |
| 39 base::Callback<void(bool)> callback) { | 37 base::Callback<void(bool)> callback) { |
| 38 if (!history_service || |
| 39 (!testing::g_override_other_forms_of_browsing_history_query && |
| 40 !history_service->HasOtherFormsOfBrowsingHistory())) { |
| 41 callback.Run(false); |
| 42 return; |
| 43 } |
| 44 |
| 40 ShouldShowNoticeAboutOtherFormsOfBrowsingHistory( | 45 ShouldShowNoticeAboutOtherFormsOfBrowsingHistory( |
| 41 sync_service, history_service, callback); | 46 sync_service, history_service, callback); |
| 42 } | 47 } |
| 43 | 48 |
| 44 } // namespace browsing_data_ui | 49 } // namespace browsing_data_ui |
| OLD | NEW |