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

Unified Diff: chrome/browser/permissions/permission_infobar_delegate.cc

Issue 2446063002: Implement a modal permission dialog on Android gated by a feature. (Closed)
Patch Set: Allow user gesture requirement to be overridden by variations Created 4 years, 2 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/permissions/permission_infobar_delegate.cc
diff --git a/chrome/browser/permissions/permission_infobar_delegate.cc b/chrome/browser/permissions/permission_infobar_delegate.cc
index f02ad991b4ed1f3b537b81d8fe33f92ef73079a6..be7586e23075325ebf63185bc43ca66adabe1b77 100644
--- a/chrome/browser/permissions/permission_infobar_delegate.cc
+++ b/chrome/browser/permissions/permission_infobar_delegate.cc
@@ -15,6 +15,7 @@
#include "chrome/grit/generated_resources.h"
#include "components/infobars/core/infobar.h"
#include "components/url_formatter/elide_url.h"
+#include "content/public/browser/web_contents.h"
#include "ui/base/l10n/l10n_util.h"
// static
@@ -76,6 +77,40 @@ bool PermissionInfoBarDelegate::ShouldShowPersistenceToggle() const {
PermissionUtil::ShouldShowPersistenceToggle();
}
+bool PermissionInfoBarDelegate::Accept() {
+ bool update_content_setting = true;
+ if (ShouldShowPersistenceToggle()) {
+ update_content_setting = persist_;
+ PermissionUmaUtil::PermissionPromptAcceptedWithPersistenceToggle(
+ permission_type_, persist_);
+ }
+
+ SetPermission(update_content_setting, GRANTED);
+ return true;
+}
+
+bool PermissionInfoBarDelegate::Cancel() {
+ bool update_content_setting = true;
+ if (ShouldShowPersistenceToggle()) {
+ update_content_setting = persist_;
+ PermissionUmaUtil::PermissionPromptDeniedWithPersistenceToggle(
+ permission_type_, persist_);
+ }
+
+ SetPermission(update_content_setting, DENIED);
+ return true;
+}
+
+void PermissionInfoBarDelegate::InfoBarDismissed() {
+ SetPermission(false, DISMISSED);
+}
+
+base::string16 PermissionInfoBarDelegate::GetButtonLabel(
+ InfoBarButton button) const {
+ return l10n_util::GetStringUTF16((button == BUTTON_OK) ? IDS_PERMISSION_ALLOW
+ : IDS_PERMISSION_DENY);
+}
+
base::string16 PermissionInfoBarDelegate::GetMessageText() const {
return l10n_util::GetStringFUTF16(
GetMessageResourceId(),
@@ -105,45 +140,11 @@ infobars::InfoBarDelegate::Type PermissionInfoBarDelegate::GetInfoBarType()
return PAGE_ACTION_TYPE;
}
-void PermissionInfoBarDelegate::InfoBarDismissed() {
- SetPermission(false, DISMISSED);
-}
-
PermissionInfoBarDelegate*
PermissionInfoBarDelegate::AsPermissionInfoBarDelegate() {
return this;
}
-base::string16 PermissionInfoBarDelegate::GetButtonLabel(
- InfoBarButton button) const {
- return l10n_util::GetStringUTF16((button == BUTTON_OK) ?
- IDS_PERMISSION_ALLOW : IDS_PERMISSION_DENY);
-}
-
-bool PermissionInfoBarDelegate::Accept() {
- bool update_content_setting = true;
- if (ShouldShowPersistenceToggle()) {
- update_content_setting = persist_;
- PermissionUmaUtil::PermissionPromptAcceptedWithPersistenceToggle(
- permission_type_, persist_);
- }
-
- SetPermission(update_content_setting, GRANTED);
- return true;
-}
-
-bool PermissionInfoBarDelegate::Cancel() {
- bool update_content_setting = true;
- if (ShouldShowPersistenceToggle()) {
- update_content_setting = persist_;
- PermissionUmaUtil::PermissionPromptDeniedWithPersistenceToggle(
- permission_type_, persist_);
- }
-
- SetPermission(update_content_setting, DENIED);
- return true;
-}
-
void PermissionInfoBarDelegate::SetPermission(bool update_content_setting,
PermissionAction decision) {
action_taken_ = true;

Powered by Google App Engine
This is Rietveld 408576698