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

Unified Diff: chrome/browser/services/gcm/permission_infobar_delegate.h

Issue 343743004: Implement a permission check for push. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased and addressed Michael's comments Created 6 years, 6 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/services/gcm/permission_infobar_delegate.h
diff --git a/chrome/browser/services/gcm/permission_infobar_delegate.h b/chrome/browser/services/gcm/permission_infobar_delegate.h
new file mode 100644
index 0000000000000000000000000000000000000000..eb03bbf629f07b73f051c7461c5c3553745956eb
--- /dev/null
+++ b/chrome/browser/services/gcm/permission_infobar_delegate.h
@@ -0,0 +1,49 @@
+// Copyright 2014 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_SERVICES_GCM_PERMISSION_INFOBAR_DELEGATE_H_
+#define CHROME_BROWSER_SERVICES_GCM_PERMISSION_INFOBAR_DELEGATE_H_
+
+#include "chrome/browser/content_settings/permission_request_id.h"
+#include "chrome/browser/infobars/infobar_service.h"
+#include "components/infobars/core/confirm_infobar_delegate.h"
+#include "content/public/browser/web_contents.h"
+
+class GURL;
+class NavigationDetails;
+class PermissionQueueController;
+
+namespace gcm {
+
+// Base class for permission infobars, it implements the default behaviour
+// so that the accept/deny buttons grant/deny the relevant permission.
+// A basic implementor only needs to implement the methods that
+// provide an incon and a message text to the infobar.
+class PermissionInfobarDelegate : public ConfirmInfoBarDelegate {
Peter Kasting 2014/06/19 17:58:21 Do you have this base class because your next patc
Miguel Garcia 2014/06/19 21:49:22 Yes, Midi Geolocation and other permission classes
+ public:
+ virtual ~PermissionInfobarDelegate();
+
+ protected:
+ PermissionInfobarDelegate(PermissionQueueController* controller,
+ const PermissionRequestID& id,
+ GURL& requesting_frame);
+
+ // ConfirmInfoBarDelegate:
+ virtual void InfoBarDismissed() OVERRIDE;
+ virtual infobars::InfoBarDelegate::Type GetInfoBarType() const OVERRIDE;
+ virtual base::string16 GetButtonLabel(InfoBarButton button) const OVERRIDE;
+ virtual bool Accept() OVERRIDE;
+ virtual bool Cancel() OVERRIDE;
+
+ private:
+ void SetPermission(bool update_content_setting, bool allowed);
+
+ PermissionQueueController* controller_;
+ const PermissionRequestID id_;
+ GURL requesting_frame_;
+ DISALLOW_COPY_AND_ASSIGN(PermissionInfobarDelegate);
Peter Kasting 2014/06/19 17:58:21 Nit: Blank line above this so it doesn't blend in
Miguel Garcia 2014/06/19 21:49:22 Done.
+};
+
+} // namespace gcm
Peter Kasting 2014/06/19 17:58:20 Nit: Blank line below this
Miguel Garcia 2014/06/19 21:49:22 Done.
+#endif // CHROME_BROWSER_SERVICES_GCM_PERMISSION_INFOBAR_DELEGATE_H_

Powered by Google App Engine
This is Rietveld 408576698