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

Side by Side Diff: chrome/browser/cocoa/extension_shelf_controller.mm

Issue 267082: Makes it so when NSViewControllers go away that they remove their views from ... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 11 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 unified diff | Download patch | Annotate | Revision Log
Property Changes:
Added: svn:eol-style
+ LF
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 "extension_shelf_controller.h" 5 #import "extension_shelf_controller.h"
6 6
7 #include "base/mac_util.h" 7 #include "base/mac_util.h"
8 #include "chrome/browser/browser.h" 8 #include "chrome/browser/browser.h"
9 #include "chrome/browser/extensions/extension_shelf_model.h" 9 #include "chrome/browser/extensions/extension_shelf_model.h"
10 #include "skia/ext/skia_utils_mac.h" 10 #include "skia/ext/skia_utils_mac.h"
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after
321 browser_ = browser; 321 browser_ = browser;
322 shelfHeight_ = [[self view] bounds].size.height; 322 shelfHeight_ = [[self view] bounds].size.height;
323 323
324 NSRect frame = [[self view] frame]; 324 NSRect frame = [[self view] frame];
325 frame.size.height = 0; 325 frame.size.height = 0;
326 [[self view] setFrame:frame]; 326 [[self view] setFrame:frame];
327 } 327 }
328 return self; 328 return self;
329 } 329 }
330 330
331 - (void)dealloc {
332 // Remove our view from its superview so it doesn't attempt to reference
333 // it when the controller is gone.
334 [[self view] removeFromSuperview];
335 [super dealloc];
336 }
337
331 - (void)wasInsertedIntoWindow { 338 - (void)wasInsertedIntoWindow {
332 // The bridge_ calls cacheDisplayInRect:toBitmapImageRep:, which requires that 339 // The bridge_ calls cacheDisplayInRect:toBitmapImageRep:, which requires that
333 // the view is in a superview to work. Hence, create the bridge object no 340 // the view is in a superview to work. Hence, create the bridge object no
334 // sooner. 341 // sooner.
335 DCHECK(bridge_.get() == NULL); 342 DCHECK(bridge_.get() == NULL);
336 bridge_.reset(new ExtensionShelfMac(browser_, self)); 343 bridge_.reset(new ExtensionShelfMac(browser_, self));
337 } 344 }
338 345
339 - (IBAction)show:(id)sender { 346 - (IBAction)show:(id)sender {
340 [resizeDelegate_ resizeView:[self view] newHeight:shelfHeight_]; 347 [resizeDelegate_ resizeView:[self view] newHeight:shelfHeight_];
341 } 348 }
342 349
343 - (IBAction)hide:(id)sender { 350 - (IBAction)hide:(id)sender {
344 [resizeDelegate_ resizeView:[self view] newHeight:0]; 351 [resizeDelegate_ resizeView:[self view] newHeight:0];
345 } 352 }
346 353
347 - (CGFloat)height { 354 - (CGFloat)height {
348 return shelfHeight_; 355 return shelfHeight_;
349 } 356 }
350 357
351 - (void)updateVisibility:(id)sender { 358 - (void)updateVisibility:(id)sender {
352 if(bridge_.get()) 359 if(bridge_.get())
353 bridge_->AdjustHeight(); 360 bridge_->AdjustHeight();
354 } 361 }
355 362
356 @end 363 @end
OLDNEW
« no previous file with comments | « chrome/browser/cocoa/download_shelf_controller.mm ('k') | chrome/browser/cocoa/find_bar_cocoa_controller.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698