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 29 matching lines...) Expand all Loading... |
40 object:[self view]]; | 40 object:[self view]]; |
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 // Since the tab can be closed from JavaScript it is possible for | |
51 // |contextMenu_| to remain visible after the tab has closed, or for | |
52 // |closeButton_| to be tracking the mouse. Make sure neither sends | |
53 // us an action after -dealloc. | |
54 [closeButton_ setTarget:nil]; | |
55 [contextMenu_ setAutoenablesItems:NO]; | |
56 for (NSMenuItem* item in [contextMenu_ itemArray]) { | |
57 [item setTarget:nil]; | |
58 [item setEnabled:NO]; | |
59 } | |
60 | |
61 [[NSNotificationCenter defaultCenter] removeObserver:self]; | 50 [[NSNotificationCenter defaultCenter] removeObserver:self]; |
62 [super dealloc]; | 51 [super dealloc]; |
63 } | 52 } |
64 | 53 |
65 // The internals of |-setSelected:| but doesn't check if we're already set | 54 // The internals of |-setSelected:| but doesn't check if we're already set |
66 // to |selected|. Pass the selection change to the subviews that need it and | 55 // to |selected|. Pass the selection change to the subviews that need it and |
67 // mark ourselves as needing a redraw. | 56 // mark ourselves as needing a redraw. |
68 - (void)internalSetSelected:(BOOL)selected { | 57 - (void)internalSetSelected:(BOOL)selected { |
69 selected_ = selected; | 58 selected_ = selected; |
70 TabView* tabView = static_cast<TabView*>([self view]); | 59 TabView* tabView = static_cast<TabView*>([self view]); |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
259 // Called by the tabs to determine whether we are in rapid (tab) closure mode. | 248 // Called by the tabs to determine whether we are in rapid (tab) closure mode. |
260 - (BOOL)inRapidClosureMode { | 249 - (BOOL)inRapidClosureMode { |
261 if ([[self target] respondsToSelector:@selector(inRapidClosureMode)]) { | 250 if ([[self target] respondsToSelector:@selector(inRapidClosureMode)]) { |
262 return [[self target] performSelector:@selector(inRapidClosureMode)] ? | 251 return [[self target] performSelector:@selector(inRapidClosureMode)] ? |
263 YES : NO; | 252 YES : NO; |
264 } | 253 } |
265 return NO; | 254 return NO; |
266 } | 255 } |
267 | 256 |
268 @end | 257 @end |
OLD | NEW |