OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/grouped_permission_infobar_delegate_android
.h" | 5 #include "chrome/browser/permissions/grouped_permission_infobar_delegate_android
.h" |
6 | 6 |
7 #include "base/memory/ptr_util.h" | 7 #include "base/memory/ptr_util.h" |
8 #include "chrome/browser/android/android_theme_resources.h" | 8 #include "chrome/browser/android/android_theme_resources.h" |
9 #include "chrome/browser/infobars/infobar_service.h" | 9 #include "chrome/browser/infobars/infobar_service.h" |
10 #include "chrome/browser/permissions/permission_request.h" | 10 #include "chrome/browser/permissions/permission_request.h" |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 DCHECK_LT(position, requests_.size()); | 56 DCHECK_LT(position, requests_.size()); |
57 accept_states_[position] = new_value; | 57 accept_states_[position] = new_value; |
58 } | 58 } |
59 | 59 |
60 base::string16 GroupedPermissionInfoBarDelegate::GetMessageText() const { | 60 base::string16 GroupedPermissionInfoBarDelegate::GetMessageText() const { |
61 return l10n_util::GetStringFUTF16( | 61 return l10n_util::GetStringFUTF16( |
62 IDS_PERMISSIONS_BUBBLE_PROMPT, | 62 IDS_PERMISSIONS_BUBBLE_PROMPT, |
63 url_formatter::FormatUrlForSecurityDisplay(requesting_origin_)); | 63 url_formatter::FormatUrlForSecurityDisplay(requesting_origin_)); |
64 } | 64 } |
65 | 65 |
| 66 bool GroupedPermissionInfoBarDelegate::Accept() { |
| 67 // TODO(lshang): Implement this so that 'OK' button works. |
| 68 return true; |
| 69 } |
| 70 |
| 71 bool GroupedPermissionInfoBarDelegate::Cancel() { |
| 72 // TODO(lshang): Implement this so that 'Cancel' button works. |
| 73 return true; |
| 74 } |
| 75 |
66 bool GroupedPermissionInfoBarDelegate::GetAcceptState(size_t position) { | 76 bool GroupedPermissionInfoBarDelegate::GetAcceptState(size_t position) { |
67 DCHECK_LT(position, requests_.size()); | 77 DCHECK_LT(position, requests_.size()); |
68 return accept_states_[position]; | 78 return accept_states_[position]; |
69 } | 79 } |
70 | 80 |
71 GroupedPermissionInfoBarDelegate::GroupedPermissionInfoBarDelegate( | 81 GroupedPermissionInfoBarDelegate::GroupedPermissionInfoBarDelegate( |
72 const GURL& requesting_origin, | 82 const GURL& requesting_origin, |
73 const std::vector<PermissionRequest*>& requests) | 83 const std::vector<PermissionRequest*>& requests) |
74 : requesting_origin_(requesting_origin), | 84 : requesting_origin_(requesting_origin), |
75 requests_(requests), | 85 requests_(requests), |
(...skipping 21 matching lines...) Expand all Loading... |
97 base::string16 GroupedPermissionInfoBarDelegate::GetButtonLabel( | 107 base::string16 GroupedPermissionInfoBarDelegate::GetButtonLabel( |
98 InfoBarButton button) const { | 108 InfoBarButton button) const { |
99 if (permission_count() > 1) { | 109 if (permission_count() > 1) { |
100 return l10n_util::GetStringUTF16((button == BUTTON_OK) ? IDS_APP_OK | 110 return l10n_util::GetStringUTF16((button == BUTTON_OK) ? IDS_APP_OK |
101 : IDS_APP_CANCEL); | 111 : IDS_APP_CANCEL); |
102 } | 112 } |
103 | 113 |
104 return l10n_util::GetStringUTF16((button == BUTTON_OK) ? IDS_PERMISSION_ALLOW | 114 return l10n_util::GetStringUTF16((button == BUTTON_OK) ? IDS_PERMISSION_ALLOW |
105 : IDS_PERMISSION_DENY); | 115 : IDS_PERMISSION_DENY); |
106 } | 116 } |
OLD | NEW |