OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2015 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. | |
4 | |
5 #ifndef CHROME_BROWSER_NOTIFICATIONS_INCOGNITO_DENIED_INFOBAR_DELEGATE_H_ | |
6 #define CHROME_BROWSER_NOTIFICATIONS_INCOGNITO_DENIED_INFOBAR_DELEGATE_H_ | |
7 | |
8 #include "base/callback.h" | |
9 #include "base/macros.h" | |
10 #include "components/infobars/core/confirm_infobar_delegate.h" | |
11 | |
12 class InfoBarService; | |
13 class NavigationDetails; | |
14 | |
15 // Specialised infobar that informs the user that notifications permission is | |
16 // not supported in incognito, then marks the permission as denied when the user | |
17 // dismisses the infobar. Together with the fact that notification permission | |
18 // grants are (unusually) not inherited from regular to incognito profiles | |
19 // (blocks are still inherited), this prevents websites from detecting whether | |
20 // the user is using incognito, even though notifications are completely | |
21 // disabled in incognito. | |
22 // TODO(johnme): Consider auto-dismissing the infobar after a timeout that is | |
23 // normally-distributed, to reduce user annoyance without revealing incognito. | |
mlamouri (slow - plz ping)
2015/11/28 17:00:54
Given the likeliness that a user will ignore the i
| |
24 class IncognitoDeniedInfobarDelegate : public ConfirmInfoBarDelegate { | |
25 public: | |
26 using PermissionSetCallback = base::Callback<void(bool, bool)>; | |
27 | |
28 public: | |
mlamouri (slow - plz ping)
2015/11/28 17:00:54
nit: redundant
johnme
2015/11/30 15:37:20
Done.
| |
29 // Creates the infobar and delegate and adds the infobar to |infobar_service|. | |
30 // Returns the infobar if it was successfully added. | |
31 static infobars::InfoBar* Create( | |
32 InfoBarService* infobar_service, | |
33 const GURL& requesting_frame, | |
34 const std::string& display_languages, | |
35 const PermissionSetCallback& callback); | |
36 | |
37 private: | |
38 IncognitoDeniedInfobarDelegate(const GURL& requesting_frame, | |
39 const std::string& display_languages, | |
40 const PermissionSetCallback& callback); | |
41 ~IncognitoDeniedInfobarDelegate() override; | |
42 | |
43 // ConfirmInfoBarDelegate: | |
44 Type GetInfoBarType() const override; | |
45 int GetIconId() const override; | |
46 base::string16 GetMessageText() const override; | |
47 int GetButtons() const override; | |
48 void InfoBarDismissed() override; | |
49 | |
50 void SetPermission(bool update_content_setting, bool allowed); | |
51 | |
52 GURL requesting_frame_; | |
mlamouri (slow - plz ping)
2015/11/28 17:00:54
nit: requesitng_origin_ ?
johnme
2015/11/30 15:37:20
Done.
| |
53 std::string display_languages_; | |
54 const PermissionSetCallback callback_; | |
55 | |
56 DISALLOW_COPY_AND_ASSIGN(IncognitoDeniedInfobarDelegate); | |
57 }; | |
58 | |
59 #endif // CHROME_BROWSER_NOTIFICATIONS_INCOGNITO_DENIED_INFOBAR_DELEGATE_H_ | |
OLD | NEW |