| 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_uma_util.h" | 8 #include "chrome/browser/permissions/permission_uma_util.h" |
| 9 #include "chrome/browser/permissions/permission_util.h" | 9 #include "chrome/browser/permissions/permission_util.h" |
| 10 #include "chrome/grit/generated_resources.h" | 10 #include "chrome/grit/generated_resources.h" |
| 11 #include "components/url_formatter/elide_url.h" | 11 #include "components/url_formatter/elide_url.h" |
| 12 #include "net/base/escape.h" | 12 #include "net/base/escape.h" |
| 13 #include "ui/base/l10n/l10n_util.h" | 13 #include "ui/base/l10n/l10n_util.h" |
| 14 #include "ui/gfx/vector_icons_public.h" | |
| 15 | 14 |
| 16 #if defined(OS_ANDROID) | 15 #if defined(OS_ANDROID) |
| 17 #include "chrome/browser/android/android_theme_resources.h" | 16 #include "chrome/browser/android/android_theme_resources.h" |
| 17 #else |
| 18 #include "chrome/app/vector_icons/vector_icons.h" |
| 19 #include "ui/vector_icons/vector_icons.h" |
| 18 #endif | 20 #endif |
| 19 | 21 |
| 20 PermissionRequestImpl::PermissionRequestImpl( | 22 PermissionRequestImpl::PermissionRequestImpl( |
| 21 const GURL& request_origin, | 23 const GURL& request_origin, |
| 22 content::PermissionType permission_type, | 24 content::PermissionType permission_type, |
| 23 Profile* profile, | 25 Profile* profile, |
| 24 bool has_gesture, | 26 bool has_gesture, |
| 25 const PermissionDecidedCallback& permission_decided_callback, | 27 const PermissionDecidedCallback& permission_decided_callback, |
| 26 const base::Closure delete_callback) | 28 const base::Closure delete_callback) |
| 27 : request_origin_(request_origin), | 29 : request_origin_(request_origin), |
| (...skipping 27 matching lines...) Expand all Loading... |
| 55 return IDR_ANDROID_INFOBAR_MIDI; | 57 return IDR_ANDROID_INFOBAR_MIDI; |
| 56 case content::PermissionType::PROTECTED_MEDIA_IDENTIFIER: | 58 case content::PermissionType::PROTECTED_MEDIA_IDENTIFIER: |
| 57 return IDR_ANDROID_INFOBAR_PROTECTED_MEDIA_IDENTIFIER; | 59 return IDR_ANDROID_INFOBAR_PROTECTED_MEDIA_IDENTIFIER; |
| 58 default: | 60 default: |
| 59 NOTREACHED(); | 61 NOTREACHED(); |
| 60 return IDR_ANDROID_INFOBAR_WARNING; | 62 return IDR_ANDROID_INFOBAR_WARNING; |
| 61 } | 63 } |
| 62 #else | 64 #else |
| 63 switch (permission_type_) { | 65 switch (permission_type_) { |
| 64 case content::PermissionType::GEOLOCATION: | 66 case content::PermissionType::GEOLOCATION: |
| 65 return gfx::VectorIconId::LOCATION_ON; | 67 return ui::kLocationOnIcon; |
| 66 case content::PermissionType::NOTIFICATIONS: | 68 case content::PermissionType::NOTIFICATIONS: |
| 67 case content::PermissionType::PUSH_MESSAGING: | 69 case content::PermissionType::PUSH_MESSAGING: |
| 68 return gfx::VectorIconId::NOTIFICATIONS; | 70 return ui::kNotificationsIcon; |
| 69 #if defined(OS_CHROMEOS) | 71 #if defined(OS_CHROMEOS) |
| 70 // TODO(xhwang): fix this icon, see crrev.com/863263007 | 72 // TODO(xhwang): fix this icon, see crrev.com/863263007 |
| 71 case content::PermissionType::PROTECTED_MEDIA_IDENTIFIER: | 73 case content::PermissionType::PROTECTED_MEDIA_IDENTIFIER: |
| 72 return gfx::VectorIconId::PRODUCT; | 74 return kProductIcon; |
| 73 #endif | 75 #endif |
| 74 case content::PermissionType::MIDI_SYSEX: | 76 case content::PermissionType::MIDI_SYSEX: |
| 75 return gfx::VectorIconId::MIDI; | 77 return ui::kMidiIcon; |
| 76 case content::PermissionType::FLASH: | 78 case content::PermissionType::FLASH: |
| 77 return gfx::VectorIconId::EXTENSION; | 79 return ui::kExtensionIcon; |
| 78 default: | 80 default: |
| 79 NOTREACHED(); | 81 NOTREACHED(); |
| 80 return gfx::VectorIconId::VECTOR_ICON_NONE; | 82 return ui::kExtensionIcon; |
| 81 } | 83 } |
| 82 #endif | 84 #endif |
| 83 } | 85 } |
| 84 | 86 |
| 85 base::string16 PermissionRequestImpl::GetMessageTextFragment() const { | 87 base::string16 PermissionRequestImpl::GetMessageTextFragment() const { |
| 86 int message_id; | 88 int message_id; |
| 87 switch (permission_type_) { | 89 switch (permission_type_) { |
| 88 case content::PermissionType::GEOLOCATION: | 90 case content::PermissionType::GEOLOCATION: |
| 89 message_id = IDS_GEOLOCATION_INFOBAR_PERMISSION_FRAGMENT; | 91 message_id = IDS_GEOLOCATION_INFOBAR_PERMISSION_FRAGMENT; |
| 90 break; | 92 break; |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 case content::PermissionType::PROTECTED_MEDIA_IDENTIFIER: | 164 case content::PermissionType::PROTECTED_MEDIA_IDENTIFIER: |
| 163 return CONTENT_SETTINGS_TYPE_PROTECTED_MEDIA_IDENTIFIER; | 165 return CONTENT_SETTINGS_TYPE_PROTECTED_MEDIA_IDENTIFIER; |
| 164 #endif | 166 #endif |
| 165 case content::PermissionType::FLASH: | 167 case content::PermissionType::FLASH: |
| 166 return CONTENT_SETTINGS_TYPE_PLUGINS; | 168 return CONTENT_SETTINGS_TYPE_PLUGINS; |
| 167 default: | 169 default: |
| 168 NOTREACHED(); | 170 NOTREACHED(); |
| 169 return CONTENT_SETTINGS_TYPE_DEFAULT; | 171 return CONTENT_SETTINGS_TYPE_DEFAULT; |
| 170 } | 172 } |
| 171 } | 173 } |
| OLD | NEW |