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

Side by Side Diff: chrome/browser/cocoa/extensions/extension_popup_controller.mm

Issue 508010: [Mac] Fixes a bug where an ExtensionPopupController object's pointer was neve... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 years 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #import "chrome/browser/cocoa/extensions/extension_popup_controller.h" 5 #import "chrome/browser/cocoa/extensions/extension_popup_controller.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "chrome/browser/browser.h" 9 #include "chrome/browser/browser.h"
10 #import "chrome/browser/cocoa/browser_window_cocoa.h" 10 #import "chrome/browser/cocoa/browser_window_cocoa.h"
11 #import "chrome/browser/cocoa/extension_view_mac.h" 11 #import "chrome/browser/cocoa/extension_view_mac.h"
12 #import "chrome/browser/cocoa/info_bubble_window.h" 12 #import "chrome/browser/cocoa/info_bubble_window.h"
13 #include "chrome/browser/extensions/extension_host.h" 13 #include "chrome/browser/extensions/extension_host.h"
14 #include "chrome/browser/extensions/extension_process_manager.h" 14 #include "chrome/browser/extensions/extension_process_manager.h"
15 #include "chrome/browser/profile.h" 15 #include "chrome/browser/profile.h"
16 #include "chrome/common/notification_service.h"
16 17
17 // The minimum/maximum dimensions of the popup. 18 // The minimum/maximum dimensions of the popup.
18 // The minimum is just a little larger than the size of the button itself. 19 // The minimum is just a little larger than the size of the button itself.
19 // The maximum is an arbitrary number that should be smaller than most screens. 20 // The maximum is an arbitrary number that should be smaller than most screens.
20 namespace { 21 namespace {
21 const CGFloat kMinWidth = 25; 22 const CGFloat kMinWidth = 25;
22 const CGFloat kMinHeight = 25; 23 const CGFloat kMinHeight = 25;
23 const CGFloat kMaxWidth = 800; 24 const CGFloat kMaxWidth = 800;
24 const CGFloat kMaxHeight = 600; 25 const CGFloat kMaxHeight = 600;
25 26
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 [[NSNotificationCenter defaultCenter] removeObserver:self]; 89 [[NSNotificationCenter defaultCenter] removeObserver:self];
89 [self autorelease]; 90 [self autorelease];
90 } 91 }
91 92
92 - (ExtensionHost*)host { 93 - (ExtensionHost*)host {
93 return host_.get(); 94 return host_.get();
94 } 95 }
95 96
96 - (void)windowDidResignKey:(NSNotification *)notification { 97 - (void)windowDidResignKey:(NSNotification *)notification {
97 DCHECK_EQ([notification object], [self window]); 98 DCHECK_EQ([notification object], [self window]);
98 [self close]; 99 NotificationService::current()->Notify(
100 NotificationType::EXTENSION_HOST_VIEW_SHOULD_CLOSE,
101 Source<Profile>(host_->profile()),
102 Details<ExtensionHost>(host_.get()));
99 } 103 }
100 104
101 - (void)close { 105 - (void)close {
102 [parentWindow_ removeChildWindow:[self window]]; 106 [parentWindow_ removeChildWindow:[self window]];
103 [super close]; 107 [super close];
104 } 108 }
105 109
106 + (ExtensionPopupController*)showURL:(GURL)url 110 + (ExtensionPopupController*)showURL:(GURL)url
107 inBrowser:(Browser*)browser 111 inBrowser:(Browser*)browser
108 anchoredAt:(NSPoint)anchoredAt 112 anchoredAt:(NSPoint)anchoredAt
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 return minSize; 205 return minSize;
202 } 206 }
203 207
204 // Private (TestingAPI) 208 // Private (TestingAPI)
205 + (NSSize)maxPopupSize { 209 + (NSSize)maxPopupSize {
206 NSSize maxSize = {kMaxWidth, kMaxHeight}; 210 NSSize maxSize = {kMaxWidth, kMaxHeight};
207 return maxSize; 211 return maxSize;
208 } 212 }
209 213
210 @end 214 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698