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); |
} |