| Index: chrome/browser/notifications/incognito_denied_infobar_delegate.h
|
| diff --git a/chrome/browser/notifications/incognito_denied_infobar_delegate.h b/chrome/browser/notifications/incognito_denied_infobar_delegate.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..d0c8691c4c1801bab84a57121e80f4221db3e5a6
|
| --- /dev/null
|
| +++ b/chrome/browser/notifications/incognito_denied_infobar_delegate.h
|
| @@ -0,0 +1,54 @@
|
| +// Copyright 2015 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#ifndef CHROME_BROWSER_NOTIFICATIONS_INCOGNITO_DENIED_INFOBAR_DELEGATE_H_
|
| +#define CHROME_BROWSER_NOTIFICATIONS_INCOGNITO_DENIED_INFOBAR_DELEGATE_H_
|
| +
|
| +#include "base/callback.h"
|
| +#include "base/macros.h"
|
| +#include "components/infobars/core/confirm_infobar_delegate.h"
|
| +
|
| +class InfoBarService;
|
| +class NavigationDetails;
|
| +
|
| +// Specialised infobar that informs the user that notifications permission is
|
| +// not supported in incognito, then marks the permission as denied when the user
|
| +// dismisses the infobar. Together with the fact that notification permission
|
| +// grants are (unusually) not inherited from regular to incognito profiles
|
| +// (blocks are still inherited), this prevents websites from detecting whether
|
| +// the user is using incognito, even though notifications are completely
|
| +// disabled in incognito.
|
| +// TODO(johnme): Consider auto-dismissing the infobar after a timeout that is
|
| +// normally-distributed, to reduce user annoyance without revealing incognito.
|
| +class IncognitoDeniedInfobarDelegate : public ConfirmInfoBarDelegate {
|
| + public:
|
| + // Creates the infobar and delegate and adds the infobar to |infobar_service|.
|
| + // Returns the infobar if it was successfully added.
|
| + static infobars::InfoBar* Create(
|
| + InfoBarService* infobar_service,
|
| + const GURL& requesting_origin,
|
| + const std::string& display_languages,
|
| + const base::Closure& dismiss_callback);
|
| +
|
| + private:
|
| + IncognitoDeniedInfobarDelegate(const GURL& requesting_origin,
|
| + const std::string& display_languages,
|
| + const base::Closure& dismiss_callback);
|
| + ~IncognitoDeniedInfobarDelegate() override;
|
| +
|
| + // ConfirmInfoBarDelegate:
|
| + Type GetInfoBarType() const override;
|
| + int GetIconId() const override;
|
| + base::string16 GetMessageText() const override;
|
| + int GetButtons() const override;
|
| + void InfoBarDismissed() override;
|
| +
|
| + GURL requesting_origin_;
|
| + std::string display_languages_;
|
| + base::Closure callback_;
|
| +
|
| + DISALLOW_COPY_AND_ASSIGN(IncognitoDeniedInfobarDelegate);
|
| +};
|
| +
|
| +#endif // CHROME_BROWSER_NOTIFICATIONS_INCOGNITO_DENIED_INFOBAR_DELEGATE_H_
|
|
|