Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(56)

Unified Diff: chrome/browser/durable_storage_permission_infobar_delegate.cc

Issue 1164073005: Allow script to request durable storage permission (chrome side) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: ToT Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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));
+}

Powered by Google App Engine
This is Rietveld 408576698