OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/services/gcm/push_messaging_infobar_delegate.h" | 5 #include "chrome/browser/services/gcm/push_messaging_infobar_delegate.h" |
6 | 6 |
7 #include "components/infobars/core/infobar.h" | 7 #include "components/infobars/core/infobar.h" |
8 #include "grit/generated_resources.h" | 8 #include "grit/generated_resources.h" |
9 #include "grit/theme_resources.h" | 9 #include "grit/theme_resources.h" |
10 #include "net/base/net_util.h" | 10 #include "net/base/net_util.h" |
11 #include "ui/base/l10n/l10n_util.h" | 11 #include "ui/base/l10n/l10n_util.h" |
12 | 12 |
13 namespace gcm { | 13 namespace gcm { |
14 | 14 |
15 // static | 15 // static |
16 infobars::InfoBar* PushMessagingInfoBarDelegate::Create( | 16 infobars::InfoBar* PushMessagingInfoBarDelegate::Create( |
17 InfoBarService* infobar_service, | 17 InfoBarService* infobar_service, |
18 PermissionQueueController* controller, | 18 PermissionQueueController* controller, |
19 const PermissionRequestID& id, | 19 const PermissionRequestID& id, |
20 const GURL& requesting_frame, | 20 const GURL& requesting_frame, |
21 const std::string& display_languages) { | 21 const std::string& display_languages, |
| 22 ContentSettingsType type) { |
22 DCHECK(infobar_service); | 23 DCHECK(infobar_service); |
23 DCHECK(controller); | 24 DCHECK(controller); |
24 return infobar_service->AddInfoBar(ConfirmInfoBarDelegate::CreateInfoBar( | 25 return infobar_service->AddInfoBar(ConfirmInfoBarDelegate::CreateInfoBar( |
25 scoped_ptr<ConfirmInfoBarDelegate>(new PushMessagingInfoBarDelegate( | 26 scoped_ptr<ConfirmInfoBarDelegate>(new PushMessagingInfoBarDelegate( |
26 controller, id, requesting_frame, display_languages)))); | 27 controller, id, requesting_frame, display_languages, type)))); |
27 } | 28 } |
28 | 29 |
29 PushMessagingInfoBarDelegate::PushMessagingInfoBarDelegate( | 30 PushMessagingInfoBarDelegate::PushMessagingInfoBarDelegate( |
30 PermissionQueueController* controller, | 31 PermissionQueueController* controller, |
31 const PermissionRequestID& id, | 32 const PermissionRequestID& id, |
32 const GURL& requesting_frame, | 33 const GURL& requesting_frame, |
33 const std::string& display_languages) | 34 const std::string& display_languages, |
34 : PermissionInfobarDelegate(controller, id, requesting_frame), | 35 ContentSettingsType type) |
| 36 : PermissionInfobarDelegate(controller, id, requesting_frame, type), |
35 requesting_origin_(requesting_frame.GetOrigin()), | 37 requesting_origin_(requesting_frame.GetOrigin()), |
36 display_languages_(display_languages) { | 38 display_languages_(display_languages) { |
37 } | 39 } |
38 | 40 |
39 PushMessagingInfoBarDelegate::~PushMessagingInfoBarDelegate() { | 41 PushMessagingInfoBarDelegate::~PushMessagingInfoBarDelegate() { |
40 } | 42 } |
41 | 43 |
42 base::string16 PushMessagingInfoBarDelegate::GetMessageText() const { | 44 base::string16 PushMessagingInfoBarDelegate::GetMessageText() const { |
43 return l10n_util::GetStringFUTF16( | 45 return l10n_util::GetStringFUTF16( |
44 IDS_PUSH_MESSAGES_PERMISSION_QUESTION, | 46 IDS_PUSH_MESSAGES_PERMISSION_QUESTION, |
45 net::FormatUrl(requesting_origin_, display_languages_, | 47 net::FormatUrl(requesting_origin_, display_languages_, |
46 net::kFormatUrlOmitUsernamePassword | | 48 net::kFormatUrlOmitUsernamePassword | |
47 net::kFormatUrlOmitTrailingSlashOnBareHostname, | 49 net::kFormatUrlOmitTrailingSlashOnBareHostname, |
48 net::UnescapeRule::SPACES, NULL, NULL, NULL)); | 50 net::UnescapeRule::SPACES, NULL, NULL, NULL)); |
49 } | 51 } |
50 | 52 |
51 int PushMessagingInfoBarDelegate::GetIconID() const { | 53 int PushMessagingInfoBarDelegate::GetIconID() const { |
52 // TODO(miguelg): change once we have an icon | 54 // TODO(miguelg): change once we have an icon |
53 return IDR_INFOBAR_WARNING; | 55 return IDR_INFOBAR_WARNING; |
54 } | 56 } |
55 | 57 |
56 } // namespace gcm | 58 } // namespace gcm |
OLD | NEW |