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" |
(...skipping 28 matching lines...) Expand all Loading... |
39 if (sync_service_) | 39 if (sync_service_) |
40 sync_service_->AddObserver(this); | 40 sync_service_->AddObserver(this); |
41 history_sync_enabled_ = !!web_history_service_callback_.Run(); | 41 history_sync_enabled_ = !!web_history_service_callback_.Run(); |
42 } | 42 } |
43 | 43 |
44 bool HistoryCounter::HasTrackedTasks() { | 44 bool HistoryCounter::HasTrackedTasks() { |
45 return cancelable_task_tracker_.HasTrackedTasks(); | 45 return cancelable_task_tracker_.HasTrackedTasks(); |
46 } | 46 } |
47 | 47 |
48 const char* HistoryCounter::GetPrefName() const { | 48 const char* HistoryCounter::GetPrefName() const { |
49 return browsing_data::prefs::kDeleteBrowsingHistory; | 49 return GetPrefType() == ClearBrowsingDataPreferenceType::BASIC |
| 50 ? browsing_data::prefs::kDeleteBrowsingHistoryBasic |
| 51 : browsing_data::prefs::kDeleteBrowsingHistory; |
50 } | 52 } |
51 | 53 |
52 void HistoryCounter::Count() { | 54 void HistoryCounter::Count() { |
53 // Reset the state. | 55 // Reset the state. |
54 cancelable_task_tracker_.TryCancelAll(); | 56 cancelable_task_tracker_.TryCancelAll(); |
55 web_history_request_.reset(); | 57 web_history_request_.reset(); |
56 has_synced_visits_ = false; | 58 has_synced_visits_ = false; |
57 | 59 |
58 // Count the locally stored items. | 60 // Count the locally stored items. |
59 local_counting_finished_ = false; | 61 local_counting_finished_ = false; |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 | 165 |
164 // If the history sync was just enabled or disabled, restart the counter | 166 // If the history sync was just enabled or disabled, restart the counter |
165 // so that we update the result accordingly. | 167 // so that we update the result accordingly. |
166 if (history_sync_enabled_ != history_sync_enabled_new_state) { | 168 if (history_sync_enabled_ != history_sync_enabled_new_state) { |
167 history_sync_enabled_ = history_sync_enabled_new_state; | 169 history_sync_enabled_ = history_sync_enabled_new_state; |
168 Restart(); | 170 Restart(); |
169 } | 171 } |
170 } | 172 } |
171 | 173 |
172 } // namespace browsing_data | 174 } // namespace browsing_data |
OLD | NEW |