OLD | NEW |
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/permissions/permission_bubble_request_impl.h" | 5 #include "chrome/browser/permissions/permission_bubble_request_impl.h" |
6 | 6 |
7 #include "build/build_config.h" | 7 #include "build/build_config.h" |
8 #include "chrome/browser/permissions/permission_context_base.h" | 8 #include "chrome/browser/permissions/permission_context_base.h" |
9 #include "chrome/browser/permissions/permission_uma_util.h" | 9 #include "chrome/browser/permissions/permission_uma_util.h" |
10 #include "chrome/grit/generated_resources.h" | 10 #include "chrome/grit/generated_resources.h" |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 case content::PermissionType::MIDI_SYSEX: | 72 case content::PermissionType::MIDI_SYSEX: |
73 icon_id = IDR_ALLOWED_MIDI_SYSEX; | 73 icon_id = IDR_ALLOWED_MIDI_SYSEX; |
74 break; | 74 break; |
75 default: | 75 default: |
76 NOTREACHED(); | 76 NOTREACHED(); |
77 } | 77 } |
78 #endif | 78 #endif |
79 return icon_id; | 79 return icon_id; |
80 } | 80 } |
81 | 81 |
82 base::string16 PermissionBubbleRequestImpl::GetMessageText() const { | |
83 int message_id; | |
84 switch (permission_type_) { | |
85 case content::PermissionType::GEOLOCATION: | |
86 message_id = IDS_GEOLOCATION_INFOBAR_QUESTION; | |
87 break; | |
88 #if defined(ENABLE_NOTIFICATIONS) | |
89 case content::PermissionType::NOTIFICATIONS: | |
90 message_id = IDS_NOTIFICATION_PERMISSIONS; | |
91 break; | |
92 #endif | |
93 case content::PermissionType::MIDI_SYSEX: | |
94 message_id = IDS_MIDI_SYSEX_INFOBAR_QUESTION; | |
95 break; | |
96 case content::PermissionType::PUSH_MESSAGING: | |
97 message_id = IDS_PUSH_MESSAGES_PERMISSION_QUESTION; | |
98 break; | |
99 #if defined(OS_CHROMEOS) | |
100 case content::PermissionType::PROTECTED_MEDIA_IDENTIFIER: | |
101 message_id = IDS_PROTECTED_MEDIA_IDENTIFIER_INFOBAR_QUESTION; | |
102 break; | |
103 #endif | |
104 default: | |
105 NOTREACHED(); | |
106 return base::string16(); | |
107 } | |
108 return l10n_util::GetStringFUTF16( | |
109 message_id, | |
110 url_formatter::FormatUrlForSecurityDisplay( | |
111 request_origin_, url_formatter::SchemeDisplay::OMIT_CRYPTOGRAPHIC)); | |
112 } | |
113 | |
114 base::string16 PermissionBubbleRequestImpl::GetMessageTextFragment() const { | 82 base::string16 PermissionBubbleRequestImpl::GetMessageTextFragment() const { |
115 int message_id; | 83 int message_id; |
116 switch (permission_type_) { | 84 switch (permission_type_) { |
117 case content::PermissionType::GEOLOCATION: | 85 case content::PermissionType::GEOLOCATION: |
118 message_id = IDS_GEOLOCATION_INFOBAR_PERMISSION_FRAGMENT; | 86 message_id = IDS_GEOLOCATION_INFOBAR_PERMISSION_FRAGMENT; |
119 break; | 87 break; |
120 #if defined(ENABLE_NOTIFICATIONS) | 88 #if defined(ENABLE_NOTIFICATIONS) |
121 case content::PermissionType::NOTIFICATIONS: | 89 case content::PermissionType::NOTIFICATIONS: |
122 message_id = IDS_NOTIFICATION_PERMISSIONS_FRAGMENT; | 90 message_id = IDS_NOTIFICATION_PERMISSIONS_FRAGMENT; |
123 break; | 91 break; |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 | 129 |
162 void PermissionBubbleRequestImpl::RequestFinished() { | 130 void PermissionBubbleRequestImpl::RequestFinished() { |
163 is_finished_ = true; | 131 is_finished_ = true; |
164 delete_callback_.Run(); | 132 delete_callback_.Run(); |
165 } | 133 } |
166 | 134 |
167 PermissionBubbleType PermissionBubbleRequestImpl::GetPermissionBubbleType() | 135 PermissionBubbleType PermissionBubbleRequestImpl::GetPermissionBubbleType() |
168 const { | 136 const { |
169 return PermissionBubbleType::PERMISSION; | 137 return PermissionBubbleType::PERMISSION; |
170 } | 138 } |
OLD | NEW |