| OLD | NEW |
| 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 #include "base/mac_util.h" | 5 #include "base/mac_util.h" |
| 6 #import "chrome/browser/cocoa/tab_controller.h" | 6 #import "chrome/browser/cocoa/tab_controller.h" |
| 7 #import "chrome/browser/cocoa/tab_controller_target.h" | 7 #import "chrome/browser/cocoa/tab_controller_target.h" |
| 8 #import "chrome/browser/cocoa/tab_view.h" | 8 #import "chrome/browser/cocoa/tab_view.h" |
| 9 #import "third_party/GTM/AppKit/GTMTheme.h" | 9 #import "third_party/GTM/AppKit/GTMTheme.h" |
| 10 | 10 |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 [defaultCenter addObserver:self | 41 [defaultCenter addObserver:self |
| 42 selector:@selector(themeChangedNotification:) | 42 selector:@selector(themeChangedNotification:) |
| 43 name:kGTMThemeDidChangeNotification | 43 name:kGTMThemeDidChangeNotification |
| 44 object:nil]; | 44 object:nil]; |
| 45 } | 45 } |
| 46 return self; | 46 return self; |
| 47 } | 47 } |
| 48 | 48 |
| 49 - (void)dealloc { | 49 - (void)dealloc { |
| 50 [[NSNotificationCenter defaultCenter] removeObserver:self]; | 50 [[NSNotificationCenter defaultCenter] removeObserver:self]; |
| 51 // Remove our view from its superview so it doesn't attempt to reference |
| 52 // it when the controller is gone. |
| 53 [[self view] removeFromSuperview]; |
| 51 [super dealloc]; | 54 [super dealloc]; |
| 52 } | 55 } |
| 53 | 56 |
| 54 // The internals of |-setSelected:| but doesn't check if we're already set | 57 // The internals of |-setSelected:| but doesn't check if we're already set |
| 55 // to |selected|. Pass the selection change to the subviews that need it and | 58 // to |selected|. Pass the selection change to the subviews that need it and |
| 56 // mark ourselves as needing a redraw. | 59 // mark ourselves as needing a redraw. |
| 57 - (void)internalSetSelected:(BOOL)selected { | 60 - (void)internalSetSelected:(BOOL)selected { |
| 58 selected_ = selected; | 61 selected_ = selected; |
| 59 TabView* tabView = static_cast<TabView*>([self view]); | 62 TabView* tabView = static_cast<TabView*>([self view]); |
| 60 [tabView setState:selected]; | 63 [tabView setState:selected]; |
| (...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 248 // Called by the tabs to determine whether we are in rapid (tab) closure mode. | 251 // Called by the tabs to determine whether we are in rapid (tab) closure mode. |
| 249 - (BOOL)inRapidClosureMode { | 252 - (BOOL)inRapidClosureMode { |
| 250 if ([[self target] respondsToSelector:@selector(inRapidClosureMode)]) { | 253 if ([[self target] respondsToSelector:@selector(inRapidClosureMode)]) { |
| 251 return [[self target] performSelector:@selector(inRapidClosureMode)] ? | 254 return [[self target] performSelector:@selector(inRapidClosureMode)] ? |
| 252 YES : NO; | 255 YES : NO; |
| 253 } | 256 } |
| 254 return NO; | 257 return NO; |
| 255 } | 258 } |
| 256 | 259 |
| 257 @end | 260 @end |
| OLD | NEW |