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

Side by Side Diff: chrome/browser/content_settings/permission_bubble_request_impl.cc

Issue 376253005: Migrate the notification permission to the new common permission classes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 5 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
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/content_settings/permission_bubble_request_impl.h" 5 #include "chrome/browser/content_settings/permission_bubble_request_impl.h"
6 6
7 #include "chrome/browser/content_settings/permission_context_base.h" 7 #include "chrome/browser/content_settings/permission_context_base.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"
(...skipping 15 matching lines...) Expand all
26 is_finished_(false) { 26 is_finished_(false) {
27 } 27 }
28 28
29 PermissionBubbleRequestImpl::~PermissionBubbleRequestImpl() { 29 PermissionBubbleRequestImpl::~PermissionBubbleRequestImpl() {
30 DCHECK(is_finished_); 30 DCHECK(is_finished_);
31 } 31 }
32 32
33 int PermissionBubbleRequestImpl::GetIconID() const { 33 int PermissionBubbleRequestImpl::GetIconID() const {
34 int icon_id; 34 int icon_id;
35 switch (type_) { 35 switch (type_) {
36 case CONTENT_SETTINGS_TYPE_NOTIFICATIONS:
37 icon_id = IDR_INFOBAR_DESKTOP_NOTIFICATIONS;
38 break;
Peter Beverloo 2014/07/10 11:29:38 nit: in permission_context_base.cc you add *_NOTIF
Miguel Garcia 2014/07/17 17:24:48 Done.
36 case CONTENT_SETTINGS_TYPE_MIDI_SYSEX: 39 case CONTENT_SETTINGS_TYPE_MIDI_SYSEX:
37 icon_id = IDR_ALLOWED_MIDI_SYSEX; 40 icon_id = IDR_ALLOWED_MIDI_SYSEX;
38 break; 41 break;
39 case CONTENT_SETTINGS_TYPE_PUSH_MESSAGING: 42 case CONTENT_SETTINGS_TYPE_PUSH_MESSAGING:
40 icon_id = IDR_INFOBAR_WARNING; 43 icon_id = IDR_INFOBAR_WARNING;
41 break; 44 break;
42 default: 45 default:
43 NOTREACHED(); 46 NOTREACHED();
44 return IDR_INFOBAR_WARNING; 47 return IDR_INFOBAR_WARNING;
45 } 48 }
46 return icon_id; 49 return icon_id;
47 } 50 }
48 51
49 base::string16 PermissionBubbleRequestImpl::GetMessageText() const { 52 base::string16 PermissionBubbleRequestImpl::GetMessageText() const {
50 int message_id; 53 int message_id;
51 switch (type_) { 54 switch (type_) {
55 case CONTENT_SETTINGS_TYPE_NOTIFICATIONS:
56 message_id = IDS_NOTIFICATION_PERMISSIONS;
Peter Beverloo 2014/07/10 11:29:39 IDS_NOTIFICATION_PERMISSIONS has <ph name="site">,
Miguel Garcia 2014/07/17 17:24:48 Yes On 2014/07/10 11:29:39, Peter Beverloo wrote:
57 break;
52 case CONTENT_SETTINGS_TYPE_MIDI_SYSEX: 58 case CONTENT_SETTINGS_TYPE_MIDI_SYSEX:
53 message_id = IDS_MIDI_SYSEX_INFOBAR_QUESTION; 59 message_id = IDS_MIDI_SYSEX_INFOBAR_QUESTION;
54 break; 60 break;
55 case CONTENT_SETTINGS_TYPE_PUSH_MESSAGING: 61 case CONTENT_SETTINGS_TYPE_PUSH_MESSAGING:
56 message_id = IDS_PUSH_MESSAGES_PERMISSION_QUESTION; 62 message_id = IDS_PUSH_MESSAGES_PERMISSION_QUESTION;
57 break; 63 break;
58 default: 64 default:
59 NOTREACHED(); 65 NOTREACHED();
60 return base::string16(); 66 return base::string16();
61 } 67 }
62 return l10n_util::GetStringFUTF16( 68 return l10n_util::GetStringFUTF16(
63 message_id, 69 message_id,
64 net::FormatUrl(request_origin_, display_languages_, 70 net::FormatUrl(request_origin_, display_languages_,
65 net::kFormatUrlOmitUsernamePassword | 71 net::kFormatUrlOmitUsernamePassword |
66 net::kFormatUrlOmitTrailingSlashOnBareHostname, 72 net::kFormatUrlOmitTrailingSlashOnBareHostname,
67 net::UnescapeRule::SPACES, NULL, NULL, NULL)); 73 net::UnescapeRule::SPACES, NULL, NULL, NULL));
68 } 74 }
69 75
70 base::string16 PermissionBubbleRequestImpl::GetMessageTextFragment() const { 76 base::string16 PermissionBubbleRequestImpl::GetMessageTextFragment() const {
71 int message_id; 77 int message_id;
72 switch (type_) { 78 switch (type_) {
79 case CONTENT_SETTINGS_TYPE_NOTIFICATIONS:
80 message_id = IDS_NOTIFICATION_PERMISSIONS_FRAGMENT;
81 break;
73 case CONTENT_SETTINGS_TYPE_MIDI_SYSEX: 82 case CONTENT_SETTINGS_TYPE_MIDI_SYSEX:
74 message_id = IDS_MIDI_SYSEX_PERMISSION_FRAGMENT; 83 message_id = IDS_MIDI_SYSEX_PERMISSION_FRAGMENT;
75 break; 84 break;
76 case CONTENT_SETTINGS_TYPE_PUSH_MESSAGING: 85 case CONTENT_SETTINGS_TYPE_PUSH_MESSAGING:
77 message_id = IDS_PUSH_MESSAGES_BUBBLE_FRAGMENT; 86 message_id = IDS_PUSH_MESSAGES_BUBBLE_FRAGMENT;
78 break; 87 break;
79 default: 88 default:
80 NOTREACHED(); 89 NOTREACHED();
81 return base::string16(); 90 return base::string16();
82 } 91 }
(...skipping 17 matching lines...) Expand all
100 } 109 }
101 110
102 void PermissionBubbleRequestImpl::Cancelled() { 111 void PermissionBubbleRequestImpl::Cancelled() {
103 permission_decided_callback_.Run(false, false); 112 permission_decided_callback_.Run(false, false);
104 } 113 }
105 114
106 void PermissionBubbleRequestImpl::RequestFinished() { 115 void PermissionBubbleRequestImpl::RequestFinished() {
107 is_finished_ = true; 116 is_finished_ = true;
108 delete_callback_.Run(); 117 delete_callback_.Run();
109 } 118 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698