Chromium Code Reviews| 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 25 matching lines...) Expand all Loading... | |
| 53 return IDR_ANDROID_INFOBAR_MIDI; | 55 return IDR_ANDROID_INFOBAR_MIDI; |
| 54 case content::PermissionType::PROTECTED_MEDIA_IDENTIFIER: | 56 case content::PermissionType::PROTECTED_MEDIA_IDENTIFIER: |
| 55 return IDR_ANDROID_INFOBAR_PROTECTED_MEDIA_IDENTIFIER; | 57 return IDR_ANDROID_INFOBAR_PROTECTED_MEDIA_IDENTIFIER; |
| 56 default: | 58 default: |
| 57 NOTREACHED(); | 59 NOTREACHED(); |
| 58 return IDR_ANDROID_INFOBAR_WARNING; | 60 return IDR_ANDROID_INFOBAR_WARNING; |
| 59 } | 61 } |
| 60 #else | 62 #else |
| 61 switch (permission_type_) { | 63 switch (permission_type_) { |
| 62 case content::PermissionType::GEOLOCATION: | 64 case content::PermissionType::GEOLOCATION: |
| 63 return gfx::VectorIconId::LOCATION_ON; | 65 return ui::kLocationOnIcon; |
| 64 case content::PermissionType::NOTIFICATIONS: | 66 case content::PermissionType::NOTIFICATIONS: |
| 65 case content::PermissionType::PUSH_MESSAGING: | 67 case content::PermissionType::PUSH_MESSAGING: |
| 66 return gfx::VectorIconId::NOTIFICATIONS; | 68 return ui::kNotificationsIcon; |
| 67 #if defined(OS_CHROMEOS) | 69 #if defined(OS_CHROMEOS) |
| 68 // TODO(xhwang): fix this icon, see crrev.com/863263007 | 70 // TODO(xhwang): fix this icon, see crrev.com/863263007 |
| 69 case content::PermissionType::PROTECTED_MEDIA_IDENTIFIER: | 71 case content::PermissionType::PROTECTED_MEDIA_IDENTIFIER: |
| 70 return gfx::VectorIconId::PRODUCT; | 72 return kProductIcon; |
| 71 #endif | 73 #endif |
| 72 case content::PermissionType::MIDI_SYSEX: | 74 case content::PermissionType::MIDI_SYSEX: |
| 73 return gfx::VectorIconId::MIDI; | 75 return ui::kMidiIcon; |
| 74 case content::PermissionType::FLASH: | 76 case content::PermissionType::FLASH: |
| 75 return gfx::VectorIconId::EXTENSION; | 77 return ui::kExtensionIcon; |
| 76 default: | 78 default: |
| 77 NOTREACHED(); | 79 NOTREACHED(); |
| 78 return gfx::VectorIconId::VECTOR_ICON_NONE; | 80 return ui::kExtensionIcon; |
|
sky
2017/02/13 21:35:38
How come this is using ExtensionIcon?
Evan Stade
2017/02/13 21:53:33
just as a placeholder; it shouldn't be hit.
| |
| 79 } | 81 } |
| 80 #endif | 82 #endif |
| 81 } | 83 } |
| 82 | 84 |
| 83 base::string16 PermissionRequestImpl::GetMessageTextFragment() const { | 85 base::string16 PermissionRequestImpl::GetMessageTextFragment() const { |
| 84 int message_id; | 86 int message_id; |
| 85 switch (permission_type_) { | 87 switch (permission_type_) { |
| 86 case content::PermissionType::GEOLOCATION: | 88 case content::PermissionType::GEOLOCATION: |
| 87 message_id = IDS_GEOLOCATION_INFOBAR_PERMISSION_FRAGMENT; | 89 message_id = IDS_GEOLOCATION_INFOBAR_PERMISSION_FRAGMENT; |
| 88 break; | 90 break; |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 160 case content::PermissionType::PROTECTED_MEDIA_IDENTIFIER: | 162 case content::PermissionType::PROTECTED_MEDIA_IDENTIFIER: |
| 161 return CONTENT_SETTINGS_TYPE_PROTECTED_MEDIA_IDENTIFIER; | 163 return CONTENT_SETTINGS_TYPE_PROTECTED_MEDIA_IDENTIFIER; |
| 162 #endif | 164 #endif |
| 163 case content::PermissionType::FLASH: | 165 case content::PermissionType::FLASH: |
| 164 return CONTENT_SETTINGS_TYPE_PLUGINS; | 166 return CONTENT_SETTINGS_TYPE_PLUGINS; |
| 165 default: | 167 default: |
| 166 NOTREACHED(); | 168 NOTREACHED(); |
| 167 return CONTENT_SETTINGS_TYPE_DEFAULT; | 169 return CONTENT_SETTINGS_TYPE_DEFAULT; |
| 168 } | 170 } |
| 169 } | 171 } |
| OLD | NEW |