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/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" |
11 #include "base/strings/stringprintf.h" | 11 #include "base/strings/stringprintf.h" |
12 #include "base/threading/thread_task_runner_handle.h" | 12 #include "base/threading/thread_task_runner_handle.h" |
13 #include "components/history/core/browser/web_history_service.h" | 13 #include "components/history/core/browser/web_history_service.h" |
14 #include "components/sync_driver/sync_service.h" | 14 #include "components/sync/driver/sync_service.h" |
15 #include "components/version_info/version_info.h" | 15 #include "components/version_info/version_info.h" |
16 | 16 |
17 namespace { | 17 namespace { |
18 | 18 |
19 // Merges several asynchronous boolean callbacks into one that returns a boolean | 19 // Merges several asynchronous boolean callbacks into one that returns a boolean |
20 // product of their responses. Deletes itself when done. | 20 // product of their responses. Deletes itself when done. |
21 class MergeBooleanCallbacks { | 21 class MergeBooleanCallbacks { |
22 public: | 22 public: |
23 // Constructor. Upon receiving |expected_call_count| calls to |RunCallback|, | 23 // Constructor. Upon receiving |expected_call_count| calls to |RunCallback|, |
24 // |target_callback| will be run with the boolean product of their results. | 24 // |target_callback| will be run with the boolean product of their results. |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after 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_ui | 115 } // namespace browsing_data_ui |
OLD | NEW |