| OLD | NEW |
| 1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2015 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/counters/history_counter.h" | 5 #include "components/browsing_data/core/counters/history_counter.h" |
| 6 | 6 |
| 7 #include <limits.h> | 7 #include <limits.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
| 11 #include "base/timer/timer.h" | 11 #include "base/timer/timer.h" |
| 12 #include "components/browsing_data/core/pref_names.h" | 12 #include "components/browsing_data/core/pref_names.h" |
| 13 | 13 |
| 14 namespace { | 14 namespace { |
| 15 static const int64_t kWebHistoryTimeoutSeconds = 10; | 15 static const int64_t kWebHistoryTimeoutSeconds = 10; |
| 16 } | 16 } |
| 17 | 17 |
| 18 namespace browsing_data { | 18 namespace browsing_data { |
| 19 | 19 |
| 20 HistoryCounter::HistoryCounter( | 20 HistoryCounter::HistoryCounter( |
| 21 history::HistoryService* history_service, | 21 history::HistoryService* history_service, |
| 22 const GetUpdatedWebHistoryServiceCallback& callback, | 22 const GetUpdatedWebHistoryServiceCallback& callback, |
| 23 sync_driver::SyncService* sync_service) | 23 syncer::SyncService* sync_service) |
| 24 : history_service_(history_service), | 24 : history_service_(history_service), |
| 25 web_history_service_callback_(callback), | 25 web_history_service_callback_(callback), |
| 26 sync_service_(sync_service), | 26 sync_service_(sync_service), |
| 27 has_synced_visits_(false), | 27 has_synced_visits_(false), |
| 28 local_counting_finished_(false), | 28 local_counting_finished_(false), |
| 29 web_counting_finished_(false), | 29 web_counting_finished_(false), |
| 30 history_sync_enabled_(false), | 30 history_sync_enabled_(false), |
| 31 weak_ptr_factory_(this) {} | 31 weak_ptr_factory_(this) {} |
| 32 | 32 |
| 33 HistoryCounter::~HistoryCounter() { | 33 HistoryCounter::~HistoryCounter() { |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 | 163 |
| 164 // If the history sync was just enabled or disabled, restart the counter | 164 // If the history sync was just enabled or disabled, restart the counter |
| 165 // so that we update the result accordingly. | 165 // so that we update the result accordingly. |
| 166 if (history_sync_enabled_ != history_sync_enabled_new_state) { | 166 if (history_sync_enabled_ != history_sync_enabled_new_state) { |
| 167 history_sync_enabled_ = history_sync_enabled_new_state; | 167 history_sync_enabled_ = history_sync_enabled_new_state; |
| 168 Restart(); | 168 Restart(); |
| 169 } | 169 } |
| 170 } | 170 } |
| 171 | 171 |
| 172 } // namespace browsing_data | 172 } // namespace browsing_data |
| OLD | NEW |