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_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/elide_url.h" | 10 #include "components/url_formatter/elide_url.h" |
| (...skipping 28 matching lines...) Expand all Loading... | |
| 39 gfx::VectorIconId PermissionBubbleRequestImpl::GetVectorIconId() const { | 39 gfx::VectorIconId PermissionBubbleRequestImpl::GetVectorIconId() const { |
| 40 #if defined(TOOLKIT_VIEWS) | 40 #if defined(TOOLKIT_VIEWS) |
| 41 switch (type_) { | 41 switch (type_) { |
| 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 // TODO(xhwang): fix this icon, see crrev.com/863263007 | |
| 49 case CONTENT_SETTINGS_TYPE_PROTECTED_MEDIA_IDENTIFIER: | 50 case CONTENT_SETTINGS_TYPE_PROTECTED_MEDIA_IDENTIFIER: |
| 51 return gfx::VectorIconId::CHROME_PRODUCT; | |
| 50 #endif | 52 #endif |
| 51 case CONTENT_SETTINGS_TYPE_MIDI_SYSEX: | 53 case CONTENT_SETTINGS_TYPE_MIDI_SYSEX: |
| 52 case CONTENT_SETTINGS_TYPE_DURABLE_STORAGE: | 54 return gfx::VectorIconId::MIDI; |
| 53 // TODO(estade): add vector icons for these. | |
| 54 return gfx::VectorIconId::VECTOR_ICON_NONE; | |
| 55 default: | 55 default: |
| 56 NOTREACHED(); | 56 NOTREACHED(); |
| 57 return gfx::VectorIconId::VECTOR_ICON_NONE; | 57 return gfx::VectorIconId::VECTOR_ICON_NONE; |
| 58 } | 58 } |
| 59 #else // !defined(TOOLKIT_VIEWS) | 59 #else // !defined(TOOLKIT_VIEWS) |
| 60 return gfx::VectorIconId::VECTOR_ICON_NONE; | 60 return gfx::VectorIconId::VECTOR_ICON_NONE; |
| 61 #endif | 61 #endif |
| 62 } | 62 } |
| 63 | 63 |
| 64 int PermissionBubbleRequestImpl::GetIconId() const { | 64 int PermissionBubbleRequestImpl::GetIconId() const { |
| 65 int icon_id; | 65 int icon_id = IDR_INFOBAR_WARNING; |
| 66 #if !defined(TOOLKIT_VIEWS) | |
| 66 switch (type_) { | 67 switch (type_) { |
| 67 case CONTENT_SETTINGS_TYPE_GEOLOCATION: | 68 case CONTENT_SETTINGS_TYPE_GEOLOCATION: |
| 68 icon_id = IDR_INFOBAR_GEOLOCATION; | 69 icon_id = IDR_INFOBAR_GEOLOCATION; |
| 69 break; | 70 break; |
| 70 #if defined(ENABLE_NOTIFICATIONS) | 71 #if defined(ENABLE_NOTIFICATIONS) |
| 71 case CONTENT_SETTINGS_TYPE_NOTIFICATIONS: | 72 case CONTENT_SETTINGS_TYPE_NOTIFICATIONS: |
| 72 icon_id = IDR_INFOBAR_DESKTOP_NOTIFICATIONS; | 73 icon_id = IDR_INFOBAR_DESKTOP_NOTIFICATIONS; |
| 73 break; | 74 break; |
| 74 #endif | 75 #endif |
| 75 case CONTENT_SETTINGS_TYPE_MIDI_SYSEX: | 76 case CONTENT_SETTINGS_TYPE_MIDI_SYSEX: |
| 76 icon_id = IDR_ALLOWED_MIDI_SYSEX; | 77 icon_id = IDR_ALLOWED_MIDI_SYSEX; |
| 77 break; | 78 break; |
| 78 #if defined(OS_CHROMEOS) | |
|
sky
2015/10/02 23:26:39
How come it's safe to remove this?
Evan Stade
2015/10/05 18:42:52
For Cros the icon always comes from GetVectorIconI
| |
| 79 case CONTENT_SETTINGS_TYPE_PROTECTED_MEDIA_IDENTIFIER: | |
| 80 icon_id = IDR_INFOBAR_PROTECTED_MEDIA_IDENTIFIER; | |
| 81 break; | |
| 82 #endif | |
| 83 default: | 79 default: |
| 84 NOTREACHED(); | 80 NOTREACHED(); |
| 85 return IDR_INFOBAR_WARNING; | |
| 86 } | 81 } |
| 82 #endif | |
| 87 return icon_id; | 83 return icon_id; |
| 88 } | 84 } |
| 89 | 85 |
| 90 base::string16 PermissionBubbleRequestImpl::GetMessageText() const { | 86 base::string16 PermissionBubbleRequestImpl::GetMessageText() const { |
| 91 int message_id; | 87 int message_id; |
| 92 switch (type_) { | 88 switch (type_) { |
| 93 case CONTENT_SETTINGS_TYPE_GEOLOCATION: | 89 case CONTENT_SETTINGS_TYPE_GEOLOCATION: |
| 94 message_id = IDS_GEOLOCATION_INFOBAR_QUESTION; | 90 message_id = IDS_GEOLOCATION_INFOBAR_QUESTION; |
| 95 break; | 91 break; |
| 96 #if defined(ENABLE_NOTIFICATIONS) | 92 #if defined(ENABLE_NOTIFICATIONS) |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 170 | 166 |
| 171 void PermissionBubbleRequestImpl::Cancelled() { | 167 void PermissionBubbleRequestImpl::Cancelled() { |
| 172 RegisterActionTaken(); | 168 RegisterActionTaken(); |
| 173 permission_decided_callback_.Run(false, CONTENT_SETTING_DEFAULT); | 169 permission_decided_callback_.Run(false, CONTENT_SETTING_DEFAULT); |
| 174 } | 170 } |
| 175 | 171 |
| 176 void PermissionBubbleRequestImpl::RequestFinished() { | 172 void PermissionBubbleRequestImpl::RequestFinished() { |
| 177 is_finished_ = true; | 173 is_finished_ = true; |
| 178 delete_callback_.Run(); | 174 delete_callback_.Run(); |
| 179 } | 175 } |
| OLD | NEW |