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

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

Issue 2351183003: [Mac] Avoid "adding unknown subview" warning. (Closed)
Patch Set: Address feedback. Created 4 years, 3 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_view.h" 5 #import "chrome/browser/ui/cocoa/tabs/tab_strip_view.h"
6 6
7 #include <cmath> // floor 7 #include <cmath> // floor
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/mac/foundation_util.h" 10 #include "base/mac/foundation_util.h"
(...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after
371 } 371 }
372 372
373 - (NSVisualEffectView*)visualEffectView { 373 - (NSVisualEffectView*)visualEffectView {
374 // NSVisualEffectView is only used in Material Design, and only available on 374 // NSVisualEffectView is only used in Material Design, and only available on
375 // OS X 10.10 and higher. 375 // OS X 10.10 and higher.
376 if (!ui::MaterialDesignController::IsModeMaterial() || 376 if (!ui::MaterialDesignController::IsModeMaterial() ||
377 !base::mac::IsAtLeastOS10_10()) { 377 !base::mac::IsAtLeastOS10_10()) {
378 return nil; 378 return nil;
379 } 379 }
380 380
381 NSView* rootView = [[[self window] contentView] superview]; 381 NSView* rootView = [[self window] contentView];
382 if (base::mac::IsAtMostOS10_10()) {
383 rootView = [rootView superview];
384 }
385
382 Class nsVisualEffectViewClass = NSClassFromString(@"NSVisualEffectView"); 386 Class nsVisualEffectViewClass = NSClassFromString(@"NSVisualEffectView");
383 DCHECK(nsVisualEffectViewClass); 387 DCHECK(nsVisualEffectViewClass);
384 for (NSView* view in [rootView subviews]) { 388 for (NSView* view in [rootView subviews]) {
385 if ([view isKindOfClass:nsVisualEffectViewClass]) { 389 if ([view isKindOfClass:nsVisualEffectViewClass]) {
386 return base::mac::ObjCCast<NSVisualEffectView>(view); 390 return base::mac::ObjCCast<NSVisualEffectView>(view);
387 } 391 }
388 } 392 }
389 return nil; 393 return nil;
390 } 394 }
391 395
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
444 if (visualEffectsDisabledForFullscreen_ || 448 if (visualEffectsDisabledForFullscreen_ ||
445 themeProvider->HasCustomImage(IDR_THEME_FRAME) || 449 themeProvider->HasCustomImage(IDR_THEME_FRAME) ||
446 themeProvider->HasCustomColor(ThemeProperties::COLOR_FRAME)) { 450 themeProvider->HasCustomColor(ThemeProperties::COLOR_FRAME)) {
447 [visualEffectView setState:NSVisualEffectStateInactive]; 451 [visualEffectView setState:NSVisualEffectStateInactive];
448 } else { 452 } else {
449 [visualEffectView setState:NSVisualEffectStateFollowsWindowActiveState]; 453 [visualEffectView setState:NSVisualEffectStateFollowsWindowActiveState];
450 } 454 }
451 } 455 }
452 456
453 @end 457 @end
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/full_size_content_window.mm ('k') | chrome/browser/ui/cocoa/tabs/tab_window_controller.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698