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 "base/command_line.h" |
8 #include "components/browser_sync/browser/profile_sync_service.h" | 9 #include "components/browser_sync/browser/profile_sync_service.h" |
9 #include "components/history/core/browser/web_history_service.h" | 10 #include "components/history/core/browser/web_history_service.h" |
10 | 11 |
11 namespace browsing_data_ui { | 12 namespace browsing_data_ui { |
12 | 13 |
| 14 namespace switches { |
| 15 |
| 16 const char kOverrideOtherFormsOfBrowsingHistoryQuery[] = |
| 17 "override-other-forms-of-browsing-history-query"; |
| 18 |
| 19 } |
| 20 |
13 void ShouldShowNoticeAboutOtherFormsOfBrowsingHistory( | 21 void ShouldShowNoticeAboutOtherFormsOfBrowsingHistory( |
14 const ProfileSyncService* sync_service, | 22 const ProfileSyncService* sync_service, |
15 history::WebHistoryService* history_service, | 23 history::WebHistoryService* history_service, |
16 base::Callback<void(bool)> callback) { | 24 base::Callback<void(bool)> callback) { |
| 25 bool override_other_forms_of_browsing_history_query = |
| 26 base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 27 switches::kOverrideOtherFormsOfBrowsingHistoryQuery); |
| 28 |
17 if (!sync_service || | 29 if (!sync_service || |
18 !sync_service->IsSyncActive() || | 30 !sync_service->IsSyncActive() || |
19 sync_service->IsUsingSecondaryPassphrase() || | 31 sync_service->IsUsingSecondaryPassphrase() || |
20 !history_service || | 32 !history_service || |
21 !history_service->HasOtherFormsOfBrowsingHistory()) { | 33 (!override_other_forms_of_browsing_history_query && |
| 34 !history_service->HasOtherFormsOfBrowsingHistory())) { |
22 callback.Run(false); | 35 callback.Run(false); |
23 return; | 36 return; |
24 } | 37 } |
25 | 38 |
26 history_service->QueryWebAndAppActivity(callback); | 39 history_service->QueryWebAndAppActivity(callback); |
27 } | 40 } |
28 | 41 |
29 void ShouldPopupDialogAboutOtherFormsOfBrowsingHistory( | 42 void ShouldPopupDialogAboutOtherFormsOfBrowsingHistory( |
30 const ProfileSyncService* sync_service, | 43 const ProfileSyncService* sync_service, |
31 history::WebHistoryService* history_service, | 44 history::WebHistoryService* history_service, |
32 base::Callback<void(bool)> callback) { | 45 base::Callback<void(bool)> callback) { |
33 ShouldShowNoticeAboutOtherFormsOfBrowsingHistory( | 46 ShouldShowNoticeAboutOtherFormsOfBrowsingHistory( |
34 sync_service, history_service, callback); | 47 sync_service, history_service, callback); |
35 } | 48 } |
36 | 49 |
37 } // namespace browsing_data_ui | 50 } // namespace browsing_data_ui |
OLD | NEW |