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

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

Issue 785993003: [Push] Register: require user-visible to be present in the manifest (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix test after mock behavior change that was recently introduced Created 6 years 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
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/push_messaging_infobar_delegate.h"
6
7 #include "chrome/grit/generated_resources.h"
8 #include "components/infobars/core/infobar.h"
9 #include "grit/theme_resources.h"
10 #include "net/base/net_util.h"
11 #include "ui/base/l10n/l10n_util.h"
12
13 namespace gcm {
14
15 // static
16 infobars::InfoBar* PushMessagingInfoBarDelegate::Create(
17 InfoBarService* infobar_service,
18 PermissionQueueController* controller,
19 const PermissionRequestID& id,
20 const GURL& requesting_frame,
21 const std::string& display_languages,
22 ContentSettingsType type) {
23 DCHECK(infobar_service);
24 DCHECK(controller);
25 return infobar_service->AddInfoBar(ConfirmInfoBarDelegate::CreateInfoBar(
26 scoped_ptr<ConfirmInfoBarDelegate>(new PushMessagingInfoBarDelegate(
27 controller, id, requesting_frame, display_languages, type))));
28 }
29
30 PushMessagingInfoBarDelegate::PushMessagingInfoBarDelegate(
31 PermissionQueueController* controller,
32 const PermissionRequestID& id,
33 const GURL& requesting_frame,
34 const std::string& display_languages,
35 ContentSettingsType type)
36 : PermissionInfobarDelegate(controller, id, requesting_frame, type),
37 requesting_origin_(requesting_frame.GetOrigin()),
38 display_languages_(display_languages) {
39 }
40
41 PushMessagingInfoBarDelegate::~PushMessagingInfoBarDelegate() {
42 }
43
44 base::string16 PushMessagingInfoBarDelegate::GetMessageText() const {
45 return l10n_util::GetStringFUTF16(
46 IDS_PUSH_MESSAGES_PERMISSION_QUESTION,
47 net::FormatUrl(requesting_origin_, display_languages_,
48 net::kFormatUrlOmitUsernamePassword |
49 net::kFormatUrlOmitTrailingSlashOnBareHostname,
50 net::UnescapeRule::SPACES, NULL, NULL, NULL));
51 }
52
53 int PushMessagingInfoBarDelegate::GetIconID() const {
54 // TODO(miguelg): change once we have an icon
55 return IDR_INFOBAR_WARNING;
56 }
57
58 } // namespace gcm
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698