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