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/core/history_notice_utils.h" | 5 #include "components/browsing_data/core/history_notice_utils.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/location.h" | 9 #include "base/location.h" |
10 #include "base/single_thread_task_runner.h" | 10 #include "base/single_thread_task_runner.h" |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 | 53 |
54 namespace browsing_data { | 54 namespace browsing_data { |
55 | 55 |
56 namespace testing { | 56 namespace testing { |
57 | 57 |
58 bool g_override_other_forms_of_browsing_history_query = false; | 58 bool g_override_other_forms_of_browsing_history_query = false; |
59 | 59 |
60 } // namespace testing | 60 } // namespace testing |
61 | 61 |
62 void ShouldShowNoticeAboutOtherFormsOfBrowsingHistory( | 62 void ShouldShowNoticeAboutOtherFormsOfBrowsingHistory( |
63 const sync_driver::SyncService* sync_service, | 63 const syncer::SyncService* sync_service, |
64 history::WebHistoryService* history_service, | 64 history::WebHistoryService* history_service, |
65 base::Callback<void(bool)> callback) { | 65 base::Callback<void(bool)> callback) { |
66 if (!sync_service || | 66 if (!sync_service || |
67 !sync_service->IsSyncActive() || | 67 !sync_service->IsSyncActive() || |
68 !sync_service->GetActiveDataTypes().Has( | 68 !sync_service->GetActiveDataTypes().Has( |
69 syncer::HISTORY_DELETE_DIRECTIVES) || | 69 syncer::HISTORY_DELETE_DIRECTIVES) || |
70 sync_service->IsUsingSecondaryPassphrase() || | 70 sync_service->IsUsingSecondaryPassphrase() || |
71 !history_service) { | 71 !history_service) { |
72 callback.Run(false); | 72 callback.Run(false); |
73 return; | 73 return; |
74 } | 74 } |
75 | 75 |
76 history_service->QueryWebAndAppActivity(callback); | 76 history_service->QueryWebAndAppActivity(callback); |
77 } | 77 } |
78 | 78 |
79 void ShouldPopupDialogAboutOtherFormsOfBrowsingHistory( | 79 void ShouldPopupDialogAboutOtherFormsOfBrowsingHistory( |
80 const sync_driver::SyncService* sync_service, | 80 const syncer::SyncService* sync_service, |
81 history::WebHistoryService* history_service, | 81 history::WebHistoryService* history_service, |
82 version_info::Channel channel, | 82 version_info::Channel channel, |
83 base::Callback<void(bool)> callback) { | 83 base::Callback<void(bool)> callback) { |
84 // If the query for other forms of browsing history is overriden for testing, | 84 // If the query for other forms of browsing history is overriden for testing, |
85 // the conditions are identical with | 85 // the conditions are identical with |
86 // ShouldShowNoticeAboutOtherFormsOfBrowsingHistory. | 86 // ShouldShowNoticeAboutOtherFormsOfBrowsingHistory. |
87 if (testing::g_override_other_forms_of_browsing_history_query) { | 87 if (testing::g_override_other_forms_of_browsing_history_query) { |
88 ShouldShowNoticeAboutOtherFormsOfBrowsingHistory( | 88 ShouldShowNoticeAboutOtherFormsOfBrowsingHistory( |
89 sync_service, history_service, callback); | 89 sync_service, history_service, callback); |
90 return; | 90 return; |
(...skipping 15 matching lines...) Expand all Loading... |
106 MergeBooleanCallbacks* merger = new MergeBooleanCallbacks(2, callback); | 106 MergeBooleanCallbacks* merger = new MergeBooleanCallbacks(2, callback); |
107 history_service->QueryWebAndAppActivity(base::Bind( | 107 history_service->QueryWebAndAppActivity(base::Bind( |
108 &MergeBooleanCallbacks::RunCallback, base::Unretained(merger))); | 108 &MergeBooleanCallbacks::RunCallback, base::Unretained(merger))); |
109 history_service->QueryOtherFormsOfBrowsingHistory( | 109 history_service->QueryOtherFormsOfBrowsingHistory( |
110 channel, | 110 channel, |
111 base::Bind( | 111 base::Bind( |
112 &MergeBooleanCallbacks::RunCallback, base::Unretained(merger))); | 112 &MergeBooleanCallbacks::RunCallback, base::Unretained(merger))); |
113 } | 113 } |
114 | 114 |
115 } // namespace browsing_data | 115 } // namespace browsing_data |
OLD | NEW |