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

Side by Side 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 unified diff | Download patch
OLDNEW
(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/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 "grit/theme_resources.h"
12 #include "net/base/net_util.h"
13 #include "ui/base/l10n/l10n_util.h"
14
15 // static
16 infobars::InfoBar* DurableStoragePermissionInfoBarDelegate::Create(
17 InfoBarService* infobar_service,
18 PermissionQueueController* controller,
19 const PermissionRequestID& id,
20 const GURL& requesting_frame,
21 const std::string& display_languages,
22 ContentSettingsType type) {
23 return infobar_service->AddInfoBar(
24 infobar_service->CreateConfirmInfoBar(scoped_ptr<ConfirmInfoBarDelegate>(
25 new DurableStoragePermissionInfoBarDelegate(
26 controller, id, requesting_frame, display_languages, type))));
27 }
28
29 DurableStoragePermissionInfoBarDelegate::
30 DurableStoragePermissionInfoBarDelegate(
31 PermissionQueueController* controller,
32 const PermissionRequestID& id,
33 const GURL& requesting_frame,
34 const std::string& display_languages,
35 ContentSettingsType type)
36 : PermissionInfobarDelegate(controller, id, requesting_frame, type),
37 requesting_frame_(requesting_frame),
38 display_languages_(display_languages) {
39 }
40
41 base::string16 DurableStoragePermissionInfoBarDelegate::GetMessageText() const {
42 return l10n_util::GetStringFUTF16(
43 IDS_DURABLE_STORAGE_INFOBAR_QUESTION,
44 net::FormatUrl(requesting_frame_.GetOrigin(), display_languages_,
45 net::kFormatUrlOmitUsernamePassword |
46 net::kFormatUrlOmitTrailingSlashOnBareHostname,
47 net::UnescapeRule::SPACES, NULL, NULL, NULL));
48 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698