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

Side by Side Diff: chrome/browser/services/gcm/gcm_infobar_delegate.cc

Issue 343743004: Implement a permission check for push. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Comments from Peter, Bernhard and Elliot Created 6 years, 6 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 | Annotate | Revision Log
OLDNEW
(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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698