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

Side by Side Diff: chrome/browser/ui/cocoa/tabs/tab_strip_controller.mm

Issue 2404783002: [Mac] Avoid "adding unknown subview" warning. (Closed)
Patch Set: Merged with head Created 4 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/ui/cocoa/tabs/tab_strip_controller.h" 5 #import "chrome/browser/ui/cocoa/tabs/tab_strip_controller.h"
6 6
7 #import <QuartzCore/QuartzCore.h> 7 #import <QuartzCore/QuartzCore.h>
8 8
9 #include <cmath> 9 #include <cmath>
10 #include <limits> 10 #include <limits>
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 }; 137 };
138 138
139 CGFloat FlipXInView(NSView* view, CGFloat width, CGFloat x) { 139 CGFloat FlipXInView(NSView* view, CGFloat width, CGFloat x) {
140 if (cocoa_l10n_util::ShouldDoExperimentalRTLLayout()) 140 if (cocoa_l10n_util::ShouldDoExperimentalRTLLayout())
141 return [view frame].size.width - x - width; 141 return [view frame].size.width - x - width;
142 return x; 142 return x;
143 } 143 }
144 144
145 } // namespace 145 } // namespace
146 146
147 @interface NSView (PrivateAPI)
148 // Called by AppKit to check if dragging this view should move the window.
149 // NSButton overrides this method in the same way so dragging window buttons
150 // has no effect. NSView implementation returns NSZeroRect so the whole view
151 // area can be dragged.
152 - (NSRect)_opaqueRectForWindowMoveWhenInTitlebar;
153 @end
154
147 @interface TabStripController (Private) 155 @interface TabStripController (Private)
148 - (void)addSubviewToPermanentList:(NSView*)aView; 156 - (void)addSubviewToPermanentList:(NSView*)aView;
149 - (void)regenerateSubviewList; 157 - (void)regenerateSubviewList;
150 - (NSInteger)indexForContentsView:(NSView*)view; 158 - (NSInteger)indexForContentsView:(NSView*)view;
151 - (NSImage*)iconImageForContents:(content::WebContents*)contents 159 - (NSImage*)iconImageForContents:(content::WebContents*)contents
152 atIndex:(NSInteger)modelIndex; 160 atIndex:(NSInteger)modelIndex;
153 - (void)updateIconsForContents:(content::WebContents*)contents 161 - (void)updateIconsForContents:(content::WebContents*)contents
154 atIndex:(NSInteger)modelIndex; 162 atIndex:(NSInteger)modelIndex;
155 - (void)layoutTabsWithAnimation:(BOOL)animate 163 - (void)layoutTabsWithAnimation:(BOOL)animate
156 regenerateSubviews:(BOOL)doUpdate; 164 regenerateSubviews:(BOOL)doUpdate;
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 // http://www.cocoabuilder.com/archive/cocoa/219261-conditional-mousedowncanmove window-for-nsview.html 230 // http://www.cocoabuilder.com/archive/cocoa/219261-conditional-mousedowncanmove window-for-nsview.html
223 // http://www.cocoabuilder.com/archive/cocoa/92973-brushed-metal-window-dragging .html 231 // http://www.cocoabuilder.com/archive/cocoa/92973-brushed-metal-window-dragging .html
224 - (void)trackClickForWindowMove:(NSEvent*)event; 232 - (void)trackClickForWindowMove:(NSEvent*)event;
225 @end 233 @end
226 234
227 @implementation TabStripControllerDragBlockingView 235 @implementation TabStripControllerDragBlockingView
228 - (BOOL)mouseDownCanMoveWindow { 236 - (BOOL)mouseDownCanMoveWindow {
229 return NO; 237 return NO;
230 } 238 }
231 239
240 - (NSRect)_opaqueRectForWindowMoveWhenInTitlebar {
241 return [self bounds];
242 }
243
232 - (id)initWithFrame:(NSRect)frameRect 244 - (id)initWithFrame:(NSRect)frameRect
233 controller:(TabStripController*)controller { 245 controller:(TabStripController*)controller {
234 if ((self = [super initWithFrame:frameRect])) { 246 if ((self = [super initWithFrame:frameRect])) {
235 controller_ = controller; 247 controller_ = controller;
236 } 248 }
237 return self; 249 return self;
238 } 250 }
239 251
240 // In "rapid tab closure" mode (i.e., the user is clicking close tab buttons in 252 // In "rapid tab closure" mode (i.e., the user is clicking close tab buttons in
241 // rapid succession), the animations confuse Cocoa's hit testing (which appears 253 // rapid succession), the animations confuse Cocoa's hit testing (which appears
(...skipping 2081 matching lines...) Expand 10 before | Expand all | Expand 10 after
2323 for (int i = 0; i < tabStripModel_->count(); i++) { 2335 for (int i = 0; i < tabStripModel_->count(); i++) {
2324 [self updateIconsForContents:tabStripModel_->GetWebContentsAt(i) atIndex:i]; 2336 [self updateIconsForContents:tabStripModel_->GetWebContentsAt(i) atIndex:i];
2325 } 2337 }
2326 } 2338 }
2327 2339
2328 - (void)setVisualEffectsDisabledForFullscreen:(BOOL)fullscreen { 2340 - (void)setVisualEffectsDisabledForFullscreen:(BOOL)fullscreen {
2329 [tabStripView_ setVisualEffectsDisabledForFullscreen:fullscreen]; 2341 [tabStripView_ setVisualEffectsDisabledForFullscreen:fullscreen];
2330 } 2342 }
2331 2343
2332 @end 2344 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698