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

Unified Diff: chrome/browser/ui/blocked_content/popup_blocked_infobar_delegate.cc

Issue 11316153: implement input type=color for android (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 2 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/blocked_content/popup_blocked_infobar_delegate.h ('k') | chrome/chrome_browser_ui.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/blocked_content/popup_blocked_infobar_delegate.cc
diff --git a/chrome/browser/ui/blocked_content/popup_blocked_infobar_delegate.cc b/chrome/browser/ui/blocked_content/popup_blocked_infobar_delegate.cc
new file mode 100644
index 0000000000000000000000000000000000000000..f332fe99f176032fb4e5727ed7b4cc523419c031
--- /dev/null
+++ b/chrome/browser/ui/blocked_content/popup_blocked_infobar_delegate.cc
@@ -0,0 +1,63 @@
+// Copyright (c) 2013 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/ui/blocked_content/popup_blocked_infobar_delegate.h"
+
+#include "chrome/browser/infobars/infobar_service.h"
+#include "grit/generated_resources.h"
+#include "grit/theme_resources.h"
+#include "ui/base/l10n/l10n_util.h"
+
+PopupBlockedInfoBarDelegate::PopupBlockedInfoBarDelegate(
+ InfoBarService* infobar_service,
+ int n_popups)
+ : ConfirmInfoBarDelegate(infobar_service), n_popups_(n_popups) {}
+
+PopupBlockedInfoBarDelegate::~PopupBlockedInfoBarDelegate() {}
+
+string16 PopupBlockedInfoBarDelegate::GetMessageText() const {
+ return l10n_util::GetStringFUTF16Int(IDS_POPUPS_BLOCKED_INFOBAR_TEXT,
+ n_popups_);
+}
+
+int PopupBlockedInfoBarDelegate::GetButtons() const { return BUTTON_OK; }
+
+string16 PopupBlockedInfoBarDelegate::GetButtonLabel(
+ InfoBarButton button) const {
+ return l10n_util::GetStringUTF16(IDS_POPUPS_BLOCKED_INFOBAR_BUTTON_SHOW);
+}
+
+int PopupBlockedInfoBarDelegate::GetIconID() const {
+ return IDR_BLOCKED_POPUPS;
+}
+
+PopupBlockedInfoBarDelegate*
+PopupBlockedInfoBarDelegate::AsPopupBlockedInfoBarDelegate() {
+ return this;
+}
+
+bool PopupBlockedInfoBarDelegate::Accept() {
+ // TODO(miguelg) implement popup allows.
+ LOG(WARNING) << "ALLOWING POPUPS IS NOT YET IMPLEMENTED";
+ return true;
+}
+
+// static
+InfoBarDelegate* PopupBlockedInfoBarDelegate::Create(
+ InfoBarService* infobar_service,
+ int n_popups) {
+ scoped_ptr<InfoBarDelegate> new_delegate(
+ new PopupBlockedInfoBarDelegate(infobar_service, n_popups));
+
+ // See if there is an existing popup infobar already.
+ for (size_t i = 0; i < infobar_service->infobar_count(); ++i) {
+ if (infobar_service->infobar_at(i)->AsPopupBlockedInfoBarDelegate()) {
+ return infobar_service->ReplaceInfoBar(
+ infobar_service->infobar_at(i),
+ new_delegate.PassAs<InfoBarDelegate>());
+ }
+ }
+
+ return infobar_service->AddInfoBar(new_delegate.PassAs<InfoBarDelegate>());
+}
« no previous file with comments | « chrome/browser/ui/blocked_content/popup_blocked_infobar_delegate.h ('k') | chrome/chrome_browser_ui.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698