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

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

Issue 2711063002: Early exit from the search geolocation disclosure if it is disabled. (Closed)
Patch Set: Created 3 years, 10 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 | no next file » | 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 #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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 content::WebContents* contents) 71 content::WebContents* contents)
72 : content::WebContentsObserver(contents) { 72 : content::WebContentsObserver(contents) {
73 consistent_geolocation_enabled_ = 73 consistent_geolocation_enabled_ =
74 base::FeatureList::IsEnabled(features::kConsistentOmniboxGeolocation); 74 base::FeatureList::IsEnabled(features::kConsistentOmniboxGeolocation);
75 } 75 }
76 76
77 SearchGeolocationDisclosureTabHelper::~SearchGeolocationDisclosureTabHelper() {} 77 SearchGeolocationDisclosureTabHelper::~SearchGeolocationDisclosureTabHelper() {}
78 78
79 void SearchGeolocationDisclosureTabHelper::NavigationEntryCommitted( 79 void SearchGeolocationDisclosureTabHelper::NavigationEntryCommitted(
80 const content::LoadCommittedDetails& load_details) { 80 const content::LoadCommittedDetails& load_details) {
81 if (consistent_geolocation_enabled_) 81 MaybeShowDisclosure(web_contents()->GetVisibleURL());
82 MaybeShowDisclosure(web_contents()->GetVisibleURL());
83 } 82 }
84 83
85 void SearchGeolocationDisclosureTabHelper::MaybeShowDisclosure( 84 void SearchGeolocationDisclosureTabHelper::MaybeShowDisclosure(
86 const GURL& gurl) { 85 const GURL& gurl) {
86 if (!consistent_geolocation_enabled_)
87 return;
88
87 if (!ShouldShowDisclosureForUrl(gurl)) 89 if (!ShouldShowDisclosureForUrl(gurl))
88 return; 90 return;
89 91
90 // Don't show the infobar if the user has dismissed it, or they've seen it 92 // Don't show the infobar if the user has dismissed it, or they've seen it
91 // enough times already. 93 // enough times already.
92 PrefService* prefs = GetProfile()->GetPrefs(); 94 PrefService* prefs = GetProfile()->GetPrefs();
93 bool dismissed_already = 95 bool dismissed_already =
94 prefs->GetBoolean(prefs::kSearchGeolocationDisclosureDismissed); 96 prefs->GetBoolean(prefs::kSearchGeolocationDisclosureDismissed);
95 int shown_count = 97 int shown_count =
96 prefs->GetInteger(prefs::kSearchGeolocationDisclosureShownCount); 98 prefs->GetInteger(prefs::kSearchGeolocationDisclosureShownCount);
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 const base::android::JavaParamRef<jclass>& clazz) { 237 const base::android::JavaParamRef<jclass>& clazz) {
236 gIgnoreUrlChecksForTesting = true; 238 gIgnoreUrlChecksForTesting = true;
237 } 239 }
238 240
239 // static 241 // static
240 void SetDayOffsetForTesting(JNIEnv* env, 242 void SetDayOffsetForTesting(JNIEnv* env,
241 const base::android::JavaParamRef<jclass>& clazz, 243 const base::android::JavaParamRef<jclass>& clazz,
242 jint days) { 244 jint days) {
243 gDayOffsetForTesting = days; 245 gDayOffsetForTesting = days;
244 } 246 }
OLDNEW
« 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