OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "chrome/browser/services/gcm/push_messaging_infobar_delegate.h" |
| 6 |
| 7 #include "components/infobars/core/infobar.h" |
| 8 #include "grit/generated_resources.h" |
| 9 #include "net/base/net_util.h" |
| 10 #include "ui/base/l10n/l10n_util.h" |
| 11 |
| 12 namespace gcm { |
| 13 |
| 14 // static |
| 15 infobars::InfoBar* PushMessagingInfoBarDelegate::Create( |
| 16 InfoBarService* infobar_service, |
| 17 PermissionQueueController* controller, |
| 18 const PermissionRequestID& id, |
| 19 const GURL& requesting_frame, |
| 20 const std::string& display_languages) { |
| 21 DCHECK(infobar_service); |
| 22 DCHECK(controller); |
| 23 return infobar_service->AddInfoBar(ConfirmInfoBarDelegate::CreateInfoBar( |
| 24 scoped_ptr<ConfirmInfoBarDelegate>(new PushMessagingInfoBarDelegate( |
| 25 controller, id, requesting_frame, display_languages)))); |
| 26 } |
| 27 |
| 28 PushMessagingInfoBarDelegate::PushMessagingInfoBarDelegate( |
| 29 PermissionQueueController* controller, |
| 30 const PermissionRequestID& id, |
| 31 const GURL& requesting_frame, |
| 32 const std::string& display_languages) |
| 33 : PermissionInfobarDelegate(controller, id, requesting_frame), |
| 34 requesting_origin_(requesting_frame.GetOrigin()), |
| 35 display_languages_(display_languages) { |
| 36 } |
| 37 |
| 38 PushMessagingInfoBarDelegate::~PushMessagingInfoBarDelegate() { |
| 39 } |
| 40 |
| 41 base::string16 PushMessagingInfoBarDelegate::GetMessageText() const { |
| 42 return l10n_util::GetStringFUTF16( |
| 43 IDS_PUSH_MESSAGES_PERMISSION_QUESTION, |
| 44 net::FormatUrl(requesting_origin_, display_languages_)); |
| 45 } |
| 46 |
| 47 } // namespace gcm |
OLD | NEW |