| 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_request_impl.h" | 5 #include "chrome/browser/permissions/permission_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 23 matching lines...) Expand all Loading... |
| 34 nullptr); | 34 nullptr); |
| 35 } | 35 } |
| 36 | 36 |
| 37 gfx::VectorIconId PermissionRequestImpl::GetVectorIconId() const { | 37 gfx::VectorIconId PermissionRequestImpl::GetVectorIconId() const { |
| 38 #if !defined(OS_MACOSX) && !defined(OS_ANDROID) | 38 #if !defined(OS_MACOSX) && !defined(OS_ANDROID) |
| 39 switch (permission_type_) { | 39 switch (permission_type_) { |
| 40 case content::PermissionType::GEOLOCATION: | 40 case content::PermissionType::GEOLOCATION: |
| 41 return gfx::VectorIconId::LOCATION_ON; | 41 return gfx::VectorIconId::LOCATION_ON; |
| 42 #if defined(ENABLE_NOTIFICATIONS) | 42 #if defined(ENABLE_NOTIFICATIONS) |
| 43 case content::PermissionType::NOTIFICATIONS: | 43 case content::PermissionType::NOTIFICATIONS: |
| 44 case content::PermissionType::PUSH_MESSAGING: |
| 44 return gfx::VectorIconId::NOTIFICATIONS; | 45 return gfx::VectorIconId::NOTIFICATIONS; |
| 45 #endif | 46 #endif |
| 46 #if defined(OS_CHROMEOS) | 47 #if defined(OS_CHROMEOS) |
| 47 // TODO(xhwang): fix this icon, see crrev.com/863263007 | 48 // TODO(xhwang): fix this icon, see crrev.com/863263007 |
| 48 case content::PermissionType::PROTECTED_MEDIA_IDENTIFIER: | 49 case content::PermissionType::PROTECTED_MEDIA_IDENTIFIER: |
| 49 return gfx::VectorIconId::CHROME_PRODUCT; | 50 return gfx::VectorIconId::CHROME_PRODUCT; |
| 50 #endif | 51 #endif |
| 51 case content::PermissionType::MIDI_SYSEX: | 52 case content::PermissionType::MIDI_SYSEX: |
| 52 return gfx::VectorIconId::MIDI; | 53 return gfx::VectorIconId::MIDI; |
| 53 default: | 54 default: |
| 54 NOTREACHED(); | 55 NOTREACHED(); |
| 55 return gfx::VectorIconId::VECTOR_ICON_NONE; | 56 return gfx::VectorIconId::VECTOR_ICON_NONE; |
| 56 } | 57 } |
| 57 #else // !defined(OS_MACOSX) && !defined(OS_ANDROID) | 58 #else // !defined(OS_MACOSX) && !defined(OS_ANDROID) |
| 58 return gfx::VectorIconId::VECTOR_ICON_NONE; | 59 return gfx::VectorIconId::VECTOR_ICON_NONE; |
| 59 #endif | 60 #endif |
| 60 } | 61 } |
| 61 | 62 |
| 62 int PermissionRequestImpl::GetIconId() const { | 63 int PermissionRequestImpl::GetIconId() const { |
| 63 int icon_id = IDR_INFOBAR_WARNING; | 64 int icon_id = IDR_INFOBAR_WARNING; |
| 64 #if defined(OS_MACOSX) || defined(OS_ANDROID) | 65 #if defined(OS_MACOSX) || defined(OS_ANDROID) |
| 65 switch (permission_type_) { | 66 switch (permission_type_) { |
| 66 case content::PermissionType::GEOLOCATION: | 67 case content::PermissionType::GEOLOCATION: |
| 67 icon_id = IDR_INFOBAR_GEOLOCATION; | 68 icon_id = IDR_INFOBAR_GEOLOCATION; |
| 68 break; | 69 break; |
| 69 #if defined(ENABLE_NOTIFICATIONS) | 70 #if defined(ENABLE_NOTIFICATIONS) |
| 70 case content::PermissionType::NOTIFICATIONS: | 71 case content::PermissionType::NOTIFICATIONS: |
| 72 case content::PermissionType::PUSH_MESSAGING: |
| 71 icon_id = IDR_INFOBAR_DESKTOP_NOTIFICATIONS; | 73 icon_id = IDR_INFOBAR_DESKTOP_NOTIFICATIONS; |
| 72 break; | 74 break; |
| 73 #endif | 75 #endif |
| 74 case content::PermissionType::MIDI_SYSEX: | 76 case content::PermissionType::MIDI_SYSEX: |
| 75 icon_id = IDR_ALLOWED_MIDI_SYSEX; | 77 icon_id = IDR_ALLOWED_MIDI_SYSEX; |
| 76 break; | 78 break; |
| 77 default: | 79 default: |
| 78 NOTREACHED(); | 80 NOTREACHED(); |
| 79 } | 81 } |
| 80 #endif | 82 #endif |
| 81 return icon_id; | 83 return icon_id; |
| 82 } | 84 } |
| 83 | 85 |
| 84 base::string16 PermissionRequestImpl::GetMessageTextFragment() const { | 86 base::string16 PermissionRequestImpl::GetMessageTextFragment() const { |
| 85 int message_id; | 87 int message_id; |
| 86 switch (permission_type_) { | 88 switch (permission_type_) { |
| 87 case content::PermissionType::GEOLOCATION: | 89 case content::PermissionType::GEOLOCATION: |
| 88 message_id = IDS_GEOLOCATION_INFOBAR_PERMISSION_FRAGMENT; | 90 message_id = IDS_GEOLOCATION_INFOBAR_PERMISSION_FRAGMENT; |
| 89 break; | 91 break; |
| 90 #if defined(ENABLE_NOTIFICATIONS) | 92 #if defined(ENABLE_NOTIFICATIONS) |
| 91 case content::PermissionType::NOTIFICATIONS: | 93 case content::PermissionType::NOTIFICATIONS: |
| 94 case content::PermissionType::PUSH_MESSAGING: |
| 92 message_id = IDS_NOTIFICATION_PERMISSIONS_FRAGMENT; | 95 message_id = IDS_NOTIFICATION_PERMISSIONS_FRAGMENT; |
| 93 break; | 96 break; |
| 94 #endif | 97 #endif |
| 95 case content::PermissionType::MIDI_SYSEX: | 98 case content::PermissionType::MIDI_SYSEX: |
| 96 message_id = IDS_MIDI_SYSEX_PERMISSION_FRAGMENT; | 99 message_id = IDS_MIDI_SYSEX_PERMISSION_FRAGMENT; |
| 97 break; | 100 break; |
| 98 case content::PermissionType::PUSH_MESSAGING: | |
| 99 message_id = IDS_PUSH_MESSAGES_BUBBLE_FRAGMENT; | |
| 100 break; | |
| 101 #if defined(OS_CHROMEOS) | 101 #if defined(OS_CHROMEOS) |
| 102 case content::PermissionType::PROTECTED_MEDIA_IDENTIFIER: | 102 case content::PermissionType::PROTECTED_MEDIA_IDENTIFIER: |
| 103 message_id = IDS_PROTECTED_MEDIA_IDENTIFIER_PERMISSION_FRAGMENT; | 103 message_id = IDS_PROTECTED_MEDIA_IDENTIFIER_PERMISSION_FRAGMENT; |
| 104 break; | 104 break; |
| 105 #endif | 105 #endif |
| 106 default: | 106 default: |
| 107 NOTREACHED(); | 107 NOTREACHED(); |
| 108 return base::string16(); | 108 return base::string16(); |
| 109 } | 109 } |
| 110 return l10n_util::GetStringUTF16(message_id); | 110 return l10n_util::GetStringUTF16(message_id); |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 return PermissionRequestType::PERMISSION_PUSH_MESSAGING; | 149 return PermissionRequestType::PERMISSION_PUSH_MESSAGING; |
| 150 #if defined(OS_CHROMEOS) | 150 #if defined(OS_CHROMEOS) |
| 151 case content::PermissionType::PROTECTED_MEDIA_IDENTIFIER: | 151 case content::PermissionType::PROTECTED_MEDIA_IDENTIFIER: |
| 152 return PermissionRequestType::PERMISSION_PROTECTED_MEDIA_IDENTIFIER; | 152 return PermissionRequestType::PERMISSION_PROTECTED_MEDIA_IDENTIFIER; |
| 153 #endif | 153 #endif |
| 154 default: | 154 default: |
| 155 NOTREACHED(); | 155 NOTREACHED(); |
| 156 return PermissionRequestType::UNKNOWN; | 156 return PermissionRequestType::UNKNOWN; |
| 157 } | 157 } |
| 158 } | 158 } |
| OLD | NEW |