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