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 "chrome/browser/browsing_data/history_counter.h" | 5 #include "chrome/browser/browsing_data/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 "chrome/browser/history/history_service_factory.h" | 12 #include "chrome/browser/history/history_service_factory.h" |
13 #include "chrome/browser/history/web_history_service_factory.h" | 13 #include "chrome/browser/history/web_history_service_factory.h" |
14 #include "chrome/browser/profiles/profile.h" | 14 #include "chrome/browser/profiles/profile.h" |
15 #include "chrome/browser/sync/profile_sync_service_factory.h" | 15 #include "chrome/browser/sync/profile_sync_service_factory.h" |
16 #include "chrome/common/pref_names.h" | |
17 #include "components/browser_sync/browser/profile_sync_service.h" | 16 #include "components/browser_sync/browser/profile_sync_service.h" |
| 17 #include "components/browsing_data/pref_names.h" |
18 #include "components/history/core/browser/history_service.h" | 18 #include "components/history/core/browser/history_service.h" |
19 #include "components/history/core/browser/web_history_service.h" | 19 #include "components/history/core/browser/web_history_service.h" |
20 #include "content/public/browser/browser_thread.h" | 20 #include "content/public/browser/browser_thread.h" |
21 | 21 |
22 namespace { | 22 namespace { |
23 static const int64_t kWebHistoryTimeoutSeconds = 10; | 23 static const int64_t kWebHistoryTimeoutSeconds = 10; |
24 } | 24 } |
25 | 25 |
26 HistoryCounter::HistoryCounter(Profile* profile) | 26 HistoryCounter::HistoryCounter(Profile* profile) |
27 : BrowsingDataCounter(prefs::kDeleteBrowsingHistory), | 27 : BrowsingDataCounter(browsing_data::prefs::kDeleteBrowsingHistory), |
28 profile_(profile), | 28 profile_(profile), |
29 has_synced_visits_(false), | 29 has_synced_visits_(false), |
30 local_counting_finished_(false), | 30 local_counting_finished_(false), |
31 web_counting_finished_(false), | 31 web_counting_finished_(false), |
32 testing_web_history_service_(nullptr), | 32 testing_web_history_service_(nullptr), |
33 sync_service_(nullptr), | 33 sync_service_(nullptr), |
34 history_sync_enabled_(false), | 34 history_sync_enabled_(false), |
35 weak_ptr_factory_(this) {} | 35 weak_ptr_factory_(this) {} |
36 | 36 |
37 HistoryCounter::~HistoryCounter() { | 37 HistoryCounter::~HistoryCounter() { |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
183 bool history_sync_enabled_new_state = | 183 bool history_sync_enabled_new_state = |
184 !!WebHistoryServiceFactory::GetForProfile(profile_); | 184 !!WebHistoryServiceFactory::GetForProfile(profile_); |
185 | 185 |
186 // If the history sync was just enabled or disabled, restart the counter | 186 // If the history sync was just enabled or disabled, restart the counter |
187 // so that we update the result accordingly. | 187 // so that we update the result accordingly. |
188 if (history_sync_enabled_ != history_sync_enabled_new_state) { | 188 if (history_sync_enabled_ != history_sync_enabled_new_state) { |
189 history_sync_enabled_ = history_sync_enabled_new_state; | 189 history_sync_enabled_ = history_sync_enabled_new_state; |
190 Restart(); | 190 Restart(); |
191 } | 191 } |
192 } | 192 } |
OLD | NEW |