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

Side by Side Diff: chrome/browser/permissions/permission_infobar_delegate.h

Issue 2341953004: Decouple MediaStreamInfoBarDelegate from GroupedPermissionInfoBarDelegate (Closed)
Patch Set: Created 4 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROME_BROWSER_PERMISSIONS_PERMISSION_INFOBAR_DELEGATE_H_ 5 #ifndef CHROME_BROWSER_PERMISSIONS_PERMISSION_INFOBAR_DELEGATE_H_
6 #define CHROME_BROWSER_PERMISSIONS_PERMISSION_INFOBAR_DELEGATE_H_ 6 #define CHROME_BROWSER_PERMISSIONS_PERMISSION_INFOBAR_DELEGATE_H_
7 7
8 #include <memory> 8 #include <memory>
dominickn 2016/09/20 08:01:36 Nit: #include <vector>
lshang 2016/09/21 03:47:39 Done.
9 9
10 #include "base/callback.h" 10 #include "base/callback.h"
11 #include "base/macros.h" 11 #include "base/macros.h"
12 #include "chrome/browser/permissions/permission_util.h" 12 #include "chrome/browser/permissions/permission_util.h"
13 #include "components/content_settings/core/common/content_settings_types.h" 13 #include "components/content_settings/core/common/content_settings_types.h"
14 #include "components/infobars/core/confirm_infobar_delegate.h" 14 #include "components/infobars/core/confirm_infobar_delegate.h"
15 #include "content/public/browser/permission_type.h" 15 #include "content/public/browser/permission_type.h"
16 16
17 class Profile; 17 class Profile;
18 18
19 // Base class for permission infobars, it implements the default behavior 19 // Base class for permission infobars, it implements the default behavior
20 // so that the accept/deny buttons grant/deny the relevant permission. 20 // so that the accept/deny buttons grant/deny the relevant permission.
21 // A basic implementor only needs to implement the methods that 21 // A basic implementor only needs to implement the methods that
22 // provide an icon and a message text to the infobar. 22 // provide an icon and a message text to the infobar.
23 class PermissionInfoBarDelegate : public ConfirmInfoBarDelegate { 23 class PermissionInfoBarDelegate : public ConfirmInfoBarDelegate {
24 24
25 public: 25 public:
26 using PermissionSetCallback = base::Callback<void(bool, PermissionAction)>; 26 using PermissionSetCallback = base::Callback<void(bool, PermissionAction)>;
27 27
28 ~PermissionInfoBarDelegate() override; 28 ~PermissionInfoBarDelegate() override;
29 ContentSettingsType content_setting() const { return content_settings_type_; } 29 virtual std::vector<int> content_setting() const;
30 30
31 // Returns true if the infobar should display a toggle to allow users to 31 // Returns true if the infobar should display a toggle to allow users to
32 // opt-out of persisting their accept/deny decision. 32 // opt-out of persisting their accept/deny decision.
33 bool ShouldShowPersistenceToggle() const; 33 virtual bool ShouldShowPersistenceToggle() const;
dominickn 2016/09/20 08:01:36 Should this be made virtual, or should you just ch
lshang 2016/09/21 03:47:39 Good idea, have merged two media types into Should
34 34
35 // Sets whether or not a decided permission should be persisted to content 35 // Sets whether or not a decided permission should be persisted to content
36 // settings. 36 // settings.
37 void set_persist(bool persist) { persist_ = persist; } 37 void set_persist(bool persist) { persist_ = persist; }
38 38
39 // ConfirmInfoBarDelegate: 39 // ConfirmInfoBarDelegate:
40 base::string16 GetMessageText() const override; 40 base::string16 GetMessageText() const override;
41 41
42 protected: 42 protected:
43 PermissionInfoBarDelegate(const GURL& requesting_origin, 43 PermissionInfoBarDelegate(const GURL& requesting_origin,
(...skipping 25 matching lines...) Expand all
69 bool persist_; 69 bool persist_;
70 70
71 DISALLOW_COPY_AND_ASSIGN(PermissionInfoBarDelegate); 71 DISALLOW_COPY_AND_ASSIGN(PermissionInfoBarDelegate);
72 }; 72 };
73 73
74 // Implemented in platform-specific code. 74 // Implemented in platform-specific code.
75 std::unique_ptr<infobars::InfoBar> CreatePermissionInfoBar( 75 std::unique_ptr<infobars::InfoBar> CreatePermissionInfoBar(
76 std::unique_ptr<PermissionInfoBarDelegate> delegate); 76 std::unique_ptr<PermissionInfoBarDelegate> delegate);
77 77
78 #endif // CHROME_BROWSER_PERMISSIONS_PERMISSION_INFOBAR_DELEGATE_H_ 78 #endif // CHROME_BROWSER_PERMISSIONS_PERMISSION_INFOBAR_DELEGATE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698