Index: chrome/browser/notifications/incognito_denied_infobar_delegate.cc |
diff --git a/chrome/browser/notifications/incognito_denied_infobar_delegate.cc b/chrome/browser/notifications/incognito_denied_infobar_delegate.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..67c9833416d73062e1aea628bac1aa375d6f69bc |
--- /dev/null |
+++ b/chrome/browser/notifications/incognito_denied_infobar_delegate.cc |
@@ -0,0 +1,62 @@ |
+// 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. |
+ |
+#include "chrome/browser/notifications/incognito_denied_infobar_delegate.h" |
+ |
+#include "chrome/browser/android/android_theme_resources.h" |
+#include "chrome/browser/infobars/infobar_service.h" |
+#include "chrome/grit/generated_resources.h" |
+#include "components/infobars/core/infobar.h" |
+#include "components/url_formatter/elide_url.h" |
+#include "grit/theme_resources.h" |
+#include "ui/base/l10n/l10n_util.h" |
+ |
+// static |
+infobars::InfoBar* IncognitoDeniedInfobarDelegate::Create( |
+ InfoBarService* infobar_service, |
+ const GURL& requesting_origin, |
+ const std::string& display_languages, |
+ const base::Closure& callback) { |
+ return infobar_service->AddInfoBar(infobar_service->CreateConfirmInfoBar( |
+ scoped_ptr<ConfirmInfoBarDelegate>( |
+ new IncognitoDeniedInfobarDelegate(requesting_origin, |
+ display_languages, callback)))); |
+} |
+ |
+IncognitoDeniedInfobarDelegate::~IncognitoDeniedInfobarDelegate() { |
+} |
+ |
+IncognitoDeniedInfobarDelegate::IncognitoDeniedInfobarDelegate( |
+ const GURL& requesting_origin, |
+ const std::string& display_languages, |
+ const base::Closure& callback) |
+ : requesting_origin_(requesting_origin), |
+ display_languages_(display_languages), |
+ callback_(callback) { |
+} |
+ |
+infobars::InfoBarDelegate::Type |
+IncognitoDeniedInfobarDelegate::GetInfoBarType() const { |
+ return PAGE_ACTION_TYPE; |
+} |
+ |
+int IncognitoDeniedInfobarDelegate::GetIconId() const { |
+ // Keep this consistent with NotificationPermissionInfobarDelegate::GetIconId. |
+ return IDR_INFOBAR_DESKTOP_NOTIFICATIONS; |
+} |
+ |
+base::string16 IncognitoDeniedInfobarDelegate::GetMessageText() const { |
+ return l10n_util::GetStringFUTF16( |
+ IDS_NOTIFICATION_PERMISSIONS_INCOGNITO, |
+ url_formatter::FormatUrlForSecurityDisplay(requesting_origin_, |
+ display_languages_)); |
+} |
+ |
+int IncognitoDeniedInfobarDelegate::GetButtons() const { |
+ return BUTTON_NONE; |
+} |
+ |
+void IncognitoDeniedInfobarDelegate::InfoBarDismissed() { |
+ callback_.Run(); |
+} |