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