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

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

Issue 2946013002: PaymentHandler: Implement requestPermission().
Patch Set: PaymentHandler: Implement requestPermission(). Created 3 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_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
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 base::MakeUnique<GeolocationInfoBarDelegateAndroid>(
54 new GeolocationInfoBarDelegateAndroid( 55 requesting_frame, user_gesture, profile, callback);
55 requesting_frame, user_gesture, profile, callback));
56 case CONTENT_SETTINGS_TYPE_NOTIFICATIONS: 56 case CONTENT_SETTINGS_TYPE_NOTIFICATIONS:
57 case CONTENT_SETTINGS_TYPE_PUSH_MESSAGING: 57 case CONTENT_SETTINGS_TYPE_PUSH_MESSAGING:
58 return std::unique_ptr<PermissionInfoBarDelegate>( 58 return base
59 new NotificationPermissionInfoBarDelegate( 59 : MakeUnique<NotificationPermissionInfoBarDelegate>(
60 type, requesting_frame, user_gesture, profile, callback)); 60 type, requesting_frame, user_gesture, profile, callback);
61 case CONTENT_SETTINGS_TYPE_MIDI_SYSEX: 61 case CONTENT_SETTINGS_TYPE_MIDI_SYSEX:
62 return std::unique_ptr<PermissionInfoBarDelegate>( 62 return base : MakeUnique<MidiPermissionInfoBarDelegateAndroid>(
63 new MidiPermissionInfoBarDelegateAndroid( 63 requesting_frame, user_gesture, profile, callback);
64 requesting_frame, user_gesture, profile, callback));
65 case CONTENT_SETTINGS_TYPE_PROTECTED_MEDIA_IDENTIFIER: 64 case CONTENT_SETTINGS_TYPE_PROTECTED_MEDIA_IDENTIFIER:
66 return std::unique_ptr<PermissionInfoBarDelegate>( 65 return base : MakeUnique<ProtectedMediaIdentifierInfoBarDelegateAndroid>(
67 new ProtectedMediaIdentifierInfoBarDelegateAndroid( 66 requesting_frame, user_gesture, profile, callback);
68 requesting_frame, user_gesture, profile, callback)); 67 case CONTENT_SETTINGS_TYPE_PAYMENT_HANDLER:
68 return base : MakeUnique<PaymentHandlerPermissionInfoBarDelegate>(
69 requesting_frame, user_gesture, profile, callback);
69 default: 70 default:
70 NOTREACHED(); 71 NOTREACHED();
71 return nullptr; 72 return nullptr;
72 } 73 }
73 } 74 }
74 75
75 PermissionInfoBarDelegate::~PermissionInfoBarDelegate() { 76 PermissionInfoBarDelegate::~PermissionInfoBarDelegate() {
76 if (!action_taken_) { 77 if (!action_taken_) {
77 PermissionUmaUtil::PermissionIgnored( 78 PermissionUmaUtil::PermissionIgnored(
78 content_settings_type_, 79 content_settings_type_,
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 PermissionInfoBarDelegate* 164 PermissionInfoBarDelegate*
164 PermissionInfoBarDelegate::AsPermissionInfoBarDelegate() { 165 PermissionInfoBarDelegate::AsPermissionInfoBarDelegate() {
165 return this; 166 return this;
166 } 167 }
167 168
168 void PermissionInfoBarDelegate::SetPermission(bool update_content_setting, 169 void PermissionInfoBarDelegate::SetPermission(bool update_content_setting,
169 PermissionAction decision) { 170 PermissionAction decision) {
170 action_taken_ = true; 171 action_taken_ = true;
171 callback_.Run(update_content_setting, decision); 172 callback_.Run(update_content_setting, decision);
172 } 173 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698