OLD | NEW |
---|---|
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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/geolocation/geolocation_permission_context_android.h" | 5 #include "chrome/browser/geolocation/geolocation_permission_context_android.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
11 #include "base/feature_list.h" | 11 #include "base/feature_list.h" |
12 #include "base/metrics/histogram_macros.h" | |
12 #include "chrome/browser/android/location_settings.h" | 13 #include "chrome/browser/android/location_settings.h" |
13 #include "chrome/browser/android/location_settings_impl.h" | 14 #include "chrome/browser/android/location_settings_impl.h" |
14 #include "chrome/browser/android/search_geolocation/search_geolocation_disclosur e_tab_helper.h" | 15 #include "chrome/browser/android/search_geolocation/search_geolocation_disclosur e_tab_helper.h" |
15 #include "chrome/browser/android/search_geolocation/search_geolocation_service.h " | 16 #include "chrome/browser/android/search_geolocation/search_geolocation_service.h " |
16 #include "chrome/browser/permissions/permission_request_id.h" | 17 #include "chrome/browser/permissions/permission_request_id.h" |
17 #include "chrome/browser/permissions/permission_update_infobar_delegate_android. h" | 18 #include "chrome/browser/permissions/permission_update_infobar_delegate_android. h" |
18 #include "chrome/browser/profiles/profile.h" | 19 #include "chrome/browser/profiles/profile.h" |
19 #include "chrome/browser/search_engines/template_url_service_factory.h" | 20 #include "chrome/browser/search_engines/template_url_service_factory.h" |
20 #include "chrome/common/chrome_features.h" | 21 #include "chrome/common/chrome_features.h" |
21 #include "chrome/common/pref_names.h" | 22 #include "chrome/common/pref_names.h" |
22 #include "components/infobars/core/infobar.h" | 23 #include "components/infobars/core/infobar.h" |
23 #include "components/prefs/pref_registry_simple.h" | 24 #include "components/prefs/pref_registry_simple.h" |
24 #include "components/prefs/pref_service.h" | 25 #include "components/prefs/pref_service.h" |
25 #include "components/search_engines/template_url.h" | 26 #include "components/search_engines/template_url.h" |
26 #include "components/search_engines/template_url_service.h" | 27 #include "components/search_engines/template_url_service.h" |
27 #include "content/public/browser/browser_thread.h" | 28 #include "content/public/browser/browser_thread.h" |
28 #include "content/public/browser/render_frame_host.h" | 29 #include "content/public/browser/render_frame_host.h" |
29 #include "content/public/browser/web_contents.h" | 30 #include "content/public/browser/web_contents.h" |
30 #include "url/gurl.h" | 31 #include "url/gurl.h" |
31 | 32 |
33 #define LSD_UMA(dse_metric_name, non_dse_metric_name, is_dse, backoff) \ | |
Ilya Sherman
2017/04/04 00:04:40
LSD? Sounds psychedelic! Could you please expand
benwells
2017/04/04 08:06:38
Done.
| |
34 if (is_dse) { \ | |
Ilya Sherman
2017/04/04 00:04:40
nit: What is "dse"?
benwells
2017/04/04 08:06:39
Ah ... Default Search Engine :)
Changed and updat
| |
35 UMA_HISTOGRAM_ENUMERATION(dse_metric_name, backoff, \ | |
36 GeolocationPermissionContextAndroid:: \ | |
37 LocationSettingsDialogBackOff::kMax); \ | |
38 } else { \ | |
39 UMA_HISTOGRAM_ENUMERATION(non_dse_metric_name, backoff, \ | |
40 GeolocationPermissionContextAndroid:: \ | |
41 LocationSettingsDialogBackOff::kMax); \ | |
42 } | |
raymes
2017/04/03 23:30:10
Could this just be a function? I might be missing
Ilya Sherman
2017/04/04 00:04:40
UMA_HISTOGRAM_ENUMERATION requires runtime-constan
benwells
2017/04/04 08:06:39
UmaHistogramEnumeration taking runtime-variables -
| |
43 | |
32 namespace { | 44 namespace { |
33 | 45 |
34 int g_day_offset_for_testing = 0; | 46 int g_day_offset_for_testing = 0; |
35 | |
36 const char* g_dse_origin_for_testing = nullptr; | 47 const char* g_dse_origin_for_testing = nullptr; |
37 | 48 |
38 base::Time GetTimeNow() { | 49 base::Time GetTimeNow() { |
39 return base::Time::Now() + | 50 return base::Time::Now() + |
40 base::TimeDelta::FromDays(g_day_offset_for_testing); | 51 base::TimeDelta::FromDays(g_day_offset_for_testing); |
41 } | 52 } |
42 | 53 |
54 void LogLSDShowEvent( | |
55 bool is_dse, | |
56 GeolocationPermissionContextAndroid::LocationSettingsDialogBackOff | |
57 backoff_level) { | |
58 LSD_UMA(GeolocationPermissionContextAndroid::kGeolocationLSDShowDSEMetric, | |
59 GeolocationPermissionContextAndroid::kGeolocationLSDShowNonDSEMetric, | |
60 is_dse, backoff_level); | |
61 } | |
62 | |
63 void LogLSDSuppressEvent( | |
64 bool is_dse, | |
65 GeolocationPermissionContextAndroid::LocationSettingsDialogBackOff | |
66 backoff_level) { | |
67 LSD_UMA( | |
68 GeolocationPermissionContextAndroid::kGeolocationLSDSuppressDSEMetric, | |
69 GeolocationPermissionContextAndroid::kGeolocationLSDSuppressNonDSEMetric, | |
70 is_dse, backoff_level); | |
71 } | |
72 | |
73 void LogLSDAcceptEvent( | |
74 bool is_dse, | |
75 GeolocationPermissionContextAndroid::LocationSettingsDialogBackOff | |
76 backoff_level) { | |
77 LSD_UMA( | |
78 GeolocationPermissionContextAndroid::kGeolocationLSDAcceptDSEMetric, | |
79 GeolocationPermissionContextAndroid::kGeolocationLSDAcceptNonDSEMetric, | |
80 is_dse, backoff_level); | |
81 } | |
82 | |
83 void LogLSDDenyEvent( | |
84 bool is_dse, | |
85 GeolocationPermissionContextAndroid::LocationSettingsDialogBackOff | |
86 backoff_level) { | |
87 LSD_UMA(GeolocationPermissionContextAndroid::kGeolocationLSDDenyDSEMetric, | |
88 GeolocationPermissionContextAndroid::kGeolocationLSDDenyNonDSEMetric, | |
89 is_dse, backoff_level); | |
90 } | |
91 | |
43 } // namespace | 92 } // namespace |
44 | 93 |
94 const char GeolocationPermissionContextAndroid::kGeolocationLSDShowDSEMetric[] = | |
95 "GeolocationSettingsDialog.ShowEvent.DSE"; | |
raymes
2017/04/03 23:30:10
nit: should this just be called LocationSettingsDi
benwells
2017/04/04 01:46:23
I deliberately made it start with Geo to be near t
| |
96 const char | |
97 GeolocationPermissionContextAndroid::kGeolocationLSDShowNonDSEMetric[] = | |
98 "GeolocationSettingsDialog.ShowEvent.NonDSE"; | |
Ilya Sherman
2017/04/04 00:04:40
It looks like all of these names have a "DSE" or "
benwells
2017/04/04 01:46:23
Sure, together with using runtime variables in Uma
Ilya Sherman
2017/04/04 05:08:04
I don't mind -- I actually prefer simpler, more ha
benwells
2017/04/04 08:06:38
Done.
| |
99 const char | |
100 GeolocationPermissionContextAndroid::kGeolocationLSDSuppressDSEMetric[] = | |
101 "GeolocationSettingsDialog.SuppressEvent.DSE"; | |
102 const char | |
103 GeolocationPermissionContextAndroid::kGeolocationLSDSuppressNonDSEMetric[] = | |
104 "GeolocationSettingsDialog.SuppressEvent.NonDSE"; | |
105 const char | |
106 GeolocationPermissionContextAndroid::kGeolocationLSDAcceptDSEMetric[] = | |
107 "GeolocationSettingsDialog.AcceptEvent.DSE"; | |
108 const char | |
109 GeolocationPermissionContextAndroid::kGeolocationLSDAcceptNonDSEMetric[] = | |
110 "GeolocationSettingsDialog.AcceptEvent.NonDSE"; | |
111 const char GeolocationPermissionContextAndroid::kGeolocationLSDDenyDSEMetric[] = | |
112 "GeolocationSettingsDialog.DenyEvent.DSE"; | |
113 const char | |
114 GeolocationPermissionContextAndroid::kGeolocationLSDDenyNonDSEMetric[] = | |
115 "GeolocationSettingsDialog.DenyEvent.NonDSE"; | |
116 | |
45 // static | 117 // static |
46 void GeolocationPermissionContextAndroid::RegisterProfilePrefs( | 118 void GeolocationPermissionContextAndroid::RegisterProfilePrefs( |
47 PrefRegistrySimple* registry) { | 119 PrefRegistrySimple* registry) { |
48 registry->RegisterIntegerPref(prefs::kLocationSettingsBackoffLevelDSE, 0); | 120 registry->RegisterIntegerPref(prefs::kLocationSettingsBackoffLevelDSE, 0); |
49 registry->RegisterIntegerPref(prefs::kLocationSettingsBackoffLevelDefault, 0); | 121 registry->RegisterIntegerPref(prefs::kLocationSettingsBackoffLevelDefault, 0); |
50 registry->RegisterInt64Pref(prefs::kLocationSettingsNextShowDSE, 0); | 122 registry->RegisterInt64Pref(prefs::kLocationSettingsNextShowDSE, 0); |
51 registry->RegisterInt64Pref(prefs::kLocationSettingsNextShowDefault, 0); | 123 registry->RegisterInt64Pref(prefs::kLocationSettingsNextShowDefault, 0); |
52 } | 124 } |
53 | 125 |
54 GeolocationPermissionContextAndroid:: | 126 GeolocationPermissionContextAndroid:: |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
166 } | 238 } |
167 | 239 |
168 void GeolocationPermissionContextAndroid::UserMadePermissionDecision( | 240 void GeolocationPermissionContextAndroid::UserMadePermissionDecision( |
169 const PermissionRequestID& id, | 241 const PermissionRequestID& id, |
170 const GURL& requesting_origin, | 242 const GURL& requesting_origin, |
171 const GURL& embedding_origin, | 243 const GURL& embedding_origin, |
172 ContentSetting content_setting) { | 244 ContentSetting content_setting) { |
173 // If the user has accepted geolocation, reset the location settings dialog | 245 // If the user has accepted geolocation, reset the location settings dialog |
174 // backoff. | 246 // backoff. |
175 if (content_setting == CONTENT_SETTING_ALLOW) | 247 if (content_setting == CONTENT_SETTING_ALLOW) |
176 ResetLocationSettingsBackOff(requesting_origin); | 248 ResetLocationSettingsBackOff(IsRequestingOriginDSE(requesting_origin)); |
177 } | 249 } |
178 | 250 |
179 void GeolocationPermissionContextAndroid::NotifyPermissionSet( | 251 void GeolocationPermissionContextAndroid::NotifyPermissionSet( |
180 const PermissionRequestID& id, | 252 const PermissionRequestID& id, |
181 const GURL& requesting_origin, | 253 const GURL& requesting_origin, |
182 const GURL& embedding_origin, | 254 const GURL& embedding_origin, |
183 const BrowserPermissionCallback& callback, | 255 const BrowserPermissionCallback& callback, |
184 bool persist, | 256 bool persist, |
185 ContentSetting content_setting) { | 257 ContentSetting content_setting) { |
258 bool is_dse = IsRequestingOriginDSE(requesting_origin); | |
186 if (content_setting == CONTENT_SETTING_ALLOW && | 259 if (content_setting == CONTENT_SETTING_ALLOW && |
187 !location_settings_->IsSystemLocationSettingEnabled()) { | 260 !location_settings_->IsSystemLocationSettingEnabled()) { |
188 // There is no need to check CanShowLocationSettingsDialog here again, as it | 261 // There is no need to check CanShowLocationSettingsDialog here again, as it |
189 // must have been checked to get this far. But, the backoff will not have | 262 // must have been checked to get this far. But, the backoff will not have |
190 // been checked, so check that. Backoff isn't checked earlier because if the | 263 // been checked, so check that. Backoff isn't checked earlier because if the |
191 // content setting is ASK the backoff should be ignored. However if we get | 264 // content setting is ASK the backoff should be ignored. However if we get |
192 // here and the content setting was ASK, the user must have accepted which | 265 // here and the content setting was ASK, the user must have accepted which |
193 // would reset the backoff. | 266 // would reset the backoff. |
194 if (IsInLocationSettingsBackOff(requesting_origin)) { | 267 if (IsInLocationSettingsBackOff(is_dse)) { |
195 FinishNotifyPermissionSet(id, requesting_origin, embedding_origin, | 268 FinishNotifyPermissionSet(id, requesting_origin, embedding_origin, |
196 callback, false /* persist */, | 269 callback, false /* persist */, |
197 CONTENT_SETTING_BLOCK); | 270 CONTENT_SETTING_BLOCK); |
271 LogLSDSuppressEvent(is_dse, LocationSettingsBackOffLevel(is_dse)); | |
198 return; | 272 return; |
199 } | 273 } |
200 | 274 |
275 LogLSDShowEvent(is_dse, LocationSettingsBackOffLevel(is_dse)); | |
201 content::WebContents* web_contents = | 276 content::WebContents* web_contents = |
202 content::WebContents::FromRenderFrameHost( | 277 content::WebContents::FromRenderFrameHost( |
203 content::RenderFrameHost::FromID(id.render_process_id(), | 278 content::RenderFrameHost::FromID(id.render_process_id(), |
204 id.render_frame_id())); | 279 id.render_frame_id())); |
205 location_settings_->PromptToEnableSystemLocationSetting( | 280 location_settings_->PromptToEnableSystemLocationSetting( |
206 IsRequestingOriginDSE(requesting_origin) ? SEARCH : DEFAULT, | 281 is_dse ? SEARCH : DEFAULT, web_contents, |
207 web_contents, | |
208 base::BindOnce( | 282 base::BindOnce( |
209 &GeolocationPermissionContextAndroid::OnLocationSettingsDialogShown, | 283 &GeolocationPermissionContextAndroid::OnLocationSettingsDialogShown, |
210 weak_factory_.GetWeakPtr(), id, requesting_origin, embedding_origin, | 284 weak_factory_.GetWeakPtr(), id, requesting_origin, embedding_origin, |
211 callback, persist, content_setting)); | 285 callback, persist, content_setting)); |
212 return; | 286 return; |
213 } | 287 } |
214 | 288 |
215 FinishNotifyPermissionSet(id, requesting_origin, embedding_origin, callback, | 289 FinishNotifyPermissionSet(id, requesting_origin, embedding_origin, callback, |
216 persist, content_setting); | 290 persist, content_setting); |
217 } | 291 } |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
252 result.content_setting = CONTENT_SETTING_ASK; | 326 result.content_setting = CONTENT_SETTING_ASK; |
253 result.source = PermissionStatusSource::UNSPECIFIED; | 327 result.source = PermissionStatusSource::UNSPECIFIED; |
254 } | 328 } |
255 } | 329 } |
256 | 330 |
257 return result; | 331 return result; |
258 } | 332 } |
259 | 333 |
260 std::string | 334 std::string |
261 GeolocationPermissionContextAndroid::GetLocationSettingsBackOffLevelPref( | 335 GeolocationPermissionContextAndroid::GetLocationSettingsBackOffLevelPref( |
262 const GURL& requesting_origin) const { | 336 bool is_dse) const { |
263 if (IsRequestingOriginDSE(requesting_origin)) | 337 return is_dse ? prefs::kLocationSettingsBackoffLevelDSE |
264 return prefs::kLocationSettingsBackoffLevelDSE; | 338 : prefs::kLocationSettingsBackoffLevelDefault; |
265 | |
266 return prefs::kLocationSettingsBackoffLevelDefault; | |
267 } | 339 } |
268 | 340 |
269 std::string | 341 std::string |
270 GeolocationPermissionContextAndroid::GetLocationSettingsNextShowPref( | 342 GeolocationPermissionContextAndroid::GetLocationSettingsNextShowPref( |
271 const GURL& requesting_origin) const { | 343 bool is_dse) const { |
272 if (IsRequestingOriginDSE(requesting_origin)) | 344 return is_dse ? prefs::kLocationSettingsNextShowDSE |
273 return prefs::kLocationSettingsNextShowDSE; | 345 : prefs::kLocationSettingsNextShowDefault; |
274 | |
275 return prefs::kLocationSettingsNextShowDefault; | |
276 } | 346 } |
277 | 347 |
278 bool GeolocationPermissionContextAndroid::IsInLocationSettingsBackOff( | 348 bool GeolocationPermissionContextAndroid::IsInLocationSettingsBackOff( |
279 const GURL& requesting_origin) const { | 349 bool is_dse) const { |
280 base::Time next_show = | 350 base::Time next_show = base::Time::FromInternalValue( |
281 base::Time::FromInternalValue(profile()->GetPrefs()->GetInt64( | 351 profile()->GetPrefs()->GetInt64(GetLocationSettingsNextShowPref(is_dse))); |
282 GetLocationSettingsNextShowPref(requesting_origin))); | |
283 | 352 |
284 return GetTimeNow() < next_show; | 353 return GetTimeNow() < next_show; |
285 } | 354 } |
286 | 355 |
287 void GeolocationPermissionContextAndroid::ResetLocationSettingsBackOff( | 356 void GeolocationPermissionContextAndroid::ResetLocationSettingsBackOff( |
288 const GURL& requesting_origin) { | 357 bool is_dse) { |
289 PrefService* prefs = profile()->GetPrefs(); | 358 PrefService* prefs = profile()->GetPrefs(); |
290 prefs->ClearPref(GetLocationSettingsNextShowPref(requesting_origin)); | 359 prefs->ClearPref(GetLocationSettingsNextShowPref(is_dse)); |
291 prefs->ClearPref(GetLocationSettingsBackOffLevelPref(requesting_origin)); | 360 prefs->ClearPref(GetLocationSettingsBackOffLevelPref(is_dse)); |
292 } | 361 } |
293 | 362 |
294 void GeolocationPermissionContextAndroid::UpdateLocationSettingsBackOff( | 363 void GeolocationPermissionContextAndroid::UpdateLocationSettingsBackOff( |
295 const GURL& requesting_origin) { | 364 bool is_dse) { |
296 // Backoff levels: | 365 LocationSettingsDialogBackOff backoff_level = |
297 // 0: 1 week | 366 LocationSettingsBackOffLevel(is_dse); |
298 // 1: 1 month | |
299 // 2: 3 months | |
300 PrefService* prefs = profile()->GetPrefs(); | |
301 int backoff_level = | |
302 prefs->GetInteger(GetLocationSettingsBackOffLevelPref(requesting_origin)); | |
303 | 367 |
304 base::Time next_show = GetTimeNow(); | 368 base::Time next_show = GetTimeNow(); |
305 switch (backoff_level) { | 369 switch (backoff_level) { |
306 case 0: | 370 case LocationSettingsDialogBackOff::kOneWeek: |
raymes
2017/04/03 23:30:10
I wonder if 0 should represent "kNoBackOff". In ot
benwells
2017/04/04 08:06:39
Done.
| |
307 next_show += base::TimeDelta::FromDays(7); | 371 next_show += base::TimeDelta::FromDays(7); |
372 backoff_level = LocationSettingsDialogBackOff::kOneMonth; | |
308 break; | 373 break; |
309 case 1: | 374 case LocationSettingsDialogBackOff::kOneMonth: |
310 next_show += base::TimeDelta::FromDays(30); | 375 next_show += base::TimeDelta::FromDays(30); |
376 backoff_level = LocationSettingsDialogBackOff::kThreeMonths; | |
377 break; | |
378 case LocationSettingsDialogBackOff::kThreeMonths: | |
379 next_show += base::TimeDelta::FromDays(90); | |
311 break; | 380 break; |
312 default: | 381 default: |
313 next_show += base::TimeDelta::FromDays(90); | 382 NOTREACHED(); |
314 } | 383 } |
315 | 384 |
316 if (backoff_level < 2) | 385 PrefService* prefs = profile()->GetPrefs(); |
317 backoff_level++; | 386 prefs->SetInteger(GetLocationSettingsBackOffLevelPref(is_dse), |
387 static_cast<int>(backoff_level)); | |
388 prefs->SetInt64(GetLocationSettingsNextShowPref(is_dse), | |
389 next_show.ToInternalValue()); | |
390 } | |
318 | 391 |
319 prefs->SetInteger(GetLocationSettingsBackOffLevelPref(requesting_origin), | 392 GeolocationPermissionContextAndroid::LocationSettingsDialogBackOff |
320 backoff_level); | 393 GeolocationPermissionContextAndroid::LocationSettingsBackOffLevel( |
321 prefs->SetInt64(GetLocationSettingsNextShowPref(requesting_origin), | 394 bool is_dse) const { |
322 next_show.ToInternalValue()); | 395 PrefService* prefs = profile()->GetPrefs(); |
396 int int_backoff = | |
397 prefs->GetInteger(GetLocationSettingsBackOffLevelPref(is_dse)); | |
398 return static_cast<LocationSettingsDialogBackOff>(int_backoff); | |
323 } | 399 } |
324 | 400 |
325 bool GeolocationPermissionContextAndroid::IsLocationAccessPossible( | 401 bool GeolocationPermissionContextAndroid::IsLocationAccessPossible( |
326 content::WebContents* web_contents, | 402 content::WebContents* web_contents, |
327 const GURL& requesting_origin, | 403 const GURL& requesting_origin, |
328 bool user_gesture) { | 404 bool user_gesture) { |
329 return (location_settings_->HasAndroidLocationPermission() || | 405 return (location_settings_->HasAndroidLocationPermission() || |
330 location_settings_->CanPromptForAndroidLocationPermission( | 406 location_settings_->CanPromptForAndroidLocationPermission( |
331 web_contents)) && | 407 web_contents)) && |
332 (location_settings_->IsSystemLocationSettingEnabled() || | 408 (location_settings_->IsSystemLocationSettingEnabled() || |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
372 false /* persist */, new_setting); | 448 false /* persist */, new_setting); |
373 } | 449 } |
374 | 450 |
375 bool GeolocationPermissionContextAndroid::CanShowLocationSettingsDialog( | 451 bool GeolocationPermissionContextAndroid::CanShowLocationSettingsDialog( |
376 const GURL& requesting_origin, | 452 const GURL& requesting_origin, |
377 bool user_gesture, | 453 bool user_gesture, |
378 bool ignore_backoff) const { | 454 bool ignore_backoff) const { |
379 if (!base::FeatureList::IsEnabled(features::kLsdPermissionPrompt)) | 455 if (!base::FeatureList::IsEnabled(features::kLsdPermissionPrompt)) |
380 return false; | 456 return false; |
381 | 457 |
458 bool is_dse = IsRequestingOriginDSE(requesting_origin); | |
382 // If this isn't the default search engine, a gesture is needed. | 459 // If this isn't the default search engine, a gesture is needed. |
383 if (!IsRequestingOriginDSE(requesting_origin) && !user_gesture) { | 460 if (!is_dse && !user_gesture) { |
384 return false; | 461 return false; |
385 } | 462 } |
386 | 463 |
387 if (!ignore_backoff && IsInLocationSettingsBackOff(requesting_origin)) | 464 if (!ignore_backoff && IsInLocationSettingsBackOff(is_dse)) |
388 return false; | 465 return false; |
389 | 466 |
390 return location_settings_->CanPromptToEnableSystemLocationSetting(); | 467 return location_settings_->CanPromptToEnableSystemLocationSetting(); |
391 } | 468 } |
392 | 469 |
393 void GeolocationPermissionContextAndroid::OnLocationSettingsDialogShown( | 470 void GeolocationPermissionContextAndroid::OnLocationSettingsDialogShown( |
394 const PermissionRequestID& id, | 471 const PermissionRequestID& id, |
395 const GURL& requesting_origin, | 472 const GURL& requesting_origin, |
396 const GURL& embedding_origin, | 473 const GURL& embedding_origin, |
397 const BrowserPermissionCallback& callback, | 474 const BrowserPermissionCallback& callback, |
398 bool persist, | 475 bool persist, |
399 ContentSetting content_setting, | 476 ContentSetting content_setting, |
400 LocationSettingsDialogOutcome prompt_outcome) { | 477 LocationSettingsDialogOutcome prompt_outcome) { |
478 bool is_dse = IsRequestingOriginDSE(requesting_origin); | |
401 if (prompt_outcome == GRANTED) { | 479 if (prompt_outcome == GRANTED) { |
402 ResetLocationSettingsBackOff(requesting_origin); | 480 LogLSDAcceptEvent(is_dse, LocationSettingsBackOffLevel(is_dse)); |
481 ResetLocationSettingsBackOff(is_dse); | |
403 } else { | 482 } else { |
404 UpdateLocationSettingsBackOff(requesting_origin); | 483 LogLSDDenyEvent(is_dse, LocationSettingsBackOffLevel(is_dse)); |
484 UpdateLocationSettingsBackOff(is_dse); | |
405 content_setting = CONTENT_SETTING_BLOCK; | 485 content_setting = CONTENT_SETTING_BLOCK; |
406 persist = false; | 486 persist = false; |
407 } | 487 } |
408 | 488 |
409 FinishNotifyPermissionSet(id, requesting_origin, embedding_origin, callback, | 489 FinishNotifyPermissionSet(id, requesting_origin, embedding_origin, callback, |
410 persist, content_setting); | 490 persist, content_setting); |
411 } | 491 } |
412 | 492 |
413 void GeolocationPermissionContextAndroid::FinishNotifyPermissionSet( | 493 void GeolocationPermissionContextAndroid::FinishNotifyPermissionSet( |
414 const PermissionRequestID& id, | 494 const PermissionRequestID& id, |
(...skipping 22 matching lines...) Expand all Loading... | |
437 // The tab helper can be null in tests. | 517 // The tab helper can be null in tests. |
438 if (disclosure_helper) | 518 if (disclosure_helper) |
439 disclosure_helper->MaybeShowDisclosure(requesting_origin); | 519 disclosure_helper->MaybeShowDisclosure(requesting_origin); |
440 } | 520 } |
441 } | 521 } |
442 | 522 |
443 void GeolocationPermissionContextAndroid::SetLocationSettingsForTesting( | 523 void GeolocationPermissionContextAndroid::SetLocationSettingsForTesting( |
444 std::unique_ptr<LocationSettings> settings) { | 524 std::unique_ptr<LocationSettings> settings) { |
445 location_settings_ = std::move(settings); | 525 location_settings_ = std::move(settings); |
446 } | 526 } |
OLD | NEW |