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_android.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* GeolocationInfoBarDelegateAndroid::Create( | 16 infobars::InfoBar* GeolocationInfoBarDelegateAndroid::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, | |
20 const PermissionSetCallback& callback) { | 19 const PermissionSetCallback& callback) { |
21 return infobar_service->AddInfoBar(infobar_service->CreateConfirmInfoBar( | 20 return infobar_service->AddInfoBar(infobar_service->CreateConfirmInfoBar( |
22 scoped_ptr<ConfirmInfoBarDelegate>(new GeolocationInfoBarDelegateAndroid( | 21 scoped_ptr<ConfirmInfoBarDelegate>(new GeolocationInfoBarDelegateAndroid( |
23 requesting_frame, display_languages, callback)))); | 22 requesting_frame, callback)))); |
24 } | 23 } |
25 | 24 |
26 GeolocationInfoBarDelegateAndroid::GeolocationInfoBarDelegateAndroid( | 25 GeolocationInfoBarDelegateAndroid::GeolocationInfoBarDelegateAndroid( |
27 const GURL& requesting_frame, | 26 const GURL& requesting_frame, |
28 const std::string& display_languages, | |
29 const PermissionSetCallback& callback) | 27 const PermissionSetCallback& callback) |
30 : PermissionInfobarDelegate(requesting_frame, | 28 : PermissionInfobarDelegate(requesting_frame, |
31 content::PermissionType::GEOLOCATION, | 29 content::PermissionType::GEOLOCATION, |
32 CONTENT_SETTINGS_TYPE_GEOLOCATION, | 30 CONTENT_SETTINGS_TYPE_GEOLOCATION, |
33 callback), | 31 callback), |
34 requesting_frame_(requesting_frame), | 32 requesting_frame_(requesting_frame) {} |
35 display_languages_(display_languages) {} | |
36 | 33 |
37 GeolocationInfoBarDelegateAndroid::~GeolocationInfoBarDelegateAndroid() {} | 34 GeolocationInfoBarDelegateAndroid::~GeolocationInfoBarDelegateAndroid() {} |
38 | 35 |
39 infobars::InfoBarDelegate::InfoBarIdentifier | 36 infobars::InfoBarDelegate::InfoBarIdentifier |
40 GeolocationInfoBarDelegateAndroid::GetIdentifier() const { | 37 GeolocationInfoBarDelegateAndroid::GetIdentifier() const { |
41 return GEOLOCATION_INFOBAR_DELEGATE_ANDROID; | 38 return GEOLOCATION_INFOBAR_DELEGATE_ANDROID; |
42 } | 39 } |
43 | 40 |
44 int GeolocationInfoBarDelegateAndroid::GetIconId() const { | 41 int GeolocationInfoBarDelegateAndroid::GetIconId() const { |
45 return IDR_ANDROID_INFOBAR_GEOLOCATION; | 42 return IDR_ANDROID_INFOBAR_GEOLOCATION; |
46 } | 43 } |
47 | 44 |
48 base::string16 GeolocationInfoBarDelegateAndroid::GetMessageText() const { | 45 base::string16 GeolocationInfoBarDelegateAndroid::GetMessageText() const { |
49 return l10n_util::GetStringFUTF16(IDS_GEOLOCATION_INFOBAR_QUESTION, | 46 return l10n_util::GetStringFUTF16(IDS_GEOLOCATION_INFOBAR_QUESTION, |
50 url_formatter::FormatUrlForSecurityDisplay( | 47 url_formatter::FormatUrlForSecurityDisplay( |
51 requesting_frame_, display_languages_)); | 48 requesting_frame_)); |
52 } | 49 } |
OLD | NEW |