Index: chrome/browser/geolocation/geolocation_confirm_infobar_delegate_android.cc |
diff --git a/chrome/browser/geolocation/geolocation_confirm_infobar_delegate_android.cc b/chrome/browser/geolocation/geolocation_confirm_infobar_delegate_android.cc |
index e440320278e69aa38ebb5ed913c60684e14c4e8a..ff7e6e7bd62f6c6985e49bb8f68944ef20338b29 100644 |
--- a/chrome/browser/geolocation/geolocation_confirm_infobar_delegate_android.cc |
+++ b/chrome/browser/geolocation/geolocation_confirm_infobar_delegate_android.cc |
@@ -5,6 +5,7 @@ |
#include "chrome/browser/geolocation/geolocation_confirm_infobar_delegate_android.h" |
#include "base/utf_string_conversions.h" |
+#include "chrome/browser/android/google_location_settings_helper.h" |
#include "grit/generated_resources.h" |
#include "grit/locale_settings.h" |
#include "grit/theme_resources.h" |
@@ -12,6 +13,7 @@ |
GeolocationConfirmInfoBarDelegateAndroid:: |
GeolocationConfirmInfoBarDelegateAndroid( |
+ GoogleLocationSettingsHelper* google_location_settings_helper, |
InfoBarTabHelper* infobar_helper, |
GeolocationInfoBarQueueController* controller, |
int render_process_id, |
@@ -25,15 +27,29 @@ GeolocationConfirmInfoBarDelegateAndroid( |
render_view_id, |
bridge_id, |
requesting_frame_url, |
- display_languages) { |
+ display_languages), |
+ google_location_settings_helper_(google_location_settings_helper) { |
} |
bool GeolocationConfirmInfoBarDelegateAndroid::Accept() { |
- return GeolocationConfirmInfoBarDelegate::Accept(); |
+ // Accept button text could be either 'Allow' or 'Google Location Settings'. |
John Knottenbelt
2012/10/17 10:28:29
Please update this comment - have you got it that
Ramya
2012/10/22 23:57:11
Yes, this works in the legacy case as well.
|
+ // If 'Allow' we follow the regular flow. |
+ if (google_location_settings_helper_->IsPlatformSettingEnabled()) |
+ return GeolocationConfirmInfoBarDelegate::Accept(); |
+ |
+ // If 'Google Location Settings', we need to open the system Google Location |
+ // Settings activity. |
+ google_location_settings_helper_->ShowGoogleLocationSettings(); |
+ SetPermission(false, false); |
+ return true; |
} |
string16 GeolocationConfirmInfoBarDelegateAndroid::GetButtonLabel( |
InfoBarButton button) const { |
- return l10n_util::GetStringUTF16((button == BUTTON_OK) ? |
- IDS_GEOLOCATION_ALLOW_BUTTON : IDS_GEOLOCATION_DENY_BUTTON); |
+ string16 button_ok_text; |
+ if (button == BUTTON_OK) { |
+ return UTF8ToUTF16( |
+ google_location_settings_helper_->GetAcceptButtonLabel()); |
+ } |
+ return l10n_util::GetStringUTF16(IDS_GEOLOCATION_DENY_BUTTON); |
} |