estade | 1ec66410 | 2015-10-23 20:24:22 | [diff] [blame] | 1 | // Copyright 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_infobar_delegate_android.h" |
| 6 | |
| 7 | #include "chrome/browser/android/android_theme_resources.h" |
| 8 | #include "chrome/browser/infobars/infobar_service.h" |
| 9 | #include "chrome/grit/generated_resources.h" |
| 10 | #include "components/infobars/core/infobar.h" |
estade | 1ec66410 | 2015-10-23 20:24:22 | [diff] [blame] | 11 | #include "grit/generated_resources.h" |
estade | 1ec66410 | 2015-10-23 20:24:22 | [diff] [blame] | 12 | |
| 13 | // static |
estade | b5c6c41 | 2015-10-26 19:16:56 | [diff] [blame] | 14 | infobars::InfoBar* GeolocationInfoBarDelegateAndroid::Create( |
estade | 1ec66410 | 2015-10-23 20:24:22 | [diff] [blame] | 15 | InfoBarService* infobar_service, |
| 16 | const GURL& requesting_frame, |
stefanocs | a91f52a | 2016-07-28 03:52:07 | [diff] [blame] | 17 | bool user_gesture, |
stefanocs | a5fb0e4 | 2016-07-21 04:24:16 | [diff] [blame] | 18 | Profile* profile, |
estade | 1ec66410 | 2015-10-23 20:24:22 | [diff] [blame] | 19 | const PermissionSetCallback& callback) { |
estade | b5c6c41 | 2015-10-26 19:16:56 | [diff] [blame] | 20 | return infobar_service->AddInfoBar(infobar_service->CreateConfirmInfoBar( |
dcheng | 4af4858 | 2016-04-19 00:29:35 | [diff] [blame] | 21 | std::unique_ptr<ConfirmInfoBarDelegate>( |
stefanocs | a91f52a | 2016-07-28 03:52:07 | [diff] [blame] | 22 | new GeolocationInfoBarDelegateAndroid(requesting_frame, user_gesture, |
| 23 | profile, callback)))); |
estade | 1ec66410 | 2015-10-23 20:24:22 | [diff] [blame] | 24 | } |
| 25 | |
estade | b5c6c41 | 2015-10-26 19:16:56 | [diff] [blame] | 26 | GeolocationInfoBarDelegateAndroid::GeolocationInfoBarDelegateAndroid( |
| 27 | const GURL& requesting_frame, |
stefanocs | a91f52a | 2016-07-28 03:52:07 | [diff] [blame] | 28 | bool user_gesture, |
stefanocs | a5fb0e4 | 2016-07-21 04:24:16 | [diff] [blame] | 29 | Profile* profile, |
estade | b5c6c41 | 2015-10-26 19:16:56 | [diff] [blame] | 30 | const PermissionSetCallback& callback) |
estade | 1ec66410 | 2015-10-23 20:24:22 | [diff] [blame] | 31 | : PermissionInfobarDelegate(requesting_frame, |
lshang | 2a0b8cb | 2015-12-09 04:59:49 | [diff] [blame] | 32 | content::PermissionType::GEOLOCATION, |
estade | 1ec66410 | 2015-10-23 20:24:22 | [diff] [blame] | 33 | CONTENT_SETTINGS_TYPE_GEOLOCATION, |
stefanocs | a91f52a | 2016-07-28 03:52:07 | [diff] [blame] | 34 | user_gesture, |
stefanocs | a5fb0e4 | 2016-07-21 04:24:16 | [diff] [blame] | 35 | profile, |
estade | 1ec66410 | 2015-10-23 20:24:22 | [diff] [blame] | 36 | callback), |
jshin | 1fb7646 | 2016-04-05 22:13:03 | [diff] [blame] | 37 | requesting_frame_(requesting_frame) {} |
estade | 1ec66410 | 2015-10-23 20:24:22 | [diff] [blame] | 38 | |
estade | b5c6c41 | 2015-10-26 19:16:56 | [diff] [blame] | 39 | GeolocationInfoBarDelegateAndroid::~GeolocationInfoBarDelegateAndroid() {} |
estade | 1ec66410 | 2015-10-23 20:24:22 | [diff] [blame] | 40 | |
dfalcantara | ac4d93b | 2015-12-30 20:07:24 | [diff] [blame] | 41 | infobars::InfoBarDelegate::InfoBarIdentifier |
| 42 | GeolocationInfoBarDelegateAndroid::GetIdentifier() const { |
| 43 | return GEOLOCATION_INFOBAR_DELEGATE_ANDROID; |
| 44 | } |
| 45 | |
estade | b5c6c41 | 2015-10-26 19:16:56 | [diff] [blame] | 46 | int GeolocationInfoBarDelegateAndroid::GetIconId() const { |
estade | 1ec66410 | 2015-10-23 20:24:22 | [diff] [blame] | 47 | return IDR_ANDROID_INFOBAR_GEOLOCATION; |
| 48 | } |
| 49 | |
benwells | 2337b810 | 2016-04-20 01:53:53 | [diff] [blame] | 50 | int GeolocationInfoBarDelegateAndroid::GetMessageResourceId() const { |
| 51 | return IDS_GEOLOCATION_INFOBAR_QUESTION; |
estade | 1ec66410 | 2015-10-23 20:24:22 | [diff] [blame] | 52 | } |