| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/storage/durable_storage_permission_infobar_delegate.h" | 5 #include "chrome/browser/storage/durable_storage_permission_infobar_delegate_and
roid.h" |
| 6 | 6 |
| 7 #include "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.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/url_formatter.h" | 11 #include "components/url_formatter/url_formatter.h" |
| 12 #include "grit/theme_resources.h" | 12 #include "grit/theme_resources.h" |
| 13 #include "net/base/escape.h" | 13 #include "net/base/escape.h" |
| 14 #include "ui/base/l10n/l10n_util.h" | 14 #include "ui/base/l10n/l10n_util.h" |
| 15 | 15 |
| 16 // static | 16 // static |
| 17 infobars::InfoBar* DurableStoragePermissionInfoBarDelegate::Create( | 17 infobars::InfoBar* DurableStoragePermissionInfoBarDelegateAndroid::Create( |
| 18 InfoBarService* infobar_service, | 18 InfoBarService* infobar_service, |
| 19 const GURL& requesting_frame, | 19 const GURL& requesting_frame, |
| 20 const std::string& display_languages, | 20 const std::string& display_languages, |
| 21 ContentSettingsType type, | 21 ContentSettingsType type, |
| 22 const PermissionSetCallback& callback) { | 22 const PermissionSetCallback& callback) { |
| 23 return infobar_service->AddInfoBar( | 23 return infobar_service->AddInfoBar( |
| 24 infobar_service->CreateConfirmInfoBar(scoped_ptr<ConfirmInfoBarDelegate>( | 24 infobar_service->CreateConfirmInfoBar(scoped_ptr<ConfirmInfoBarDelegate>( |
| 25 new DurableStoragePermissionInfoBarDelegate( | 25 new DurableStoragePermissionInfoBarDelegateAndroid( |
| 26 requesting_frame, display_languages, type, callback)))); | 26 requesting_frame, display_languages, type, callback)))); |
| 27 } | 27 } |
| 28 | 28 |
| 29 DurableStoragePermissionInfoBarDelegate:: | 29 DurableStoragePermissionInfoBarDelegateAndroid:: |
| 30 DurableStoragePermissionInfoBarDelegate( | 30 DurableStoragePermissionInfoBarDelegateAndroid( |
| 31 const GURL& requesting_frame, | 31 const GURL& requesting_frame, |
| 32 const std::string& display_languages, | 32 const std::string& display_languages, |
| 33 ContentSettingsType type, | 33 ContentSettingsType type, |
| 34 const PermissionSetCallback& callback) | 34 const PermissionSetCallback& callback) |
| 35 : PermissionInfobarDelegate(requesting_frame, type, callback), | 35 : PermissionInfobarDelegate(requesting_frame, type, callback), |
| 36 requesting_frame_(requesting_frame), | 36 requesting_frame_(requesting_frame), |
| 37 display_languages_(display_languages) { | 37 display_languages_(display_languages) {} |
| 38 } | |
| 39 | 38 |
| 40 base::string16 DurableStoragePermissionInfoBarDelegate::GetMessageText() const { | 39 base::string16 DurableStoragePermissionInfoBarDelegateAndroid::GetMessageText() |
| 40 const { |
| 41 return l10n_util::GetStringFUTF16( | 41 return l10n_util::GetStringFUTF16( |
| 42 IDS_DURABLE_STORAGE_INFOBAR_QUESTION, | 42 IDS_DURABLE_STORAGE_INFOBAR_QUESTION, |
| 43 url_formatter::FormatUrl( | 43 url_formatter::FormatUrl( |
| 44 requesting_frame_.GetOrigin(), display_languages_, | 44 requesting_frame_.GetOrigin(), display_languages_, |
| 45 url_formatter::kFormatUrlOmitUsernamePassword | | 45 url_formatter::kFormatUrlOmitUsernamePassword | |
| 46 url_formatter::kFormatUrlOmitTrailingSlashOnBareHostname, | 46 url_formatter::kFormatUrlOmitTrailingSlashOnBareHostname, |
| 47 net::UnescapeRule::SPACES, NULL, NULL, NULL)); | 47 net::UnescapeRule::SPACES, NULL, NULL, NULL)); |
| 48 } | 48 } |
| OLD | NEW |