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

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

Issue 2909583002: Use the name of the default search engine in the search geo disclosure. (Closed)
Patch Set: Feedback 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 | « chrome/browser/android/search_geolocation/search_geolocation_disclosure_infobar_delegate.cc ('k') | 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/command_line.h" 9 #include "base/command_line.h"
10 #include "base/feature_list.h" 10 #include "base/feature_list.h"
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 SearchGeolocationService::Factory::GetForBrowserContext(GetProfile()); 197 SearchGeolocationService::Factory::GetForBrowserContext(GetProfile());
198 if (!service->GetDSEGeolocationSetting()) 198 if (!service->GetDSEGeolocationSetting())
199 return; 199 return;
200 200
201 // Check that the Chrome app has geolocation permission. 201 // Check that the Chrome app has geolocation permission.
202 JNIEnv* env = base::android::AttachCurrentThread(); 202 JNIEnv* env = base::android::AttachCurrentThread();
203 if (!Java_GeolocationHeader_hasGeolocationPermission(env)) 203 if (!Java_GeolocationHeader_hasGeolocationPermission(env))
204 return; 204 return;
205 205
206 // All good, let's show the disclosure and increment the shown count. 206 // All good, let's show the disclosure and increment the shown count.
207 SearchGeolocationDisclosureInfoBarDelegate::Create(web_contents(), gurl); 207 TemplateURLService* template_url_service =
208 TemplateURLServiceFactory::GetForProfile(GetProfile());
209 const TemplateURL* template_url =
210 template_url_service->GetDefaultSearchProvider();
211 base::string16 search_engine_name = template_url->short_name();
212 SearchGeolocationDisclosureInfoBarDelegate::Create(web_contents(), gurl,
213 search_engine_name);
208 shown_count++; 214 shown_count++;
209 prefs->SetInteger(prefs::kSearchGeolocationDisclosureShownCount, shown_count); 215 prefs->SetInteger(prefs::kSearchGeolocationDisclosureShownCount, shown_count);
210 prefs->SetInt64(prefs::kSearchGeolocationDisclosureLastShowDate, 216 prefs->SetInt64(prefs::kSearchGeolocationDisclosureLastShowDate,
211 GetTimeNow().ToInternalValue()); 217 GetTimeNow().ToInternalValue());
212 } 218 }
213 219
214 bool SearchGeolocationDisclosureTabHelper::ShouldShowDisclosureForAPIAccess( 220 bool SearchGeolocationDisclosureTabHelper::ShouldShowDisclosureForAPIAccess(
215 const GURL& gurl) { 221 const GURL& gurl) {
216 SearchGeolocationService* service = 222 SearchGeolocationService* service =
217 SearchGeolocationService::Factory::GetForBrowserContext(GetProfile()); 223 SearchGeolocationService::Factory::GetForBrowserContext(GetProfile());
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
309 const base::android::JavaParamRef<jclass>& clazz) { 315 const base::android::JavaParamRef<jclass>& clazz) {
310 gIgnoreUrlChecksForTesting = true; 316 gIgnoreUrlChecksForTesting = true;
311 } 317 }
312 318
313 // static 319 // static
314 void SetDayOffsetForTesting(JNIEnv* env, 320 void SetDayOffsetForTesting(JNIEnv* env,
315 const base::android::JavaParamRef<jclass>& clazz, 321 const base::android::JavaParamRef<jclass>& clazz,
316 jint days) { 322 jint days) {
317 gDayOffsetForTesting = days; 323 gDayOffsetForTesting = days;
318 } 324 }
OLDNEW
« no previous file with comments | « chrome/browser/android/search_geolocation/search_geolocation_disclosure_infobar_delegate.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698