Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(14)

Side by Side Diff: chrome/browser/permissions/permission_bubble_request_impl.cc

Issue 2162033002: Revert "Use the same codepath for NOTIFICATIONS and PUSH_MESSAGING permissions" (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "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
34 nullptr); 34 nullptr);
35 } 35 }
36 36
37 gfx::VectorIconId PermissionBubbleRequestImpl::GetVectorIconId() const { 37 gfx::VectorIconId PermissionBubbleRequestImpl::GetVectorIconId() const {
38 #if !defined(OS_MACOSX) 38 #if !defined(OS_MACOSX)
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:
45 return gfx::VectorIconId::NOTIFICATIONS; 44 return gfx::VectorIconId::NOTIFICATIONS;
46 #endif 45 #endif
47 #if defined(OS_CHROMEOS) 46 #if defined(OS_CHROMEOS)
48 // TODO(xhwang): fix this icon, see crrev.com/863263007 47 // TODO(xhwang): fix this icon, see crrev.com/863263007
49 case content::PermissionType::PROTECTED_MEDIA_IDENTIFIER: 48 case content::PermissionType::PROTECTED_MEDIA_IDENTIFIER:
50 return gfx::VectorIconId::CHROME_PRODUCT; 49 return gfx::VectorIconId::CHROME_PRODUCT;
51 #endif 50 #endif
52 case content::PermissionType::MIDI_SYSEX: 51 case content::PermissionType::MIDI_SYSEX:
53 return gfx::VectorIconId::MIDI; 52 return gfx::VectorIconId::MIDI;
54 default: 53 default:
55 NOTREACHED(); 54 NOTREACHED();
56 return gfx::VectorIconId::VECTOR_ICON_NONE; 55 return gfx::VectorIconId::VECTOR_ICON_NONE;
57 } 56 }
58 #else // !defined(OS_MACOSX) 57 #else // !defined(OS_MACOSX)
59 return gfx::VectorIconId::VECTOR_ICON_NONE; 58 return gfx::VectorIconId::VECTOR_ICON_NONE;
60 #endif 59 #endif
61 } 60 }
62 61
63 int PermissionBubbleRequestImpl::GetIconId() const { 62 int PermissionBubbleRequestImpl::GetIconId() const {
64 int icon_id = IDR_INFOBAR_WARNING; 63 int icon_id = IDR_INFOBAR_WARNING;
65 #if defined(OS_MACOSX) 64 #if defined(OS_MACOSX)
66 switch (permission_type_) { 65 switch (permission_type_) {
67 case content::PermissionType::GEOLOCATION: 66 case content::PermissionType::GEOLOCATION:
68 icon_id = IDR_INFOBAR_GEOLOCATION; 67 icon_id = IDR_INFOBAR_GEOLOCATION;
69 break; 68 break;
70 #if defined(ENABLE_NOTIFICATIONS) 69 #if defined(ENABLE_NOTIFICATIONS)
71 case content::PermissionType::NOTIFICATIONS: 70 case content::PermissionType::NOTIFICATIONS:
72 case content::PermissionType::PUSH_MESSAGING:
73 icon_id = IDR_INFOBAR_DESKTOP_NOTIFICATIONS; 71 icon_id = IDR_INFOBAR_DESKTOP_NOTIFICATIONS;
74 break; 72 break;
75 #endif 73 #endif
76 case content::PermissionType::MIDI_SYSEX: 74 case content::PermissionType::MIDI_SYSEX:
77 icon_id = IDR_ALLOWED_MIDI_SYSEX; 75 icon_id = IDR_ALLOWED_MIDI_SYSEX;
78 break; 76 break;
79 default: 77 default:
80 NOTREACHED(); 78 NOTREACHED();
81 } 79 }
82 #endif 80 #endif
83 return icon_id; 81 return icon_id;
84 } 82 }
85 83
86 base::string16 PermissionBubbleRequestImpl::GetMessageTextFragment() const { 84 base::string16 PermissionBubbleRequestImpl::GetMessageTextFragment() const {
87 int message_id; 85 int message_id;
88 switch (permission_type_) { 86 switch (permission_type_) {
89 case content::PermissionType::GEOLOCATION: 87 case content::PermissionType::GEOLOCATION:
90 message_id = IDS_GEOLOCATION_INFOBAR_PERMISSION_FRAGMENT; 88 message_id = IDS_GEOLOCATION_INFOBAR_PERMISSION_FRAGMENT;
91 break; 89 break;
92 #if defined(ENABLE_NOTIFICATIONS) 90 #if defined(ENABLE_NOTIFICATIONS)
93 case content::PermissionType::NOTIFICATIONS: 91 case content::PermissionType::NOTIFICATIONS:
94 case content::PermissionType::PUSH_MESSAGING:
95 message_id = IDS_NOTIFICATION_PERMISSIONS_FRAGMENT; 92 message_id = IDS_NOTIFICATION_PERMISSIONS_FRAGMENT;
96 break; 93 break;
97 #endif 94 #endif
98 case content::PermissionType::MIDI_SYSEX: 95 case content::PermissionType::MIDI_SYSEX:
99 message_id = IDS_MIDI_SYSEX_PERMISSION_FRAGMENT; 96 message_id = IDS_MIDI_SYSEX_PERMISSION_FRAGMENT;
100 break; 97 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
149 return PermissionBubbleType::PERMISSION_PUSH_MESSAGING; 149 return PermissionBubbleType::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 PermissionBubbleType::PERMISSION_PROTECTED_MEDIA_IDENTIFIER; 152 return PermissionBubbleType::PERMISSION_PROTECTED_MEDIA_IDENTIFIER;
153 #endif 153 #endif
154 default: 154 default:
155 NOTREACHED(); 155 NOTREACHED();
156 return PermissionBubbleType::UNKNOWN; 156 return PermissionBubbleType::UNKNOWN;
157 } 157 }
158 } 158 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698