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

Side by Side Diff: chrome/browser/android/search_geolocation/search_geolocation_disclosure_tab_helper.h

Issue 2885763002: Only show search geolocation disclosure on omnibox searches or API use. (Closed)
Patch Set: Add comments Created 3 years, 7 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 unified diff | Download patch
« no previous file with comments | « no previous file | chrome/browser/android/search_geolocation/search_geolocation_disclosure_tab_helper.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #ifndef CHROME_BROWSER_ANDROID_SEARCH_GEOLOCATION_SEARCH_GEOLOCATION_DISCLOSURE_ TAB_HELPER_H_ 5 #ifndef CHROME_BROWSER_ANDROID_SEARCH_GEOLOCATION_SEARCH_GEOLOCATION_DISCLOSURE_ TAB_HELPER_H_
6 #define CHROME_BROWSER_ANDROID_SEARCH_GEOLOCATION_SEARCH_GEOLOCATION_DISCLOSURE_ TAB_HELPER_H_ 6 #define CHROME_BROWSER_ANDROID_SEARCH_GEOLOCATION_SEARCH_GEOLOCATION_DISCLOSURE_ TAB_HELPER_H_
7 7
8 #include <jni.h> 8 #include <jni.h>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 12 matching lines...) Expand all
23 : public content::WebContentsObserver, 23 : public content::WebContentsObserver,
24 public content::WebContentsUserData< 24 public content::WebContentsUserData<
25 SearchGeolocationDisclosureTabHelper> { 25 SearchGeolocationDisclosureTabHelper> {
26 public: 26 public:
27 ~SearchGeolocationDisclosureTabHelper() override; 27 ~SearchGeolocationDisclosureTabHelper() override;
28 28
29 // content::WebContentsObserver overrides. 29 // content::WebContentsObserver overrides.
30 void NavigationEntryCommitted( 30 void NavigationEntryCommitted(
31 const content::LoadCommittedDetails& load_details) override; 31 const content::LoadCommittedDetails& load_details) override;
32 32
33 void MaybeShowDisclosure(const GURL& gurl); 33 void MaybeShowDisclosureForAPIAccess(const GURL& gurl);
34 34
35 static void ResetDisclosure(Profile* profile); 35 static void ResetDisclosure(Profile* profile);
36 36
37 static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry); 37 static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry);
38 38
39 // Registers native methods. 39 // Registers native methods.
40 static bool Register(JNIEnv* env); 40 static bool Register(JNIEnv* env);
41 41
42 private: 42 private:
43 explicit SearchGeolocationDisclosureTabHelper(content::WebContents* contents); 43 explicit SearchGeolocationDisclosureTabHelper(content::WebContents* contents);
44 friend class content::WebContentsUserData< 44 friend class content::WebContentsUserData<
45 SearchGeolocationDisclosureTabHelper>; 45 SearchGeolocationDisclosureTabHelper>;
46 46
47 bool ShouldShowDisclosureForUrl(const GURL& gurl); 47 void MaybeShowDisclosureForNavigation(const GURL& gurl);
48 void MaybeShowDisclosureForValidUrl(const GURL& gurl);
49
50 // Determines if the disclosure should be shown for the URL when a navigation
51 // to the URL occurs. This is the case whenever the URL is a result of an
52 // omnibox search, as it will result in X-Geo headers being sent.
53 bool ShouldShowDisclosureForNavigation(const GURL& gurl);
54
55 // Determine if the disclosure should be shown for the URL when a page on the
56 // URL uses the geolocation API. This is the case if the url's access to the
57 // geolocation API is allowed due to the geolocation DSE setting.
58 bool ShouldShowDisclosureForAPIAccess(const GURL& gurl);
48 59
49 // Record metrics, once per client, of the permission state before and after 60 // Record metrics, once per client, of the permission state before and after
50 // the disclosure has been shown. 61 // the disclosure has been shown.
51 void RecordPreDisclosureMetrics(const GURL& gurl); 62 void RecordPreDisclosureMetrics(const GURL& gurl);
52 void RecordPostDisclosureMetrics(const GURL& gurl); 63 void RecordPostDisclosureMetrics(const GURL& gurl);
53 Profile* GetProfile(); 64 Profile* GetProfile();
54 65
55 bool consistent_geolocation_disclosure_enabled_; 66 bool consistent_geolocation_disclosure_enabled_;
56 67
57 DISALLOW_COPY_AND_ASSIGN(SearchGeolocationDisclosureTabHelper); 68 DISALLOW_COPY_AND_ASSIGN(SearchGeolocationDisclosureTabHelper);
58 }; 69 };
59 70
60 #endif // CHROME_BROWSER_ANDROID_SEARCH_GEOLOCATION_SEARCH_GEOLOCATION_DISCLOSU RE_TAB_HELPER_H_ 71 #endif // CHROME_BROWSER_ANDROID_SEARCH_GEOLOCATION_SEARCH_GEOLOCATION_DISCLOSU RE_TAB_HELPER_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/android/search_geolocation/search_geolocation_disclosure_tab_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698