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

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

Issue 2382563003: Remove some more desktop infobar PNGs. (Closed)
Patch Set: this will eventually compile Created 4 years, 2 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_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/android/android_theme_resources.h"
8 #include "chrome/browser/permissions/permission_decision_auto_blocker.h" 9 #include "chrome/browser/permissions/permission_decision_auto_blocker.h"
9 #include "chrome/browser/permissions/permission_uma_util.h" 10 #include "chrome/browser/permissions/permission_uma_util.h"
10 #include "chrome/browser/permissions/permission_util.h" 11 #include "chrome/browser/permissions/permission_util.h"
11 #include "chrome/grit/generated_resources.h" 12 #include "chrome/grit/generated_resources.h"
12 #include "chrome/grit/theme_resources.h" 13 #include "chrome/grit/theme_resources.h"
13 #include "components/url_formatter/elide_url.h" 14 #include "components/url_formatter/elide_url.h"
14 #include "net/base/escape.h" 15 #include "net/base/escape.h"
15 #include "ui/base/l10n/l10n_util.h" 16 #include "ui/base/l10n/l10n_util.h"
16 #include "ui/gfx/vector_icons_public.h" 17 #include "ui/gfx/vector_icons_public.h"
17 18
(...skipping 15 matching lines...) Expand all
33 34
34 PermissionRequestImpl::~PermissionRequestImpl() { 35 PermissionRequestImpl::~PermissionRequestImpl() {
35 DCHECK(is_finished_); 36 DCHECK(is_finished_);
36 if (!action_taken_) { 37 if (!action_taken_) {
37 PermissionUmaUtil::PermissionIgnored(permission_type_, GetGestureType(), 38 PermissionUmaUtil::PermissionIgnored(permission_type_, GetGestureType(),
38 request_origin_, profile_); 39 request_origin_, profile_);
39 } 40 }
40 } 41 }
41 42
42 gfx::VectorIconId PermissionRequestImpl::GetVectorIconId() const { 43 gfx::VectorIconId PermissionRequestImpl::GetVectorIconId() const {
43 #if !defined(OS_MACOSX) && !defined(OS_ANDROID) 44 #if !defined(OS_ANDROID)
Peter Kasting 2016/10/05 01:13:13 Nit: Reverse to avoid double-negative in "else":
Evan Stade 2016/10/05 17:42:29 Done.
44 switch (permission_type_) { 45 switch (permission_type_) {
45 case content::PermissionType::GEOLOCATION: 46 case content::PermissionType::GEOLOCATION:
46 return gfx::VectorIconId::LOCATION_ON; 47 return gfx::VectorIconId::LOCATION_ON;
47 #if defined(ENABLE_NOTIFICATIONS) 48 #if defined(ENABLE_NOTIFICATIONS)
48 case content::PermissionType::NOTIFICATIONS: 49 case content::PermissionType::NOTIFICATIONS:
49 case content::PermissionType::PUSH_MESSAGING: 50 case content::PermissionType::PUSH_MESSAGING:
50 return gfx::VectorIconId::NOTIFICATIONS; 51 return gfx::VectorIconId::NOTIFICATIONS;
51 #endif 52 #endif
52 #if defined(OS_CHROMEOS) 53 #if defined(OS_CHROMEOS)
53 // TODO(xhwang): fix this icon, see crrev.com/863263007 54 // TODO(xhwang): fix this icon, see crrev.com/863263007
54 case content::PermissionType::PROTECTED_MEDIA_IDENTIFIER: 55 case content::PermissionType::PROTECTED_MEDIA_IDENTIFIER:
55 return gfx::VectorIconId::CHROME_PRODUCT; 56 return gfx::VectorIconId::CHROME_PRODUCT;
56 #endif 57 #endif
57 case content::PermissionType::MIDI_SYSEX: 58 case content::PermissionType::MIDI_SYSEX:
58 return gfx::VectorIconId::MIDI; 59 return gfx::VectorIconId::MIDI;
59 case content::PermissionType::FLASH: 60 case content::PermissionType::FLASH:
60 return gfx::VectorIconId::EXTENSION; 61 return gfx::VectorIconId::EXTENSION;
61 default: 62 default:
62 NOTREACHED(); 63 NOTREACHED();
63 return gfx::VectorIconId::VECTOR_ICON_NONE; 64 return gfx::VectorIconId::VECTOR_ICON_NONE;
64 } 65 }
65 #else // !defined(OS_MACOSX) && !defined(OS_ANDROID) 66 #else // !defined(OS_ANDROID)
66 return gfx::VectorIconId::VECTOR_ICON_NONE; 67 return gfx::VectorIconId::VECTOR_ICON_NONE;
67 #endif 68 #endif
68 } 69 }
69 70
70 int PermissionRequestImpl::GetIconId() const { 71 int PermissionRequestImpl::GetIconId() const {
71 int icon_id = IDR_INFOBAR_WARNING; 72 int icon_id = 0;
72 #if defined(OS_MACOSX) || defined(OS_ANDROID) 73 #if defined(OS_ANDROID)
Peter Kasting 2016/10/05 01:13:13 Nit: Maybe put the entire function (and declaratio
Evan Stade 2016/10/05 17:42:29 done I'm not entirely sure this is even necessary
73 switch (permission_type_) { 74 switch (permission_type_) {
74 case content::PermissionType::GEOLOCATION: 75 case content::PermissionType::GEOLOCATION:
75 icon_id = IDR_INFOBAR_GEOLOCATION; 76 icon_id = IDR_ANDROID_INFOBAR_GEOLOCATION;
76 break; 77 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: 78 case content::PermissionType::MIDI_SYSEX:
84 icon_id = IDR_ALLOWED_MIDI_SYSEX; 79 icon_id = IDR_ALLOWED_MIDI_SYSEX;
85 break; 80 break;
86 case content::PermissionType::FLASH: 81 case content::PermissionType::FLASH:
87 icon_id = IDR_ALLOWED_PLUGINS; 82 icon_id = IDR_ALLOWED_PLUGINS;
88 break; 83 break;
89 default: 84 default:
90 NOTREACHED(); 85 NOTREACHED();
91 } 86 }
92 #endif 87 #endif
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 NOTREACHED(); 170 NOTREACHED();
176 return PermissionRequestType::UNKNOWN; 171 return PermissionRequestType::UNKNOWN;
177 } 172 }
178 } 173 }
179 174
180 PermissionRequestGestureType PermissionRequestImpl::GetGestureType() 175 PermissionRequestGestureType PermissionRequestImpl::GetGestureType()
181 const { 176 const {
182 return has_gesture_ ? PermissionRequestGestureType::GESTURE 177 return has_gesture_ ? PermissionRequestGestureType::GESTURE
183 : PermissionRequestGestureType::NO_GESTURE; 178 : PermissionRequestGestureType::NO_GESTURE;
184 } 179 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698