Chromium Code Reviews| 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..b1231d197c0f2404fb11dcea4f52e5926766a1cb 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,34 @@ 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::Show( |
| + InfoBarService* infobar_service) { |
| + base::WorkerPool::PostTask(FROM_HERE, |
| + base::Bind(&GeolocationInfoBarDelegateAndroid::CheckLocationSettings, |
| + base::Unretained(this), |
|
bulach
2013/09/12 09:18:29
this won't work... :(
the infobar could be deleted
acleung1
2013/09/17 00:08:45
Hmm I understood the concern but I don't really fo
bulach
2013/10/16 10:47:11
see above..
|
| + infobar_service), true); |
| +} |
| + |
| +void GeolocationInfoBarDelegateAndroid::CallParentShow( |
| + InfoBarService* infobar_service) { |
| + GeolocationInfoBarDelegate::Show(infobar_service); |
| +} |
| + |
| +void GeolocationInfoBarDelegateAndroid::CheckLocationSettings( |
| + InfoBarService* infobar_service) { |
| + is_allow_label_ = google_location_settings_helper_->IsAllowLabel(); |
| + content::BrowserThread::PostTask(content::BrowserThread::UI, FROM_HERE, |
| + base::Bind(&GeolocationInfoBarDelegateAndroid::CallParentShow, |
| + base::Unretained(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 +71,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); |
| } |