| 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.h" |
| 6 | 6 |
| 7 #include "chrome/browser/infobars/infobar_service.h" | 7 #include "chrome/browser/infobars/infobar_service.h" |
| 8 #include "chrome/grit/generated_resources.h" | 8 #include "chrome/grit/generated_resources.h" |
| 9 #include "components/infobars/core/infobar.h" | 9 #include "components/infobars/core/infobar.h" |
| 10 #include "components/url_formatter/url_formatter.h" | 10 #include "components/url_formatter/url_formatter.h" |
| 11 #include "grit/generated_resources.h" | 11 #include "grit/generated_resources.h" |
| 12 #include "grit/theme_resources.h" | 12 #include "grit/theme_resources.h" |
| 13 #include "ui/base/l10n/l10n_util.h" | 13 #include "ui/base/l10n/l10n_util.h" |
| 14 | 14 |
| 15 | |
| 16 // static | 15 // static |
| 17 infobars::InfoBar* GeolocationInfoBarDelegate::Create( | 16 infobars::InfoBar* GeolocationInfoBarDelegate::Create( |
| 18 InfoBarService* infobar_service, | 17 InfoBarService* infobar_service, |
| 19 PermissionQueueController* controller, | |
| 20 const PermissionRequestID& id, | |
| 21 const GURL& requesting_frame, | 18 const GURL& requesting_frame, |
| 22 const std::string& display_languages) { | 19 const std::string& display_languages, |
| 20 const PermissionSetCallback& callback) { |
| 23 return infobar_service->AddInfoBar(infobar_service->CreateConfirmInfoBar( | 21 return infobar_service->AddInfoBar(infobar_service->CreateConfirmInfoBar( |
| 24 scoped_ptr<ConfirmInfoBarDelegate>(new GeolocationInfoBarDelegate( | 22 scoped_ptr<ConfirmInfoBarDelegate>(new GeolocationInfoBarDelegate( |
| 25 controller, id, requesting_frame, display_languages)))); | 23 requesting_frame, display_languages, callback)))); |
| 26 } | 24 } |
| 27 | 25 |
| 28 GeolocationInfoBarDelegate::GeolocationInfoBarDelegate( | 26 GeolocationInfoBarDelegate::GeolocationInfoBarDelegate( |
| 29 PermissionQueueController* controller, | |
| 30 const PermissionRequestID& id, | |
| 31 const GURL& requesting_frame, | 27 const GURL& requesting_frame, |
| 32 const std::string& display_languages) | 28 const std::string& display_languages, |
| 33 : PermissionInfobarDelegate(controller, id, requesting_frame, | 29 const PermissionSetCallback& callback) |
| 34 CONTENT_SETTINGS_TYPE_GEOLOCATION), | 30 : PermissionInfobarDelegate(requesting_frame, |
| 31 CONTENT_SETTINGS_TYPE_GEOLOCATION, |
| 32 callback), |
| 35 requesting_frame_(requesting_frame), | 33 requesting_frame_(requesting_frame), |
| 36 display_languages_(display_languages) { | 34 display_languages_(display_languages) { |
| 37 } | 35 } |
| 38 | 36 |
| 39 GeolocationInfoBarDelegate::~GeolocationInfoBarDelegate() { | 37 GeolocationInfoBarDelegate::~GeolocationInfoBarDelegate() { |
| 40 } | 38 } |
| 41 | 39 |
| 42 int GeolocationInfoBarDelegate::GetIconId() const { | 40 int GeolocationInfoBarDelegate::GetIconId() const { |
| 43 return IDR_INFOBAR_GEOLOCATION; | 41 return IDR_INFOBAR_GEOLOCATION; |
| 44 } | 42 } |
| 45 | 43 |
| 46 base::string16 GeolocationInfoBarDelegate::GetMessageText() const { | 44 base::string16 GeolocationInfoBarDelegate::GetMessageText() const { |
| 47 return l10n_util::GetStringFUTF16( | 45 return l10n_util::GetStringFUTF16( |
| 48 IDS_GEOLOCATION_INFOBAR_QUESTION, | 46 IDS_GEOLOCATION_INFOBAR_QUESTION, |
| 49 url_formatter::FormatUrl( | 47 url_formatter::FormatUrl( |
| 50 requesting_frame_, display_languages_, | 48 requesting_frame_, display_languages_, |
| 51 url_formatter::kFormatUrlOmitUsernamePassword | | 49 url_formatter::kFormatUrlOmitUsernamePassword | |
| 52 url_formatter::kFormatUrlOmitTrailingSlashOnBareHostname, | 50 url_formatter::kFormatUrlOmitTrailingSlashOnBareHostname, |
| 53 net::UnescapeRule::SPACES, nullptr, nullptr, nullptr)); | 51 net::UnescapeRule::SPACES, nullptr, nullptr, nullptr)); |
| 54 } | 52 } |
| OLD | NEW |