| OLD | NEW |
| (Empty) |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "chrome/browser/geolocation/geolocation_confirm_infobar_delegate_androi
d.h" | |
| 6 | |
| 7 #include "base/utf_string_conversions.h" | |
| 8 #include "chrome/browser/android/google_location_settings_helper.h" | |
| 9 #include "grit/generated_resources.h" | |
| 10 #include "grit/locale_settings.h" | |
| 11 #include "grit/theme_resources.h" | |
| 12 #include "ui/base/l10n/l10n_util.h" | |
| 13 | |
| 14 GeolocationConfirmInfoBarDelegateAndroid:: | |
| 15 GeolocationConfirmInfoBarDelegateAndroid( | |
| 16 InfoBarService* infobar_service, | |
| 17 GeolocationInfoBarQueueController* controller, | |
| 18 const GeolocationPermissionRequestID& id, | |
| 19 const GURL& requesting_frame_url, | |
| 20 const std::string& display_languages) | |
| 21 : GeolocationConfirmInfoBarDelegate(infobar_service, controller, id, | |
| 22 requesting_frame_url, | |
| 23 display_languages), | |
| 24 google_location_settings_helper_( | |
| 25 GoogleLocationSettingsHelper::Create()) { | |
| 26 } | |
| 27 | |
| 28 GeolocationConfirmInfoBarDelegateAndroid:: | |
| 29 ~GeolocationConfirmInfoBarDelegateAndroid() { | |
| 30 } | |
| 31 | |
| 32 bool GeolocationConfirmInfoBarDelegateAndroid::Accept() { | |
| 33 // Accept button text could be either 'Allow' or 'Google Location Settings'. | |
| 34 // If 'Allow' we follow the regular flow. | |
| 35 if (google_location_settings_helper_->IsGoogleAppsLocationSettingEnabled()) | |
| 36 return GeolocationConfirmInfoBarDelegate::Accept(); | |
| 37 | |
| 38 // If 'Google Location Settings', we need to open the system Google Location | |
| 39 // Settings activity. | |
| 40 google_location_settings_helper_->ShowGoogleLocationSettings(); | |
| 41 SetPermission(false, false); | |
| 42 return true; | |
| 43 } | |
| 44 | |
| 45 string16 GeolocationConfirmInfoBarDelegateAndroid::GetButtonLabel( | |
| 46 InfoBarButton button) const { | |
| 47 if (button == BUTTON_OK) { | |
| 48 return UTF8ToUTF16( | |
| 49 google_location_settings_helper_->GetAcceptButtonLabel()); | |
| 50 } | |
| 51 return l10n_util::GetStringUTF16(IDS_GEOLOCATION_DENY_BUTTON); | |
| 52 } | |
| OLD | NEW |