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

Unified Diff: chrome/browser/geolocation/geolocation_infobar_delegate_android.cc

Issue 23345004: Fix Android strict-mode violation in GeoLocation info bar. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix ups Created 7 years, 4 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
Index: chrome/browser/geolocation/geolocation_infobar_delegate_android.cc
diff --git a/chrome/browser/geolocation/geolocation_infobar_delegate_android.cc b/chrome/browser/geolocation/geolocation_infobar_delegate_android.cc
index 52c2b5b1bece04026933d41a66f0a2ce0598535e..3eb0e1d2770632e82a3091ef0f5e8db886efbbf4 100644
--- a/chrome/browser/geolocation/geolocation_infobar_delegate_android.cc
+++ b/chrome/browser/geolocation/geolocation_infobar_delegate_android.cc
@@ -4,8 +4,14 @@
#include "chrome/browser/geolocation/geolocation_infobar_delegate_android.h"
+#include "base/bind.h"
+#include "base/bind_helpers.h"
+#include "base/callback.h"
+#include "base/location.h"
#include "base/strings/utf_string_conversions.h"
+#include "base/threading/worker_pool.h"
#include "chrome/browser/android/google_location_settings_helper.h"
+#include "content/public/browser/browser_thread.h"
#include "grit/generated_resources.h"
#include "grit/locale_settings.h"
#include "grit/theme_resources.h"
@@ -22,12 +28,29 @@ GeolocationInfoBarDelegateAndroid::GeolocationInfoBarDelegateAndroid(
requesting_frame_url, contents_unique_id,
display_languages),
google_location_settings_helper_(
- GoogleLocationSettingsHelper::Create()) {
+ GoogleLocationSettingsHelper::Create()),
+ is_allow_label(false) {
}
GeolocationInfoBarDelegateAndroid::~GeolocationInfoBarDelegateAndroid() {
}
+void GeolocationInfoBarDelegateAndroid::Initialize(
+ InfoBarService* infobar_service) {
+ base::WorkerPool::PostTask(FROM_HERE,
+ base::Bind(&GeolocationInfoBarDelegateAndroid::CheckLocationSettings,
+ make_scoped_refptr(this),
+ infobar_service), true);
+}
+
+void GeolocationInfoBarDelegateAndroid::CheckLocationSettings(
+ InfoBarService* infobar_service) {
+ is_allow_label = google_location_settings_helper_->IsAllowLabel();
+ content::BrowserThread::PostTask(content::BrowserThread::UI, FROM_HERE,
+ base::Bind(&GeolocationInfoBarDelegate::Show,
+ make_scoped_refptr(this), infobar_service));
+}
+
bool GeolocationInfoBarDelegateAndroid::Accept() {
// Accept button text could be either 'Allow' or 'Google Location Settings'.
// If 'Allow' we follow the regular flow.
@@ -43,7 +66,7 @@ bool GeolocationInfoBarDelegateAndroid::Accept() {
string16 GeolocationInfoBarDelegateAndroid::GetButtonLabel(
InfoBarButton button) const {
- return (button == BUTTON_OK) ?
- UTF8ToUTF16(google_location_settings_helper_->GetAcceptButtonLabel()) :
+ return (button == BUTTON_OK) ? UTF8ToUTF16(
+ google_location_settings_helper_->GetAcceptButtonLabel(is_allow_label)) :
l10n_util::GetStringUTF16(IDS_GEOLOCATION_DENY_BUTTON);
}

Powered by Google App Engine
This is Rietveld 408576698