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

Side by Side Diff: chrome/browser/ui/cocoa/fast_resize_view.mm

Issue 184433005: Give the browser window's content view a CALayers (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove unneeded include Created 6 years, 9 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) 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 #import <Cocoa/Cocoa.h>
6 #import "chrome/browser/ui/cocoa/fast_resize_view.h" 5 #import "chrome/browser/ui/cocoa/fast_resize_view.h"
7 6
7 #import <Cocoa/Cocoa.h>
8
8 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/command_line.h"
11 #include "ui/base/cocoa/animation_utils.h"
12 #include "ui/base/ui_base_switches.h"
9 13
10 @interface FastResizeView (PrivateMethods) 14 @interface FastResizeView (PrivateMethods)
11 // Lays out this views subviews. If fast resize mode is on, does not resize any 15 // Lays out this views subviews. If fast resize mode is on, does not resize any
12 // subviews and instead pegs them to the top left. If fast resize mode is off, 16 // subviews and instead pegs them to the top left. If fast resize mode is off,
13 // sets the subviews' frame to be equal to this view's bounds. 17 // sets the subviews' frame to be equal to this view's bounds.
14 - (void)layoutSubviews; 18 - (void)layoutSubviews;
15 @end 19 @end
16 20
17 @implementation FastResizeView 21 @implementation FastResizeView
18 22
23 - (id)initWithFrame:(NSRect)frameRect {
24 if ((self = [super initWithFrame:frameRect])) {
25 if (!CommandLine::ForCurrentProcess()->HasSwitch(
26 switches::kDisableCoreAnimation)) {
27 ScopedCAActionDisabler disabler;
28 CALayer* layer = [[CALayer alloc] init];
Avi (use Gerrit) 2014/03/05 16:17:02 scoped_nsobject
ccameron 2014/03/05 18:18:40 Done.
29 [layer setBackgroundColor:CGColorGetConstantColor(kCGColorWhite)];
30 [self setLayer:layer];
31 [self setWantsLayer:YES];
32 [layer release];
33 }
34 }
35 return self;
36 }
37
38 - (BOOL)isOpaque {
39 return YES;
40 }
41
19 - (void)setFastResizeMode:(BOOL)fastResizeMode { 42 - (void)setFastResizeMode:(BOOL)fastResizeMode {
20 if (fastResizeMode_ == fastResizeMode) 43 if (fastResizeMode_ == fastResizeMode)
21 return; 44 return;
22 45
23 fastResizeMode_ = fastResizeMode; 46 fastResizeMode_ = fastResizeMode;
24 47
25 // Force a relayout when coming out of fast resize mode. 48 // Force a relayout when coming out of fast resize mode.
26 if (!fastResizeMode_) 49 if (!fastResizeMode_)
27 [self layoutSubviews]; 50 [self layoutSubviews];
28 51
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 NSRect frame = [subview frame]; 87 NSRect frame = [subview frame];
65 frame.origin.x = 0; 88 frame.origin.x = 0;
66 frame.origin.y = NSHeight(bounds) - NSHeight(frame); 89 frame.origin.y = NSHeight(bounds) - NSHeight(frame);
67 [subview setFrame:frame]; 90 [subview setFrame:frame];
68 } else { 91 } else {
69 [subview setFrame:bounds]; 92 [subview setFrame:bounds];
70 } 93 }
71 } 94 }
72 95
73 @end 96 @end
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/browser_window_controller.mm ('k') | chrome/browser/ui/cocoa/presentation_mode_controller.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698