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

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

Issue 1337903002: permissions: remove PermissionQueueController and introduce PermissionInfoBarManager (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@callbacks-delegates
Patch Set: Try to fix context base tests 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_infobar_request.h
diff --git a/chrome/browser/permissions/permission_infobar_request.h b/chrome/browser/permissions/permission_infobar_request.h
new file mode 100644
index 0000000000000000000000000000000000000000..7edde9cc29fa0f0e3d7526a8615038f025191fd0
--- /dev/null
+++ b/chrome/browser/permissions/permission_infobar_request.h
@@ -0,0 +1,86 @@
+// 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_INFOBAR_REQUEST_H_
+#define CHROME_BROWSER_PERMISSIONS_PERMISSION_INFOBAR_REQUEST_H_
+
+#include "base/callback.h"
+#include "base/memory/weak_ptr.h"
+#include "components/content_settings/core/common/content_settings.h"
+#include "url/gurl.h"
+
+namespace infobars {
+class InfoBar;
+} // namespace infobars
+
+class InfoBarService;
+class Profile;
+
+// Represents a permission request which will be displayed using an InfoBar.
+class PermissionInfoBarRequest {
+ public:
+ PermissionInfoBarRequest(
+ const GURL& requesting_origin,
+ const GURL& embedding_origin,
+ const base::Closure& callback);
+ ~PermissionInfoBarRequest();
+
+ void AddPermission(
mlamouri (slow - plz ping) 2015/09/29 14:02:18 Here and below, please add comments for these meth
Lalit Maganti 2015/10/01 17:05:14 Done.
+ const ContentSettingsType type,
+ const base::Callback<void(bool, ContentSetting)>& response_callback);
+
+ bool ShowInfobar(InfoBarService* infobar_service,
+ Profile* profile);
+
+ void Accept();
+ void Closing();
+ void Cancel();
+
+ private:
+ using PermissionDecidedCallback = base::Callback<void(bool, ContentSetting)>;
+ class PermissionRequest {
+ public:
+ PermissionRequest(ContentSettingsType type,
+ const PermissionDecidedCallback& response_callback);
+ ~PermissionRequest();
+
+ ContentSettingsType type() const { return type_; }
+ const PermissionDecidedCallback& response_callback() const {
+ return response_callback_;
+ }
+
+ private:
+ ContentSettingsType type_;
+ PermissionDecidedCallback response_callback_;
+ };
+
+ void OnExternalRemoval();
+
+ void OnPermissionSet(bool update_content_setting,
+ bool allowed);
+
+ void OnPermissionsSet(bool update_content_setting,
+ const std::vector<ContentSetting>& allowed);
+
+ void PruneAnsweredPermissions(Profile* profile);
+
+ void CreateInfoBar(InfoBarService* infobar_service,
+ const PermissionRequest& request,
+ const std::string& display_languages,
+ const base::Callback<void(bool, bool)>& callback);
+
+ // Owned by InfoBarService.
+ infobars::InfoBar* infobar_;
+
+ GURL requesting_origin_;
+ GURL embedding_origin_;
+ base::Closure callback_;
+ std::vector<PermissionRequest> requests_;
+
+ base::WeakPtrFactory<PermissionInfoBarRequest> weak_factory_;
+
+ DISALLOW_COPY_AND_ASSIGN(PermissionInfoBarRequest);
+};
+
+#endif // CHROME_BROWSER_PERMISSIONS_PERMISSION_INFOBAR_REQUEST_H_

Powered by Google App Engine
This is Rietveld 408576698