| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 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 | 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_infobar_delegate.h" | 5 #include "chrome/browser/geolocation/geolocation_infobar_delegate_android.h" |
| 6 | 6 |
| 7 #include "chrome/browser/android/android_theme_resources.h" | 7 #include "chrome/browser/android/android_theme_resources.h" |
| 8 #include "chrome/browser/infobars/infobar_service.h" | 8 #include "chrome/browser/infobars/infobar_service.h" |
| 9 #include "chrome/grit/generated_resources.h" | 9 #include "chrome/grit/generated_resources.h" |
| 10 #include "components/infobars/core/infobar.h" | 10 #include "components/infobars/core/infobar.h" |
| 11 #include "components/url_formatter/elide_url.h" | 11 #include "components/url_formatter/elide_url.h" |
| 12 #include "grit/generated_resources.h" | 12 #include "grit/generated_resources.h" |
| 13 #include "ui/base/l10n/l10n_util.h" | 13 #include "ui/base/l10n/l10n_util.h" |
| 14 | 14 |
| 15 // static | 15 // static |
| 16 infobars::InfoBar* GeolocationInfoBarDelegate::Create( | 16 infobars::InfoBar* GeolocationInfoBarDelegateAndroidAndroid::Create( |
| 17 InfoBarService* infobar_service, | 17 InfoBarService* infobar_service, |
| 18 const GURL& requesting_frame, | 18 const GURL& requesting_frame, |
| 19 const std::string& display_languages, | 19 const std::string& display_languages, |
| 20 const PermissionSetCallback& callback) { | 20 const PermissionSetCallback& callback) { |
| 21 return infobar_service->AddInfoBar(infobar_service->CreateConfirmInfoBar( | 21 return infobar_service->AddInfoBar( |
| 22 scoped_ptr<ConfirmInfoBarDelegate>(new GeolocationInfoBarDelegate( | 22 infobar_service->CreateConfirmInfoBar(scoped_ptr<ConfirmInfoBarDelegate>( |
| 23 requesting_frame, display_languages, callback)))); | 23 new GeolocationInfoBarDelegateAndroidAndroid( |
| 24 requesting_frame, display_languages, callback)))); |
| 24 } | 25 } |
| 25 | 26 |
| 26 GeolocationInfoBarDelegate::GeolocationInfoBarDelegate( | 27 GeolocationInfoBarDelegateAndroidAndroid:: |
| 27 const GURL& requesting_frame, | 28 GeolocationInfoBarDelegateAndroidAndroid( |
| 28 const std::string& display_languages, | 29 const GURL& requesting_frame, |
| 29 const PermissionSetCallback& callback) | 30 const std::string& display_languages, |
| 31 const PermissionSetCallback& callback) |
| 30 : PermissionInfobarDelegate(requesting_frame, | 32 : PermissionInfobarDelegate(requesting_frame, |
| 31 CONTENT_SETTINGS_TYPE_GEOLOCATION, | 33 CONTENT_SETTINGS_TYPE_GEOLOCATION, |
| 32 callback), | 34 callback), |
| 33 requesting_frame_(requesting_frame), | 35 requesting_frame_(requesting_frame), |
| 34 display_languages_(display_languages) { | 36 display_languages_(display_languages) {} |
| 35 } | |
| 36 | 37 |
| 37 GeolocationInfoBarDelegate::~GeolocationInfoBarDelegate() { | 38 GeolocationInfoBarDelegateAndroidAndroid:: |
| 38 } | 39 ~GeolocationInfoBarDelegateAndroidAndroid() {} |
| 39 | 40 |
| 40 int GeolocationInfoBarDelegate::GetIconId() const { | 41 int GeolocationInfoBarDelegateAndroidAndroid::GetIconId() const { |
| 41 return IDR_ANDROID_INFOBAR_GEOLOCATION; | 42 return IDR_ANDROID_INFOBAR_GEOLOCATION; |
| 42 } | 43 } |
| 43 | 44 |
| 44 base::string16 GeolocationInfoBarDelegate::GetMessageText() const { | 45 base::string16 GeolocationInfoBarDelegateAndroidAndroid::GetMessageText() |
| 46 const { |
| 45 return l10n_util::GetStringFUTF16(IDS_GEOLOCATION_INFOBAR_QUESTION, | 47 return l10n_util::GetStringFUTF16(IDS_GEOLOCATION_INFOBAR_QUESTION, |
| 46 url_formatter::FormatUrlForSecurityDisplay( | 48 url_formatter::FormatUrlForSecurityDisplay( |
| 47 requesting_frame_, display_languages_)); | 49 requesting_frame_, display_languages_)); |
| 48 } | 50 } |
| OLD | NEW |