Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4894)

Unified Diff: chrome/browser/android/search_geolocation/search_geolocation_disclosure_tab_helper.cc

Issue 2661303003: Improve performance of search geolocation disclosure check. (Closed)
Patch Set: Move later Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/android/search_geolocation/search_geolocation_disclosure_tab_helper.cc
diff --git a/chrome/browser/android/search_geolocation/search_geolocation_disclosure_tab_helper.cc b/chrome/browser/android/search_geolocation/search_geolocation_disclosure_tab_helper.cc
index 43745792a37222d37066afc052d1dab92539d5ae..fc195722793e3094b5a372f19f24b2c0620be125 100644
--- a/chrome/browser/android/search_geolocation/search_geolocation_disclosure_tab_helper.cc
+++ b/chrome/browser/android/search_geolocation/search_geolocation_disclosure_tab_helper.cc
@@ -87,11 +87,6 @@ void SearchGeolocationDisclosureTabHelper::MaybeShowDisclosure(
if (!ShouldShowDisclosureForUrl(gurl))
return;
- // Check that the Chrome app has geolocation permission.
- JNIEnv* env = base::android::AttachCurrentThread();
- if (!Java_GeolocationHeader_hasGeolocationPermission(env))
- return;
-
// Don't show the infobar if the user has dismissed it, or they've seen it
// enough times already.
PrefService* prefs = GetProfile()->GetPrefs();
@@ -135,6 +130,11 @@ void SearchGeolocationDisclosureTabHelper::MaybeShowDisclosure(
if (!service->GetDSEGeolocationSetting())
return;
+ // Check that the Chrome app has geolocation permission.
+ JNIEnv* env = base::android::AttachCurrentThread();
+ if (!Java_GeolocationHeader_hasGeolocationPermission(env))
+ return;
+
// All good, let's show the disclosure and increment the shown count.
SearchGeolocationDisclosureInfoBarDelegate::Create(web_contents(), gurl);
shown_count++;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698