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/notifications/notification_permission_infobar_delegate.
h" | 5 #include "chrome/browser/notifications/notification_permission_infobar_delegate.
h" |
6 | 6 |
7 #include "chrome/browser/android/android_theme_resources.h" | 7 #include "chrome/browser/android/android_theme_resources.h" |
8 #include "chrome/browser/infobars/infobar_service.h" | 8 #include "chrome/browser/infobars/infobar_service.h" |
9 #include "chrome/grit/generated_resources.h" | 9 #include "chrome/grit/generated_resources.h" |
10 #include "components/infobars/core/infobar.h" | 10 #include "components/infobars/core/infobar.h" |
11 | 11 |
12 // static | 12 // static |
13 infobars::InfoBar* NotificationPermissionInfobarDelegate::Create( | 13 infobars::InfoBar* NotificationPermissionInfobarDelegate::Create( |
14 InfoBarService* infobar_service, | 14 InfoBarService* infobar_service, |
15 const GURL& requesting_frame, | 15 const GURL& requesting_frame, |
16 bool user_gesture, | 16 bool user_gesture, |
17 Profile* profile, | 17 Profile* profile, |
18 const base::Callback<void(bool, bool)>& callback) { | 18 const PermissionSetCallback& callback) { |
19 return infobar_service->AddInfoBar(infobar_service->CreateConfirmInfoBar( | 19 return infobar_service->AddInfoBar( |
20 std::unique_ptr<ConfirmInfoBarDelegate>( | 20 CreatePermissionInfoBar(std::unique_ptr<PermissionInfobarDelegate>( |
21 new NotificationPermissionInfobarDelegate( | 21 new NotificationPermissionInfobarDelegate( |
22 requesting_frame, user_gesture, profile, callback)))); | 22 requesting_frame, user_gesture, profile, callback)))); |
23 } | 23 } |
24 | 24 |
25 NotificationPermissionInfobarDelegate::NotificationPermissionInfobarDelegate( | 25 NotificationPermissionInfobarDelegate::NotificationPermissionInfobarDelegate( |
26 const GURL& requesting_frame, | 26 const GURL& requesting_frame, |
27 bool user_gesture, | 27 bool user_gesture, |
28 Profile* profile, | 28 Profile* profile, |
29 const base::Callback<void(bool, bool)>& callback) | 29 const PermissionSetCallback& callback) |
30 : PermissionInfobarDelegate(requesting_frame, | 30 : PermissionInfobarDelegate(requesting_frame, |
31 content::PermissionType::NOTIFICATIONS, | 31 content::PermissionType::NOTIFICATIONS, |
32 CONTENT_SETTINGS_TYPE_NOTIFICATIONS, | 32 CONTENT_SETTINGS_TYPE_NOTIFICATIONS, |
33 user_gesture, | 33 user_gesture, |
34 profile, | 34 profile, |
35 callback), | 35 callback), |
36 requesting_frame_(requesting_frame) {} | 36 requesting_frame_(requesting_frame) {} |
37 | 37 |
38 NotificationPermissionInfobarDelegate::~NotificationPermissionInfobarDelegate() | 38 NotificationPermissionInfobarDelegate::~NotificationPermissionInfobarDelegate() |
39 {} | 39 {} |
40 | 40 |
41 infobars::InfoBarDelegate::InfoBarIdentifier | 41 infobars::InfoBarDelegate::InfoBarIdentifier |
42 NotificationPermissionInfobarDelegate::GetIdentifier() const { | 42 NotificationPermissionInfobarDelegate::GetIdentifier() const { |
43 return NOTIFICATION_PERMISSION_INFOBAR_DELEGATE; | 43 return NOTIFICATION_PERMISSION_INFOBAR_DELEGATE; |
44 } | 44 } |
45 | 45 |
46 int NotificationPermissionInfobarDelegate::GetIconId() const { | 46 int NotificationPermissionInfobarDelegate::GetIconId() const { |
47 return IDR_ANDROID_INFOBAR_NOTIFICATIONS; | 47 return IDR_ANDROID_INFOBAR_NOTIFICATIONS; |
48 } | 48 } |
49 | 49 |
50 int NotificationPermissionInfobarDelegate::GetMessageResourceId() const { | 50 int NotificationPermissionInfobarDelegate::GetMessageResourceId() const { |
51 return IDS_NOTIFICATION_PERMISSIONS; | 51 return IDS_NOTIFICATION_PERMISSIONS; |
52 } | 52 } |
OLD | NEW |