| 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 "chrome/browser/android/search_geolocation/search_geolocation_disclosur
e_tab_helper.h" | 5 #include "chrome/browser/android/search_geolocation/search_geolocation_disclosur
e_tab_helper.h" |
| 6 | 6 |
| 7 #include "base/android/jni_android.h" | 7 #include "base/android/jni_android.h" |
| 8 #include "base/android/jni_string.h" | 8 #include "base/android/jni_string.h" |
| 9 #include "base/feature_list.h" | 9 #include "base/feature_list.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 | 77 |
| 78 void SearchGeolocationDisclosureTabHelper::NavigationEntryCommitted( | 78 void SearchGeolocationDisclosureTabHelper::NavigationEntryCommitted( |
| 79 const content::LoadCommittedDetails& load_details) { | 79 const content::LoadCommittedDetails& load_details) { |
| 80 if (consistent_geolocation_enabled_) { | 80 if (consistent_geolocation_enabled_) { |
| 81 MaybeShowDefaultSearchGeolocationDisclosure( | 81 MaybeShowDefaultSearchGeolocationDisclosure( |
| 82 web_contents()->GetVisibleURL()); | 82 web_contents()->GetVisibleURL()); |
| 83 } | 83 } |
| 84 } | 84 } |
| 85 | 85 |
| 86 // static | 86 // static |
| 87 void SearchGeolocationDisclosureTabHelper::ResetDisclosure(Profile* profile) { |
| 88 PrefService* prefs = profile->GetPrefs(); |
| 89 prefs->ClearPref(prefs::kSearchGeolocationDisclosureShownCount); |
| 90 prefs->ClearPref(prefs::kSearchGeolocationDisclosureLastShowDate); |
| 91 prefs->ClearPref(prefs::kSearchGeolocationDisclosureDismissed); |
| 92 } |
| 93 |
| 94 // static |
| 87 void SearchGeolocationDisclosureTabHelper::RegisterProfilePrefs( | 95 void SearchGeolocationDisclosureTabHelper::RegisterProfilePrefs( |
| 88 user_prefs::PrefRegistrySyncable* registry) { | 96 user_prefs::PrefRegistrySyncable* registry) { |
| 89 registry->RegisterBooleanPref(prefs::kSearchGeolocationDisclosureDismissed, | 97 registry->RegisterBooleanPref(prefs::kSearchGeolocationDisclosureDismissed, |
| 90 false); | 98 false); |
| 91 registry->RegisterIntegerPref(prefs::kSearchGeolocationDisclosureShownCount, | 99 registry->RegisterIntegerPref(prefs::kSearchGeolocationDisclosureShownCount, |
| 92 0); | 100 0); |
| 93 registry->RegisterInt64Pref(prefs::kSearchGeolocationDisclosureLastShowDate, | 101 registry->RegisterInt64Pref(prefs::kSearchGeolocationDisclosureLastShowDate, |
| 94 0); | 102 0); |
| 95 registry->RegisterBooleanPref( | 103 registry->RegisterBooleanPref( |
| 96 prefs::kSearchGeolocationPreDisclosureMetricsRecorded, false); | 104 prefs::kSearchGeolocationPreDisclosureMetricsRecorded, false); |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 236 const base::android::JavaParamRef<jclass>& clazz) { | 244 const base::android::JavaParamRef<jclass>& clazz) { |
| 237 gIgnoreUrlChecksForTesting = true; | 245 gIgnoreUrlChecksForTesting = true; |
| 238 } | 246 } |
| 239 | 247 |
| 240 // static | 248 // static |
| 241 void SetDayOffsetForTesting(JNIEnv* env, | 249 void SetDayOffsetForTesting(JNIEnv* env, |
| 242 const base::android::JavaParamRef<jclass>& clazz, | 250 const base::android::JavaParamRef<jclass>& clazz, |
| 243 jint days) { | 251 jint days) { |
| 244 gDayOffsetForTesting = days; | 252 gDayOffsetForTesting = days; |
| 245 } | 253 } |
| OLD | NEW |