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

Side by Side Diff: chrome/browser/storage/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: fix conflicts after midi constant permission landed 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
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/media/midi_permission_infobar_delegate.h" 5 #include "chrome/browser/storage/durable_storage_permission_infobar_delegate.h"
6 6
7 #include "base/strings/utf_string_conversions.h"
7 #include "chrome/browser/infobars/infobar_service.h" 8 #include "chrome/browser/infobars/infobar_service.h"
8 #include "chrome/grit/generated_resources.h" 9 #include "chrome/grit/generated_resources.h"
9 #include "components/infobars/core/infobar.h" 10 #include "components/infobars/core/infobar.h"
10 #include "components/url_formatter/url_formatter.h" 11 #include "components/url_formatter/url_formatter.h"
11 #include "grit/theme_resources.h" 12 #include "grit/theme_resources.h"
13 #include "net/base/escape.h"
12 #include "ui/base/l10n/l10n_util.h" 14 #include "ui/base/l10n/l10n_util.h"
13 15
14 // static 16 // static
15 infobars::InfoBar* MidiPermissionInfoBarDelegate::Create( 17 infobars::InfoBar* DurableStoragePermissionInfoBarDelegate::Create(
16 InfoBarService* infobar_service, 18 InfoBarService* infobar_service,
17 PermissionQueueController* controller, 19 PermissionQueueController* controller,
18 const PermissionRequestID& id, 20 const PermissionRequestID& id,
19 const GURL& requesting_frame, 21 const GURL& requesting_frame,
20 const std::string& display_languages, 22 const std::string& display_languages,
21 ContentSettingsType type) { 23 ContentSettingsType type) {
22 return infobar_service->AddInfoBar(infobar_service->CreateConfirmInfoBar( 24 return infobar_service->AddInfoBar(
23 scoped_ptr<ConfirmInfoBarDelegate>(new MidiPermissionInfoBarDelegate( 25 infobar_service->CreateConfirmInfoBar(scoped_ptr<ConfirmInfoBarDelegate>(
24 controller, id, requesting_frame, display_languages, type)))); 26 new DurableStoragePermissionInfoBarDelegate(
27 controller, id, requesting_frame, display_languages, type))));
25 } 28 }
26 29
27 MidiPermissionInfoBarDelegate::MidiPermissionInfoBarDelegate( 30 DurableStoragePermissionInfoBarDelegate::
28 PermissionQueueController* controller, 31 DurableStoragePermissionInfoBarDelegate(
29 const PermissionRequestID& id, 32 PermissionQueueController* controller,
30 const GURL& requesting_frame, 33 const PermissionRequestID& id,
31 const std::string& display_languages, 34 const GURL& requesting_frame,
32 ContentSettingsType type) 35 const std::string& display_languages,
36 ContentSettingsType type)
33 : PermissionInfobarDelegate(controller, id, requesting_frame, type), 37 : PermissionInfobarDelegate(controller, id, requesting_frame, type),
34 requesting_frame_(requesting_frame), 38 requesting_frame_(requesting_frame),
35 display_languages_(display_languages) { 39 display_languages_(display_languages) {
36 } 40 }
37 41
38 MidiPermissionInfoBarDelegate::~MidiPermissionInfoBarDelegate() { 42 base::string16 DurableStoragePermissionInfoBarDelegate::GetMessageText() const {
39 }
40
41 int MidiPermissionInfoBarDelegate::GetIconID() const {
42 return IDR_INFOBAR_MIDI;
43 }
44
45 base::string16 MidiPermissionInfoBarDelegate::GetMessageText() const {
46 return l10n_util::GetStringFUTF16( 43 return l10n_util::GetStringFUTF16(
47 IDS_MIDI_SYSEX_INFOBAR_QUESTION, 44 IDS_DURABLE_STORAGE_INFOBAR_QUESTION,
48 url_formatter::FormatUrl( 45 url_formatter::FormatUrl(
49 requesting_frame_.GetOrigin(), display_languages_, 46 requesting_frame_.GetOrigin(), display_languages_,
50 url_formatter::kFormatUrlOmitUsernamePassword | 47 url_formatter::kFormatUrlOmitUsernamePassword |
51 url_formatter::kFormatUrlOmitTrailingSlashOnBareHostname, 48 url_formatter::kFormatUrlOmitTrailingSlashOnBareHostname,
52 net::UnescapeRule::SPACES, nullptr, nullptr, nullptr)); 49 net::UnescapeRule::SPACES, NULL, NULL, NULL));
53 } 50 }
OLDNEW
« no previous file with comments | « chrome/browser/storage/durable_storage_permission_infobar_delegate.h ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698