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

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

Issue 335048: [Mac] Prevent using tab context menu after tab closed. (Closed)
Patch Set: Also hit closeButton_. Created 11 years, 1 month 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #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
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
50 [[NSNotificationCenter defaultCenter] removeObserver:self]; 61 [[NSNotificationCenter defaultCenter] removeObserver:self];
51 [super dealloc]; 62 [super dealloc];
52 } 63 }
53 64
54 // The internals of |-setSelected:| but doesn't check if we're already set 65 // 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 66 // to |selected|. Pass the selection change to the subviews that need it and
56 // mark ourselves as needing a redraw. 67 // mark ourselves as needing a redraw.
57 - (void)internalSetSelected:(BOOL)selected { 68 - (void)internalSetSelected:(BOOL)selected {
58 selected_ = selected; 69 selected_ = selected;
59 TabView* tabView = static_cast<TabView*>([self view]); 70 TabView* tabView = static_cast<TabView*>([self view]);
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
248 // Called by the tabs to determine whether we are in rapid (tab) closure mode. 259 // Called by the tabs to determine whether we are in rapid (tab) closure mode.
249 - (BOOL)inRapidClosureMode { 260 - (BOOL)inRapidClosureMode {
250 if ([[self target] respondsToSelector:@selector(inRapidClosureMode)]) { 261 if ([[self target] respondsToSelector:@selector(inRapidClosureMode)]) {
251 return [[self target] performSelector:@selector(inRapidClosureMode)] ? 262 return [[self target] performSelector:@selector(inRapidClosureMode)] ?
252 YES : NO; 263 YES : NO;
253 } 264 }
254 return NO; 265 return NO;
255 } 266 }
256 267
257 @end 268 @end
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698