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_infobar_delegate.h" | 5 #include "chrome/browser/permissions/permission_infobar_delegate.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "build/build_config.h" | 9 #include "build/build_config.h" |
10 #include "chrome/browser/geolocation/geolocation_infobar_delegate_android.h" | 10 #include "chrome/browser/geolocation/geolocation_infobar_delegate_android.h" |
11 #include "chrome/browser/infobars/infobar_service.h" | 11 #include "chrome/browser/infobars/infobar_service.h" |
12 #include "chrome/browser/media/midi_permission_infobar_delegate_android.h" | 12 #include "chrome/browser/media/midi_permission_infobar_delegate_android.h" |
13 #include "chrome/browser/media/protected_media_identifier_infobar_delegate_andro id.h" | 13 #include "chrome/browser/media/protected_media_identifier_infobar_delegate_andro id.h" |
14 #include "chrome/browser/notifications/notification_permission_infobar_delegate. h" | 14 #include "chrome/browser/notifications/notification_permission_infobar_delegate. h" |
15 #include "chrome/browser/payments/payment_handler_permission_infobar_delegate.h" | |
15 #include "chrome/browser/permissions/permission_decision_auto_blocker.h" | 16 #include "chrome/browser/permissions/permission_decision_auto_blocker.h" |
16 #include "chrome/browser/permissions/permission_request.h" | 17 #include "chrome/browser/permissions/permission_request.h" |
17 #include "chrome/browser/permissions/permission_uma_util.h" | 18 #include "chrome/browser/permissions/permission_uma_util.h" |
18 #include "chrome/grit/generated_resources.h" | 19 #include "chrome/grit/generated_resources.h" |
19 #include "components/infobars/core/infobar.h" | 20 #include "components/infobars/core/infobar.h" |
20 #include "components/url_formatter/elide_url.h" | 21 #include "components/url_formatter/elide_url.h" |
21 #include "content/public/browser/web_contents.h" | 22 #include "content/public/browser/web_contents.h" |
22 #include "ui/base/l10n/l10n_util.h" | 23 #include "ui/base/l10n/l10n_util.h" |
23 | 24 |
24 // static | 25 // static |
(...skipping 18 matching lines...) Expand all Loading... | |
43 // static | 44 // static |
44 std::unique_ptr<PermissionInfoBarDelegate> | 45 std::unique_ptr<PermissionInfoBarDelegate> |
45 PermissionInfoBarDelegate::CreateDelegate( | 46 PermissionInfoBarDelegate::CreateDelegate( |
46 ContentSettingsType type, | 47 ContentSettingsType type, |
47 const GURL& requesting_frame, | 48 const GURL& requesting_frame, |
48 bool user_gesture, | 49 bool user_gesture, |
49 Profile* profile, | 50 Profile* profile, |
50 const PermissionSetCallback& callback) { | 51 const PermissionSetCallback& callback) { |
51 switch (type) { | 52 switch (type) { |
52 case CONTENT_SETTINGS_TYPE_GEOLOCATION: | 53 case CONTENT_SETTINGS_TYPE_GEOLOCATION: |
53 return std::unique_ptr<PermissionInfoBarDelegate>( | 54 return std::unique_ptr<PermissionInfoBarDelegate>( |
please use gerrit instead
2017/06/20 13:28:09
Since you're already here, please change all these
zino
2017/06/22 17:26:43
Done.
| |
54 new GeolocationInfoBarDelegateAndroid( | 55 new GeolocationInfoBarDelegateAndroid( |
55 requesting_frame, user_gesture, profile, callback)); | 56 requesting_frame, user_gesture, profile, callback)); |
56 case CONTENT_SETTINGS_TYPE_NOTIFICATIONS: | 57 case CONTENT_SETTINGS_TYPE_NOTIFICATIONS: |
57 case CONTENT_SETTINGS_TYPE_PUSH_MESSAGING: | 58 case CONTENT_SETTINGS_TYPE_PUSH_MESSAGING: |
58 return std::unique_ptr<PermissionInfoBarDelegate>( | 59 return std::unique_ptr<PermissionInfoBarDelegate>( |
59 new NotificationPermissionInfoBarDelegate( | 60 new NotificationPermissionInfoBarDelegate( |
60 type, requesting_frame, user_gesture, profile, callback)); | 61 type, requesting_frame, user_gesture, profile, callback)); |
61 case CONTENT_SETTINGS_TYPE_MIDI_SYSEX: | 62 case CONTENT_SETTINGS_TYPE_MIDI_SYSEX: |
62 return std::unique_ptr<PermissionInfoBarDelegate>( | 63 return std::unique_ptr<PermissionInfoBarDelegate>( |
63 new MidiPermissionInfoBarDelegateAndroid( | 64 new MidiPermissionInfoBarDelegateAndroid( |
64 requesting_frame, user_gesture, profile, callback)); | 65 requesting_frame, user_gesture, profile, callback)); |
65 case CONTENT_SETTINGS_TYPE_PROTECTED_MEDIA_IDENTIFIER: | 66 case CONTENT_SETTINGS_TYPE_PROTECTED_MEDIA_IDENTIFIER: |
66 return std::unique_ptr<PermissionInfoBarDelegate>( | 67 return std::unique_ptr<PermissionInfoBarDelegate>( |
67 new ProtectedMediaIdentifierInfoBarDelegateAndroid( | 68 new ProtectedMediaIdentifierInfoBarDelegateAndroid( |
68 requesting_frame, user_gesture, profile, callback)); | 69 requesting_frame, user_gesture, profile, callback)); |
70 case CONTENT_SETTINGS_TYPE_PAYMENT_HANDLER: | |
71 return std::unique_ptr<PermissionInfoBarDelegate>( | |
72 new PaymentHandlerPermissionInfoBarDelegate( | |
please use gerrit instead
2017/06/20 13:28:09
return base::MakeUnique<PaymentHandlerPermissionIn
zino
2017/06/22 17:26:43
Done.
| |
73 requesting_frame, user_gesture, profile, callback)); | |
69 default: | 74 default: |
70 NOTREACHED(); | 75 NOTREACHED(); |
71 return nullptr; | 76 return nullptr; |
72 } | 77 } |
73 } | 78 } |
74 | 79 |
75 PermissionInfoBarDelegate::~PermissionInfoBarDelegate() { | 80 PermissionInfoBarDelegate::~PermissionInfoBarDelegate() { |
76 if (!action_taken_) { | 81 if (!action_taken_) { |
77 PermissionUmaUtil::PermissionIgnored( | 82 PermissionUmaUtil::PermissionIgnored( |
78 content_settings_type_, | 83 content_settings_type_, |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
163 PermissionInfoBarDelegate* | 168 PermissionInfoBarDelegate* |
164 PermissionInfoBarDelegate::AsPermissionInfoBarDelegate() { | 169 PermissionInfoBarDelegate::AsPermissionInfoBarDelegate() { |
165 return this; | 170 return this; |
166 } | 171 } |
167 | 172 |
168 void PermissionInfoBarDelegate::SetPermission(bool update_content_setting, | 173 void PermissionInfoBarDelegate::SetPermission(bool update_content_setting, |
169 PermissionAction decision) { | 174 PermissionAction decision) { |
170 action_taken_ = true; | 175 action_taken_ = true; |
171 callback_.Run(update_content_setting, decision); | 176 callback_.Run(update_content_setting, decision); |
172 } | 177 } |
OLD | NEW |