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. |
| 24 class IncognitoDeniedInfobarDelegate : public ConfirmInfoBarDelegate { |
| 25 public: |
| 26 // Creates the infobar and delegate and adds the infobar to |infobar_service|. |
| 27 // Returns the infobar if it was successfully added. |
| 28 static infobars::InfoBar* Create( |
| 29 InfoBarService* infobar_service, |
| 30 const GURL& requesting_origin, |
| 31 const std::string& display_languages, |
| 32 const base::Closure& dismiss_callback); |
| 33 |
| 34 private: |
| 35 IncognitoDeniedInfobarDelegate(const GURL& requesting_origin, |
| 36 const std::string& display_languages, |
| 37 const base::Closure& dismiss_callback); |
| 38 ~IncognitoDeniedInfobarDelegate() override; |
| 39 |
| 40 // ConfirmInfoBarDelegate: |
| 41 Type GetInfoBarType() const override; |
| 42 int GetIconId() const override; |
| 43 base::string16 GetMessageText() const override; |
| 44 int GetButtons() const override; |
| 45 void InfoBarDismissed() override; |
| 46 |
| 47 GURL requesting_origin_; |
| 48 std::string display_languages_; |
| 49 base::Closure callback_; |
| 50 |
| 51 DISALLOW_COPY_AND_ASSIGN(IncognitoDeniedInfobarDelegate); |
| 52 }; |
| 53 |
| 54 #endif // CHROME_BROWSER_NOTIFICATIONS_INCOGNITO_DENIED_INFOBAR_DELEGATE_H_ |
OLD | NEW |