Index: chrome/browser/durable_storage_permission_infobar_delegate.cc |
diff --git a/chrome/browser/durable_storage_permission_infobar_delegate.cc b/chrome/browser/durable_storage_permission_infobar_delegate.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..d0ad2127d212799ea184679a8544cb4688816be6 |
--- /dev/null |
+++ b/chrome/browser/durable_storage_permission_infobar_delegate.cc |
@@ -0,0 +1,48 @@ |
+// Copyright 2013 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#include "chrome/browser/durable_storage_permission_infobar_delegate.h" |
+ |
+#include "base/strings/utf_string_conversions.h" |
+#include "chrome/browser/infobars/infobar_service.h" |
+#include "chrome/grit/generated_resources.h" |
+#include "components/infobars/core/infobar.h" |
+#include "grit/theme_resources.h" |
+#include "net/base/net_util.h" |
+#include "ui/base/l10n/l10n_util.h" |
+ |
+// static |
+infobars::InfoBar* DurableStoragePermissionInfoBarDelegate::Create( |
+ InfoBarService* infobar_service, |
+ PermissionQueueController* controller, |
+ const PermissionRequestID& id, |
+ const GURL& requesting_frame, |
+ const std::string& display_languages, |
+ ContentSettingsType type) { |
+ return infobar_service->AddInfoBar( |
+ infobar_service->CreateConfirmInfoBar(scoped_ptr<ConfirmInfoBarDelegate>( |
+ new DurableStoragePermissionInfoBarDelegate( |
+ controller, id, requesting_frame, display_languages, type)))); |
+} |
+ |
+DurableStoragePermissionInfoBarDelegate:: |
+ DurableStoragePermissionInfoBarDelegate( |
+ PermissionQueueController* controller, |
+ const PermissionRequestID& id, |
+ const GURL& requesting_frame, |
+ const std::string& display_languages, |
+ ContentSettingsType type) |
+ : PermissionInfobarDelegate(controller, id, requesting_frame, type), |
+ requesting_frame_(requesting_frame), |
+ display_languages_(display_languages) { |
+} |
+ |
+base::string16 DurableStoragePermissionInfoBarDelegate::GetMessageText() const { |
+ return l10n_util::GetStringFUTF16( |
+ IDS_DURABLE_STORAGE_INFOBAR_QUESTION, |
+ net::FormatUrl(requesting_frame_.GetOrigin(), display_languages_, |
+ net::kFormatUrlOmitUsernamePassword | |
+ net::kFormatUrlOmitTrailingSlashOnBareHostname, |
+ net::UnescapeRule::SPACES, NULL, NULL, NULL)); |
+} |