| 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" |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 } | 96 } |
| 97 | 97 |
| 98 bool PermissionInfoBarDelegate::Accept() { | 98 bool PermissionInfoBarDelegate::Accept() { |
| 99 bool update_content_setting = true; | 99 bool update_content_setting = true; |
| 100 if (ShouldShowPersistenceToggle()) { | 100 if (ShouldShowPersistenceToggle()) { |
| 101 update_content_setting = persist_; | 101 update_content_setting = persist_; |
| 102 PermissionUmaUtil::PermissionPromptAcceptedWithPersistenceToggle( | 102 PermissionUmaUtil::PermissionPromptAcceptedWithPersistenceToggle( |
| 103 content_settings_type_, persist_); | 103 content_settings_type_, persist_); |
| 104 } | 104 } |
| 105 | 105 |
| 106 SetPermission(update_content_setting, GRANTED); | 106 SetPermission(update_content_setting, PermissionAction::GRANTED); |
| 107 return true; | 107 return true; |
| 108 } | 108 } |
| 109 | 109 |
| 110 bool PermissionInfoBarDelegate::Cancel() { | 110 bool PermissionInfoBarDelegate::Cancel() { |
| 111 bool update_content_setting = true; | 111 bool update_content_setting = true; |
| 112 if (ShouldShowPersistenceToggle()) { | 112 if (ShouldShowPersistenceToggle()) { |
| 113 update_content_setting = persist_; | 113 update_content_setting = persist_; |
| 114 PermissionUmaUtil::PermissionPromptDeniedWithPersistenceToggle( | 114 PermissionUmaUtil::PermissionPromptDeniedWithPersistenceToggle( |
| 115 content_settings_type_, persist_); | 115 content_settings_type_, persist_); |
| 116 } | 116 } |
| 117 | 117 |
| 118 SetPermission(update_content_setting, DENIED); | 118 SetPermission(update_content_setting, PermissionAction::DENIED); |
| 119 return true; | 119 return true; |
| 120 } | 120 } |
| 121 | 121 |
| 122 void PermissionInfoBarDelegate::InfoBarDismissed() { | 122 void PermissionInfoBarDelegate::InfoBarDismissed() { |
| 123 SetPermission(false, DISMISSED); | 123 SetPermission(false, PermissionAction::DISMISSED); |
| 124 } | 124 } |
| 125 | 125 |
| 126 base::string16 PermissionInfoBarDelegate::GetButtonLabel( | 126 base::string16 PermissionInfoBarDelegate::GetButtonLabel( |
| 127 InfoBarButton button) const { | 127 InfoBarButton button) const { |
| 128 return l10n_util::GetStringUTF16((button == BUTTON_OK) ? IDS_PERMISSION_ALLOW | 128 return l10n_util::GetStringUTF16((button == BUTTON_OK) ? IDS_PERMISSION_ALLOW |
| 129 : IDS_PERMISSION_DENY); | 129 : IDS_PERMISSION_DENY); |
| 130 } | 130 } |
| 131 | 131 |
| 132 base::string16 PermissionInfoBarDelegate::GetMessageText() const { | 132 base::string16 PermissionInfoBarDelegate::GetMessageText() const { |
| 133 return l10n_util::GetStringFUTF16( | 133 return l10n_util::GetStringFUTF16( |
| (...skipping 25 matching lines...) Expand all Loading... |
| 159 PermissionInfoBarDelegate* | 159 PermissionInfoBarDelegate* |
| 160 PermissionInfoBarDelegate::AsPermissionInfoBarDelegate() { | 160 PermissionInfoBarDelegate::AsPermissionInfoBarDelegate() { |
| 161 return this; | 161 return this; |
| 162 } | 162 } |
| 163 | 163 |
| 164 void PermissionInfoBarDelegate::SetPermission(bool update_content_setting, | 164 void PermissionInfoBarDelegate::SetPermission(bool update_content_setting, |
| 165 PermissionAction decision) { | 165 PermissionAction decision) { |
| 166 action_taken_ = true; | 166 action_taken_ = true; |
| 167 callback_.Run(update_content_setting, decision); | 167 callback_.Run(update_content_setting, decision); |
| 168 } | 168 } |
| OLD | NEW |