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

Side by Side Diff: chrome/browser/notifications/incognito_denied_infobar_delegate.h

Issue 1441143006: Disable Notifications in Incognito (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@innoinherit
Patch Set: Address nits Created 5 years 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
(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_
OLDNEW
« no previous file with comments | « chrome/browser/android/resource_id.h ('k') | chrome/browser/notifications/incognito_denied_infobar_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698