| 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_decision_auto_blocker.h" | 8 #include "chrome/browser/permissions/permission_decision_auto_blocker.h" |
| 9 #include "chrome/browser/permissions/permission_uma_util.h" | 9 #include "chrome/browser/permissions/permission_uma_util.h" |
| 10 #include "chrome/browser/permissions/permission_util.h" | 10 #include "chrome/browser/permissions/permission_util.h" |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 | 33 |
| 34 PermissionRequestImpl::~PermissionRequestImpl() { | 34 PermissionRequestImpl::~PermissionRequestImpl() { |
| 35 DCHECK(is_finished_); | 35 DCHECK(is_finished_); |
| 36 if (!action_taken_) { | 36 if (!action_taken_) { |
| 37 PermissionUmaUtil::PermissionIgnored(permission_type_, GetGestureType(), | 37 PermissionUmaUtil::PermissionIgnored(permission_type_, GetGestureType(), |
| 38 request_origin_, profile_); | 38 request_origin_, profile_); |
| 39 } | 39 } |
| 40 } | 40 } |
| 41 | 41 |
| 42 gfx::VectorIconId PermissionRequestImpl::GetVectorIconId() const { | 42 gfx::VectorIconId PermissionRequestImpl::GetVectorIconId() const { |
| 43 #if !defined(OS_MACOSX) && !defined(OS_ANDROID) | 43 #if !defined(OS_ANDROID) |
| 44 switch (permission_type_) { | 44 switch (permission_type_) { |
| 45 case content::PermissionType::GEOLOCATION: | 45 case content::PermissionType::GEOLOCATION: |
| 46 return gfx::VectorIconId::LOCATION_ON; | 46 return gfx::VectorIconId::LOCATION_ON; |
| 47 #if defined(ENABLE_NOTIFICATIONS) | 47 #if defined(ENABLE_NOTIFICATIONS) |
| 48 case content::PermissionType::NOTIFICATIONS: | 48 case content::PermissionType::NOTIFICATIONS: |
| 49 case content::PermissionType::PUSH_MESSAGING: | 49 case content::PermissionType::PUSH_MESSAGING: |
| 50 return gfx::VectorIconId::NOTIFICATIONS; | 50 return gfx::VectorIconId::NOTIFICATIONS; |
| 51 #endif | 51 #endif |
| 52 #if defined(OS_CHROMEOS) | 52 #if defined(OS_CHROMEOS) |
| 53 // TODO(xhwang): fix this icon, see crrev.com/863263007 | 53 // TODO(xhwang): fix this icon, see crrev.com/863263007 |
| 54 case content::PermissionType::PROTECTED_MEDIA_IDENTIFIER: | 54 case content::PermissionType::PROTECTED_MEDIA_IDENTIFIER: |
| 55 return gfx::VectorIconId::CHROME_PRODUCT; | 55 return gfx::VectorIconId::CHROME_PRODUCT; |
| 56 #endif | 56 #endif |
| 57 case content::PermissionType::MIDI_SYSEX: | 57 case content::PermissionType::MIDI_SYSEX: |
| 58 return gfx::VectorIconId::MIDI; | 58 return gfx::VectorIconId::MIDI; |
| 59 case content::PermissionType::FLASH: | 59 case content::PermissionType::FLASH: |
| 60 return gfx::VectorIconId::EXTENSION; | 60 return gfx::VectorIconId::EXTENSION; |
| 61 default: | 61 default: |
| 62 NOTREACHED(); | 62 NOTREACHED(); |
| 63 return gfx::VectorIconId::VECTOR_ICON_NONE; | 63 return gfx::VectorIconId::VECTOR_ICON_NONE; |
| 64 } | 64 } |
| 65 #else // !defined(OS_MACOSX) && !defined(OS_ANDROID) | 65 #else // !defined(OS_ANDROID) |
| 66 return gfx::VectorIconId::VECTOR_ICON_NONE; | 66 return gfx::VectorIconId::VECTOR_ICON_NONE; |
| 67 #endif | 67 #endif |
| 68 } | 68 } |
| 69 | 69 |
| 70 int PermissionRequestImpl::GetIconId() const { | 70 int PermissionRequestImpl::GetIconId() const { |
| 71 int icon_id = IDR_INFOBAR_WARNING; | 71 int icon_id = 0; |
| 72 #if defined(OS_MACOSX) || defined(OS_ANDROID) | 72 #if defined(OS_ANDROID) |
| 73 switch (permission_type_) { | 73 switch (permission_type_) { |
| 74 case content::PermissionType::GEOLOCATION: | 74 case content::PermissionType::GEOLOCATION: |
| 75 icon_id = IDR_INFOBAR_GEOLOCATION; | 75 icon_id = IDR_ANDROID_INFOBAR_GEOLOCATION; |
| 76 break; | 76 break; |
| 77 #if defined(ENABLE_NOTIFICATIONS) | |
| 78 case content::PermissionType::NOTIFICATIONS: | |
| 79 case content::PermissionType::PUSH_MESSAGING: | |
| 80 icon_id = IDR_INFOBAR_DESKTOP_NOTIFICATIONS; | |
| 81 break; | |
| 82 #endif | |
| 83 case content::PermissionType::MIDI_SYSEX: | 77 case content::PermissionType::MIDI_SYSEX: |
| 84 icon_id = IDR_ALLOWED_MIDI_SYSEX; | 78 icon_id = IDR_ALLOWED_MIDI_SYSEX; |
| 85 break; | 79 break; |
| 86 case content::PermissionType::FLASH: | 80 case content::PermissionType::FLASH: |
| 87 icon_id = IDR_ALLOWED_PLUGINS; | 81 icon_id = IDR_ALLOWED_PLUGINS; |
| 88 break; | 82 break; |
| 89 default: | 83 default: |
| 90 NOTREACHED(); | 84 NOTREACHED(); |
| 91 } | 85 } |
| 92 #endif | 86 #endif |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 175 NOTREACHED(); | 169 NOTREACHED(); |
| 176 return PermissionRequestType::UNKNOWN; | 170 return PermissionRequestType::UNKNOWN; |
| 177 } | 171 } |
| 178 } | 172 } |
| 179 | 173 |
| 180 PermissionRequestGestureType PermissionRequestImpl::GetGestureType() | 174 PermissionRequestGestureType PermissionRequestImpl::GetGestureType() |
| 181 const { | 175 const { |
| 182 return has_gesture_ ? PermissionRequestGestureType::GESTURE | 176 return has_gesture_ ? PermissionRequestGestureType::GESTURE |
| 183 : PermissionRequestGestureType::NO_GESTURE; | 177 : PermissionRequestGestureType::NO_GESTURE; |
| 184 } | 178 } |
| OLD | NEW |