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

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

Issue 1240923002: Add an infobar to resolve android runtime permission mismatches. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 5 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.h
diff --git a/chrome/browser/permissions/permission_update_infobar_delegate_android.h b/chrome/browser/permissions/permission_update_infobar_delegate_android.h
new file mode 100644
index 0000000000000000000000000000000000000000..f585f4c9377767574ae017f87611c742db0c0db2
--- /dev/null
+++ b/chrome/browser/permissions/permission_update_infobar_delegate_android.h
@@ -0,0 +1,71 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_PERMISSIONS_PERMISSION_UPDATE_INFOBAR_DELEGATE_ANDROID_H_
+#define CHROME_BROWSER_PERMISSIONS_PERMISSION_UPDATE_INFOBAR_DELEGATE_ANDROID_H_
+
+#include <jni.h>
+#include <vector>
+
+#include "base/android/scoped_java_ref.h"
+#include "base/callback.h"
+#include "base/strings/string16.h"
+#include "components/content_settings/core/common/content_settings_types.h"
+#include "components/infobars/core/confirm_infobar_delegate.h"
+
+namespace content {
+class WebContents;
+}
+
+// An infobar delegate to be used for requesting missing Android runtime
+// permissions for previously allowed ContentSettingsTypes.
+class PermissionUpdateInfoBarDelegate : public ConfirmInfoBarDelegate {
+ public:
+ using PermissionUpdatedCallback = base::Callback<void(bool)>;
+
+ // Creates an infobar to resolve conflicts in Android runtime permissions
+ // and adds the infobar to |infobar_service|. Returns the infobar if it was
+ // successfully added.
+ static infobars::InfoBar* Create(
+ content::WebContents* web_contents,
+ const std::vector<ContentSettingsType>& content_settings_types,
+ const PermissionUpdatedCallback& callback);
+
+ // Return whether a permission update infobar should be shown that will allow
+ // the user to correct the mismatch between the runtime permissions granted to
+ // Chrome and the previously granted ContentSettingTypes to a particular site.
gone 2015/07/17 17:41:40 // Return whether the runtime permissions currentl
Ted C 2015/07/17 20:37:18 Done.
+ static bool ShouldShowPermissionInfobar(
+ content::WebContents* web_contents,
+ const std::vector<ContentSettingsType>& content_settings_types);
+
+ static bool RegisterPermissionUpdateInfoBarDelegate(JNIEnv* env);
+
+ void OnPermissionResult(
+ JNIEnv* env, jobject obj, jboolean all_permissions_granted);
+
+ private:
+ PermissionUpdateInfoBarDelegate(
+ content::WebContents* web_contents,
+ const std::vector<ContentSettingsType>& content_settings_types,
+ const PermissionUpdatedCallback& callback);
+ ~PermissionUpdateInfoBarDelegate() override;
+
+ // PermissionInfoBarDelegate:
+ int GetIconID() const override;
+ base::string16 GetMessageText() const override;
+
+ // ConfirmInfoBarDelegate:
+ int GetButtons() const override;
+ base::string16 GetButtonLabel(InfoBarButton button) const;
+ bool Accept() override;
+ bool Cancel() override;
+
+ base::android::ScopedJavaGlobalRef<jobject> java_delegate_;
+ std::vector<ContentSettingsType> content_settings_types_;
+ const PermissionUpdatedCallback callback_;
+
+ DISALLOW_COPY_AND_ASSIGN(PermissionUpdateInfoBarDelegate);
+};
+
+#endif // CHROME_BROWSER_PERMISSIONS_PERMISSION_UPDATE_INFOBAR_DELEGATE_ANDROID_H_

Powered by Google App Engine
This is Rietveld 408576698