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

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

Issue 1362803002: Add logic to resolve permission mismatches in Android M for webrtc. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased Created 5 years, 3 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_update_infobar_delegate_android.cc
diff --git a/chrome/browser/permissions/permission_update_infobar_delegate_android.cc b/chrome/browser/permissions/permission_update_infobar_delegate_android.cc
index 35ad88576f527f697753a71afb472fefb1a99b1c..3edeaaf034cf9baa1b8bea4a80961306db2ffd8c 100644
--- a/chrome/browser/permissions/permission_update_infobar_delegate_android.cc
+++ b/chrome/browser/permissions/permission_update_infobar_delegate_android.cc
@@ -7,6 +7,7 @@
#include <string>
#include "base/android/jni_array.h"
+#include "base/callback_helpers.h"
#include "base/memory/scoped_ptr.h"
#include "chrome/browser/android/preferences/pref_service_bridge.h"
#include "chrome/browser/infobars/infobar_service.h"
@@ -76,7 +77,7 @@ bool PermissionUpdateInfoBarDelegate::RegisterPermissionUpdateInfoBarDelegate(
void PermissionUpdateInfoBarDelegate::OnPermissionResult(
JNIEnv* env, jobject obj, jboolean all_permissions_granted) {
- callback_.Run(all_permissions_granted);
+ base::ResetAndReturn(&callback_).Run(all_permissions_granted);
infobar()->RemoveSelf();
}
@@ -106,6 +107,9 @@ PermissionUpdateInfoBarDelegate::PermissionUpdateInfoBarDelegate(
PermissionUpdateInfoBarDelegate::~PermissionUpdateInfoBarDelegate() {
Java_PermissionUpdateInfoBarDelegate_onNativeDestroyed(
base::android::AttachCurrentThread(), java_delegate_.obj());
+
+ if (!callback_.is_null())
+ callback_.Run(false);
}
int PermissionUpdateInfoBarDelegate::GetIconId() const {
@@ -167,6 +171,10 @@ bool PermissionUpdateInfoBarDelegate::Accept() {
}
bool PermissionUpdateInfoBarDelegate::Cancel() {
- callback_.Run(false);
+ base::ResetAndReturn(&callback_).Run(false);
return true;
}
+
+void PermissionUpdateInfoBarDelegate::InfoBarDismissed() {
+ base::ResetAndReturn(&callback_).Run(false);
+}

Powered by Google App Engine
This is Rietveld 408576698