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

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

Issue 2443463003: Remove PermissionInfoBarDelegate from desktop builds. (Closed)
Patch Set: Add comment explaining lifetime Created 4 years, 1 month 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>
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/callback.h" 11 #include "base/callback.h"
12 #include "base/macros.h" 12 #include "base/macros.h"
13 #include "chrome/browser/permissions/permission_util.h" 13 #include "chrome/browser/permissions/permission_util.h"
14 #include "components/content_settings/core/common/content_settings_types.h" 14 #include "components/content_settings/core/common/content_settings_types.h"
15 #include "components/infobars/core/confirm_infobar_delegate.h" 15 #include "components/infobars/core/confirm_infobar_delegate.h"
16 #include "content/public/browser/permission_type.h" 16 #include "content/public/browser/permission_type.h"
17 #include "url/gurl.h"
17 18
19 namespace infobars {
20 class InfoBar;
21 }
22
23 class InfoBarService;
18 class Profile; 24 class Profile;
19 25
20 // Base class for permission infobars, it implements the default behavior 26 // Base class for permission infobars, it implements the default behavior
21 // so that the accept/deny buttons grant/deny the relevant permission. 27 // so that the accept/deny buttons grant/deny the relevant permission.
22 // A basic implementor only needs to implement the methods that 28 // A basic implementor only needs to implement the methods that
23 // provide an icon and a message text to the infobar. 29 // provide an icon and a message text to the infobar.
24 class PermissionInfoBarDelegate : public ConfirmInfoBarDelegate { 30 class PermissionInfoBarDelegate : public ConfirmInfoBarDelegate {
25 31
26 public: 32 public:
27 using PermissionSetCallback = base::Callback<void(bool, PermissionAction)>; 33 using PermissionSetCallback = base::Callback<void(bool, PermissionAction)>;
28 34
35 // Creates an infobar for |type|. The returned pointer is owned by
36 // |infobar_service| and manages its own lifetime; callers must only use it
37 // for calls to |infobar_service|.
38 static infobars::InfoBar* Create(content::PermissionType type,
39 InfoBarService* infobar_service,
40 const GURL& requesting_frame,
41 bool user_gesture,
42 Profile* profile,
43 const PermissionSetCallback& callback);
44
29 ~PermissionInfoBarDelegate() override; 45 ~PermissionInfoBarDelegate() override;
30 virtual std::vector<int> content_settings() const; 46 virtual std::vector<int> content_settings() const;
31 47
32 // Returns true if the infobar should display a toggle to allow users to 48 // Returns true if the infobar should display a toggle to allow users to
33 // opt-out of persisting their accept/deny decision. 49 // opt-out of persisting their accept/deny decision.
34 bool ShouldShowPersistenceToggle() const; 50 bool ShouldShowPersistenceToggle() const;
35 51
36 // Sets whether or not a decided permission should be persisted to content 52 // Sets whether or not a decided permission should be persisted to content
37 // settings. 53 // settings.
38 void set_persist(bool persist) { persist_ = persist; } 54 void set_persist(bool persist) { persist_ = persist; }
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 bool persist_; 87 bool persist_;
72 88
73 DISALLOW_COPY_AND_ASSIGN(PermissionInfoBarDelegate); 89 DISALLOW_COPY_AND_ASSIGN(PermissionInfoBarDelegate);
74 }; 90 };
75 91
76 // Implemented in platform-specific code. 92 // Implemented in platform-specific code.
77 std::unique_ptr<infobars::InfoBar> CreatePermissionInfoBar( 93 std::unique_ptr<infobars::InfoBar> CreatePermissionInfoBar(
78 std::unique_ptr<PermissionInfoBarDelegate> delegate); 94 std::unique_ptr<PermissionInfoBarDelegate> delegate);
79 95
80 #endif // CHROME_BROWSER_PERMISSIONS_PERMISSION_INFOBAR_DELEGATE_H_ 96 #endif // CHROME_BROWSER_PERMISSIONS_PERMISSION_INFOBAR_DELEGATE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698