| OLD | NEW |
| (Empty) |
| 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.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" | |
| 11 #include "components/url_formatter/elide_url.h" | |
| 12 #include "grit/generated_resources.h" | |
| 13 #include "ui/base/l10n/l10n_util.h" | |
| 14 | |
| 15 // static | |
| 16 infobars::InfoBar* GeolocationInfoBarDelegate::Create( | |
| 17 InfoBarService* infobar_service, | |
| 18 const GURL& requesting_frame, | |
| 19 const std::string& display_languages, | |
| 20 const PermissionSetCallback& callback) { | |
| 21 return infobar_service->AddInfoBar(infobar_service->CreateConfirmInfoBar( | |
| 22 scoped_ptr<ConfirmInfoBarDelegate>(new GeolocationInfoBarDelegate( | |
| 23 requesting_frame, display_languages, callback)))); | |
| 24 } | |
| 25 | |
| 26 GeolocationInfoBarDelegate::GeolocationInfoBarDelegate( | |
| 27 const GURL& requesting_frame, | |
| 28 const std::string& display_languages, | |
| 29 const PermissionSetCallback& callback) | |
| 30 : PermissionInfobarDelegate(requesting_frame, | |
| 31 CONTENT_SETTINGS_TYPE_GEOLOCATION, | |
| 32 callback), | |
| 33 requesting_frame_(requesting_frame), | |
| 34 display_languages_(display_languages) { | |
| 35 } | |
| 36 | |
| 37 GeolocationInfoBarDelegate::~GeolocationInfoBarDelegate() { | |
| 38 } | |
| 39 | |
| 40 int GeolocationInfoBarDelegate::GetIconId() const { | |
| 41 return IDR_ANDROID_INFOBAR_GEOLOCATION; | |
| 42 } | |
| 43 | |
| 44 base::string16 GeolocationInfoBarDelegate::GetMessageText() const { | |
| 45 return l10n_util::GetStringFUTF16(IDS_GEOLOCATION_INFOBAR_QUESTION, | |
| 46 url_formatter::FormatUrlForSecurityDisplay( | |
| 47 requesting_frame_, display_languages_)); | |
| 48 } | |
| OLD | NEW |