| 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 "chrome/browser/permissions/permission_context_base.h" | 7 #include "chrome/browser/permissions/permission_context_base.h" |
| 8 #include "chrome/browser/permissions/permission_context_uma_util.h" | 8 #include "chrome/browser/permissions/permission_context_uma_util.h" |
| 9 #include "chrome/grit/generated_resources.h" | 9 #include "chrome/grit/generated_resources.h" |
| 10 #include "components/url_formatter/url_formatter.h" | 10 #include "components/url_formatter/url_formatter.h" |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 case CONTENT_SETTINGS_TYPE_GEOLOCATION: | 42 case CONTENT_SETTINGS_TYPE_GEOLOCATION: |
| 43 return gfx::VectorIconId::LOCATION_ON; | 43 return gfx::VectorIconId::LOCATION_ON; |
| 44 #if defined(ENABLE_NOTIFICATIONS) | 44 #if defined(ENABLE_NOTIFICATIONS) |
| 45 case CONTENT_SETTINGS_TYPE_NOTIFICATIONS: | 45 case CONTENT_SETTINGS_TYPE_NOTIFICATIONS: |
| 46 return gfx::VectorIconId::NOTIFICATIONS; | 46 return gfx::VectorIconId::NOTIFICATIONS; |
| 47 #endif | 47 #endif |
| 48 #if defined(OS_CHROMEOS) | 48 #if defined(OS_CHROMEOS) |
| 49 case CONTENT_SETTINGS_TYPE_PROTECTED_MEDIA_IDENTIFIER: | 49 case CONTENT_SETTINGS_TYPE_PROTECTED_MEDIA_IDENTIFIER: |
| 50 #endif | 50 #endif |
| 51 case CONTENT_SETTINGS_TYPE_MIDI_SYSEX: | 51 case CONTENT_SETTINGS_TYPE_MIDI_SYSEX: |
| 52 case CONTENT_SETTINGS_TYPE_DURABLE_STORAGE: |
| 52 // TODO(estade): add vector icons for these. | 53 // TODO(estade): add vector icons for these. |
| 53 return gfx::VectorIconId::VECTOR_ICON_NONE; | 54 return gfx::VectorIconId::VECTOR_ICON_NONE; |
| 54 default: | 55 default: |
| 55 NOTREACHED(); | 56 NOTREACHED(); |
| 56 return gfx::VectorIconId::VECTOR_ICON_NONE; | 57 return gfx::VectorIconId::VECTOR_ICON_NONE; |
| 57 } | 58 } |
| 58 #else // !defined(TOOLKIT_VIEWS) | 59 #else // !defined(TOOLKIT_VIEWS) |
| 59 return gfx::VectorIconId::VECTOR_ICON_NONE; | 60 return gfx::VectorIconId::VECTOR_ICON_NONE; |
| 60 #endif | 61 #endif |
| 61 } | 62 } |
| (...skipping 10 matching lines...) Expand all Loading... |
| 72 break; | 73 break; |
| 73 #endif | 74 #endif |
| 74 case CONTENT_SETTINGS_TYPE_MIDI_SYSEX: | 75 case CONTENT_SETTINGS_TYPE_MIDI_SYSEX: |
| 75 icon_id = IDR_ALLOWED_MIDI_SYSEX; | 76 icon_id = IDR_ALLOWED_MIDI_SYSEX; |
| 76 break; | 77 break; |
| 77 #if defined(OS_ANDROID) || defined(OS_CHROMEOS) | 78 #if defined(OS_ANDROID) || defined(OS_CHROMEOS) |
| 78 case CONTENT_SETTINGS_TYPE_PROTECTED_MEDIA_IDENTIFIER: | 79 case CONTENT_SETTINGS_TYPE_PROTECTED_MEDIA_IDENTIFIER: |
| 79 icon_id = IDR_INFOBAR_PROTECTED_MEDIA_IDENTIFIER; | 80 icon_id = IDR_INFOBAR_PROTECTED_MEDIA_IDENTIFIER; |
| 80 break; | 81 break; |
| 81 #endif | 82 #endif |
| 83 // TODO(dgrogan): Get a real icon. https://crbug.com/516069 |
| 84 case CONTENT_SETTINGS_TYPE_DURABLE_STORAGE: |
| 85 icon_id = IDR_INFOBAR_WARNING; |
| 86 break; |
| 82 default: | 87 default: |
| 83 NOTREACHED(); | 88 NOTREACHED(); |
| 84 return IDR_INFOBAR_WARNING; | 89 return IDR_INFOBAR_WARNING; |
| 85 } | 90 } |
| 86 return icon_id; | 91 return icon_id; |
| 87 } | 92 } |
| 88 | 93 |
| 89 base::string16 PermissionBubbleRequestImpl::GetMessageText() const { | 94 base::string16 PermissionBubbleRequestImpl::GetMessageText() const { |
| 90 int message_id; | 95 int message_id; |
| 91 switch (type_) { | 96 switch (type_) { |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 136 message_id = IDS_MIDI_SYSEX_PERMISSION_FRAGMENT; | 141 message_id = IDS_MIDI_SYSEX_PERMISSION_FRAGMENT; |
| 137 break; | 142 break; |
| 138 case CONTENT_SETTINGS_TYPE_PUSH_MESSAGING: | 143 case CONTENT_SETTINGS_TYPE_PUSH_MESSAGING: |
| 139 message_id = IDS_PUSH_MESSAGES_BUBBLE_FRAGMENT; | 144 message_id = IDS_PUSH_MESSAGES_BUBBLE_FRAGMENT; |
| 140 break; | 145 break; |
| 141 #if defined(OS_ANDROID) || defined(OS_CHROMEOS) | 146 #if defined(OS_ANDROID) || defined(OS_CHROMEOS) |
| 142 case CONTENT_SETTINGS_TYPE_PROTECTED_MEDIA_IDENTIFIER: | 147 case CONTENT_SETTINGS_TYPE_PROTECTED_MEDIA_IDENTIFIER: |
| 143 message_id = IDS_PROTECTED_MEDIA_IDENTIFIER_PERMISSION_FRAGMENT; | 148 message_id = IDS_PROTECTED_MEDIA_IDENTIFIER_PERMISSION_FRAGMENT; |
| 144 break; | 149 break; |
| 145 #endif | 150 #endif |
| 151 case CONTENT_SETTINGS_TYPE_DURABLE_STORAGE: |
| 152 message_id = IDS_DURABLE_STORAGE_BUBBLE_FRAGMENT; |
| 153 break; |
| 146 default: | 154 default: |
| 147 NOTREACHED(); | 155 NOTREACHED(); |
| 148 return base::string16(); | 156 return base::string16(); |
| 149 } | 157 } |
| 150 return l10n_util::GetStringUTF16(message_id); | 158 return l10n_util::GetStringUTF16(message_id); |
| 151 } | 159 } |
| 152 | 160 |
| 153 bool PermissionBubbleRequestImpl::HasUserGesture() const { | 161 bool PermissionBubbleRequestImpl::HasUserGesture() const { |
| 154 return user_gesture_; | 162 return user_gesture_; |
| 155 } | 163 } |
| (...skipping 14 matching lines...) Expand all Loading... |
| 170 | 178 |
| 171 void PermissionBubbleRequestImpl::Cancelled() { | 179 void PermissionBubbleRequestImpl::Cancelled() { |
| 172 RegisterActionTaken(); | 180 RegisterActionTaken(); |
| 173 permission_decided_callback_.Run(false, CONTENT_SETTING_DEFAULT); | 181 permission_decided_callback_.Run(false, CONTENT_SETTING_DEFAULT); |
| 174 } | 182 } |
| 175 | 183 |
| 176 void PermissionBubbleRequestImpl::RequestFinished() { | 184 void PermissionBubbleRequestImpl::RequestFinished() { |
| 177 is_finished_ = true; | 185 is_finished_ = true; |
| 178 delete_callback_.Run(); | 186 delete_callback_.Run(); |
| 179 } | 187 } |
| OLD | NEW |