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

Unified Diff: chrome/browser/cocoa/base_bubble_controller.mm

Issue 3461016: [Mac] Convert the page info window to a bubble. (Closed) Base URL: http://src.chromium.org/git/chromium.git
Patch Set: Address nits Created 10 years, 3 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
Index: chrome/browser/cocoa/base_bubble_controller.mm
diff --git a/chrome/browser/cocoa/base_bubble_controller.mm b/chrome/browser/cocoa/base_bubble_controller.mm
index b155a4f75c47cdca1d61ae775dc2d9879b6cfbf4..9cebc61451141f410889771be2b1252025d1290f 100644
--- a/chrome/browser/cocoa/base_bubble_controller.mm
+++ b/chrome/browser/cocoa/base_bubble_controller.mm
@@ -7,12 +7,14 @@
#include "app/l10n_util.h"
#include "base/logging.h"
#include "base/mac_util.h"
+#include "base/scoped_nsobject.h"
#include "base/string_util.h"
#import "chrome/browser/cocoa/info_bubble_view.h"
#include "grit/generated_resources.h"
@implementation BaseBubbleController
+@synthesize parentWindow = parentWindow_;
@synthesize bubble = bubble_;
- (id)initWithWindowNibPath:(NSString*)nibPath
@@ -48,6 +50,32 @@
anchoredAt:anchor];
}
+- (id)initWithWindow:(NSWindow*)theWindow
+ parentWindow:(NSWindow*)parentWindow
+ anchoredAt:(NSPoint)anchoredAt {
+ DCHECK(theWindow);
+ if ((self = [super initWithWindow:theWindow])) {
+ parentWindow_ = parentWindow;
+ anchor_ = anchoredAt;
+ DCHECK(![[self window] delegate]);
+ [theWindow setDelegate:self];
+
+ scoped_nsobject<InfoBubbleView> contentView(
+ [[InfoBubbleView alloc] initWithFrame:NSMakeRect(0, 0, 0, 0)]);
+ [theWindow setContentView:contentView.get()];
+ bubble_ = contentView.get();
+
+ // Watch to see if the parent window closes, and if so, close this one.
+ NSNotificationCenter* center = [NSNotificationCenter defaultCenter];
+ [center addObserver:self
+ selector:@selector(parentWindowWillClose:)
+ name:NSWindowWillCloseNotification
+ object:parentWindow_];
+
+ [self awakeFromNib];
+ }
+ return self;
+}
- (void)awakeFromNib {
// Check all connections have been made in Interface Builder.
« no previous file with comments | « chrome/browser/cocoa/base_bubble_controller.h ('k') | chrome/browser/cocoa/location_bar/location_bar_view_mac.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698