summaryrefslogtreecommitdiffstats
path: root/chrome/browser/cocoa/blocked_popup_container_controller.h
diff options
context:
space:
mode:
authorpinkerton@chromium.org <pinkerton@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-01 15:50:51 +0000
committerpinkerton@chromium.org <pinkerton@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-01 15:50:51 +0000
commitdd716ab80774cba276e8b5eb61041f9497ddf642 (patch)
tree1e408f488b0a8b2fb8f38481e042f1f6db12e658 /chrome/browser/cocoa/blocked_popup_container_controller.h
parent31a9bdff16526415c4c00aba0cb41cc6654d3e69 (diff)
downloadchromium_src-dd716ab80774cba276e8b5eb61041f9497ddf642.zip
chromium_src-dd716ab80774cba276e8b5eb61041f9497ddf642.tar.gz
chromium_src-dd716ab80774cba276e8b5eb61041f9497ddf642.tar.bz2
First cut at popup blocking for Mac. Remove ifdefs in cross-platform code. Implement displaying of notification, menu of popups still to come.
BUG=13160 TEST=popup notification should display and popups blocked accordingly. Can close notification widget to prevent more notifications for this tab. Review URL: http://codereview.chromium.org/150132 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@19735 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/cocoa/blocked_popup_container_controller.h')
-rw-r--r--chrome/browser/cocoa/blocked_popup_container_controller.h52
1 files changed, 52 insertions, 0 deletions
diff --git a/chrome/browser/cocoa/blocked_popup_container_controller.h b/chrome/browser/cocoa/blocked_popup_container_controller.h
new file mode 100644
index 0000000..39cba6f
--- /dev/null
+++ b/chrome/browser/cocoa/blocked_popup_container_controller.h
@@ -0,0 +1,52 @@
+// Copyright (c) 2009 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_VIEWS_BLOCKED_POPUP_CONTAINER_CONTROLLER_H_
+#define CHROME_BROWSER_VIEWS_BLOCKED_POPUP_CONTAINER_CONTROLLER_H_
+
+#import <Cocoa/Cocoa.h>
+
+#include "base/scoped_nsobject.h"
+#include "base/scoped_ptr.h"
+#include "chrome/browser/blocked_popup_container.h"
+
+// Controller for the blocked popup view. Communicates with the cross-platform
+// code via a C++ bridge class, below. The BlockedPopupContainer class doesn't
+// really "own" the bridge, it just keeps a pointer to it and calls Destroy() on
+// it when it's supposed to go away. As a result, this class needs to own itself
+// (always keep an extra retain), and will autorelease itself (and the bridge
+// which it owns) when the bridge gets a Destroy() message.
+// TODO(pinkerton): Reverse the ownership if it makes more sense. I'm leaving
+// it this way because I assume we eventually want this to be a
+// NSViewController, and we usually have the Obj-C controller owning the
+// bridge (rather than the other way around).
+@interface BlockedPopupContainerController : NSObject {
+ @private
+ scoped_ptr<BlockedPopupContainerView> bridge_;
+ BlockedPopupContainer* container_; // Weak. "owns" me.
+ scoped_nsobject<NSView> view_;
+ IBOutlet NSTextField* label_;
+}
+
+// Initialize with the given popup container. Creates the C++ bridge object
+// used to represet the "view".
+- (id)initWithContainer:(BlockedPopupContainer*)container;
+
+// Returns the C++ brige object.
+- (BlockedPopupContainerView*)bridge;
+
+// Called by the bridge to perform certain actions from the back-end code.
+- (void)show;
+- (void)hide;
+- (void)update;
+
+@end
+
+@interface BlockedPopupContainerController(ForTesting)
+- (NSView*)view;
+- (NSView*)label;
+- (IBAction)closePopup:(id)sender;
+@end
+
+#endif // CHROME_BROWSER_VIEWS_BLOCKED_POPUP_CONTAINER_CONTROLLER_H_