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/gcm_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* GCMInfoBarDelegate::Create( | |
16 InfoBarService* infobar_service, | |
17 PermissionQueueController* controller, | |
18 const PermissionRequestID& id, | |
19 GURL& requesting_frame, | |
20 const std::string& display_languages) { | |
21 return infobar_service->AddInfoBar(ConfirmInfoBarDelegate::CreateInfoBar( | |
fgorski
2014/06/20 14:14:15
are checks for infobar_service != NULL and control
Miguel Garcia
2014/06/20 20:50:11
I added DCHECKS for both since they should always
| |
22 scoped_ptr<ConfirmInfoBarDelegate>(new GCMInfoBarDelegate( | |
23 controller, id, requesting_frame, display_languages)))); | |
24 } | |
25 | |
26 GCMInfoBarDelegate::GCMInfoBarDelegate(PermissionQueueController* controller, | |
27 const PermissionRequestID& id, | |
28 GURL& requesting_frame, | |
29 const std::string& display_languages) | |
30 : PermissionInfobarDelegate(controller, id, requesting_frame), | |
31 requesting_origin_(requesting_frame.GetOrigin()), | |
32 display_languages_(display_languages) { | |
33 } | |
34 | |
35 GCMInfoBarDelegate::~GCMInfoBarDelegate() { | |
36 } | |
37 | |
38 base::string16 GCMInfoBarDelegate::GetMessageText() const { | |
39 return l10n_util::GetStringFUTF16( | |
40 IDS_PUSH_MESSAGES_PERMISSION_QUESTION, | |
41 net::FormatUrl(requesting_origin_, display_languages_)); | |
42 } | |
43 | |
44 } // namespace gcm | |
OLD | NEW |