Update mojo surfaces bindings and mojo/cc/ glue
[chromium-blink-merge.git] / chrome / browser / content_settings / permission_infobar_delegate.h
blob4ba26e7419832645072eed6b8f8d9cf9f0e1e4ec
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_CONTENT_SETTINGS_PERMISSION_INFOBAR_DELEGATE_H_
6 #define CHROME_BROWSER_CONTENT_SETTINGS_PERMISSION_INFOBAR_DELEGATE_H_
8 #include "chrome/browser/content_settings/permission_request_id.h"
9 #include "chrome/browser/infobars/infobar_service.h"
10 #include "components/content_settings/core/common/content_settings_types.h"
11 #include "components/infobars/core/confirm_infobar_delegate.h"
12 #include "content/public/browser/web_contents.h"
14 class NavigationDetails;
15 class PermissionQueueController;
17 // Base class for permission infobars, it implements the default behavior
18 // so that the accept/deny buttons grant/deny the relevant permission.
19 // A basic implementor only needs to implement the methods that
20 // provide an icon and a message text to the infobar.
21 class PermissionInfobarDelegate : public ConfirmInfoBarDelegate {
23 protected:
24 PermissionInfobarDelegate(PermissionQueueController* controller,
25 const PermissionRequestID& id,
26 const GURL& requesting_origin,
27 ContentSettingsType type);
28 virtual ~PermissionInfobarDelegate();
30 // ConfirmInfoBarDelegate:
31 virtual base::string16 GetMessageText() const = 0;
33 virtual infobars::InfoBarDelegate::Type GetInfoBarType() const OVERRIDE;
34 virtual base::string16 GetButtonLabel(InfoBarButton button) const OVERRIDE;
36 // Remember to call RegisterActionTaken for these methods if you are
37 // overriding them.
38 virtual void InfoBarDismissed() OVERRIDE;
39 virtual bool Accept() OVERRIDE;
40 virtual bool Cancel() OVERRIDE;
42 private:
43 void SetPermission(bool update_content_setting, bool allowed);
45 PermissionQueueController* controller_; // not owned by us
46 const PermissionRequestID id_;
47 GURL requesting_origin_;
48 bool action_taken_;
49 ContentSettingsType type_;
51 DISALLOW_COPY_AND_ASSIGN(PermissionInfobarDelegate);
54 #endif // CHROME_BROWSER_CONTENT_SETTINGS_PERMISSION_INFOBAR_DELEGATE_H_