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

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

Issue 2047103003: Mac fullscreen low power: Add unittests (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 6 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/browser_window_controller_private.h" 5 #import "chrome/browser/ui/cocoa/browser_window_controller_private.h"
6 6
7 #include <cmath> 7 #include <cmath>
8 8
9 #import "base/auto_reset.h" 9 #import "base/auto_reset.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 1177 matching lines...) Expand 10 before | Expand all | Expand 10 after
1188 exitingAppKitFullscreen_ = NO; 1188 exitingAppKitFullscreen_ = NO;
1189 isUsingCustomAnimation_ = NO; 1189 isUsingCustomAnimation_ = NO;
1190 } 1190 }
1191 1191
1192 - (NSArray*)customWindowsToEnterFullScreenForWindow:(NSWindow*)window { 1192 - (NSArray*)customWindowsToEnterFullScreenForWindow:(NSWindow*)window {
1193 DCHECK([window isEqual:self.window]); 1193 DCHECK([window isEqual:self.window]);
1194 1194
1195 if (![self shouldUseCustomAppKitFullscreenTransition:YES]) 1195 if (![self shouldUseCustomAppKitFullscreenTransition:YES])
1196 return nil; 1196 return nil;
1197 1197
1198 WebContents* webContents = [self webContents];
1199 NSWindow* lowPowerWindow = nil; 1198 NSWindow* lowPowerWindow = nil;
1200 if (webContents) { 1199 static bool fullscreen_low_power_enabled_at_command_line =
spqchan 2016/06/08 21:43:58 Why static? Do you mean const?
ccameron 2016/06/09 20:47:08 Oh -- I wanted to avoid re-looking-up at each call
1201 fullscreenLowPowerCoordinator_.reset(new FullscreenLowPowerCoordinatorCocoa( 1200 base::CommandLine::ForCurrentProcess()->HasSwitch(
1202 [self window], 1201 switches::kEnableFullscreenLowPowerMode);
1203 webContents->GetRenderWidgetHostView()->GetAcceleratedWidgetMac())); 1202 if (fullscreen_low_power_enabled_at_command_line) {
1204 lowPowerWindow = 1203 WebContents* webContents = [self webContents];
1205 fullscreenLowPowerCoordinator_->GetFullscreenLowPowerWindow(); 1204 if (webContents && webContents->GetRenderWidgetHostView()) {
1205 fullscreenLowPowerCoordinator_.reset(
1206 new FullscreenLowPowerCoordinatorCocoa(
1207 [self window], webContents->GetRenderWidgetHostView()
1208 ->GetAcceleratedWidgetMac()));
1209 lowPowerWindow =
1210 fullscreenLowPowerCoordinator_->GetFullscreenLowPowerWindow();
1211 }
1206 } 1212 }
1207 1213
1208 fullscreenTransition_.reset( 1214 fullscreenTransition_.reset(
1209 [[BrowserWindowFullscreenTransition alloc] initEnterWithController:self]); 1215 [[BrowserWindowFullscreenTransition alloc] initEnterWithController:self]);
1210 1216
1211 NSArray* customWindows = 1217 NSArray* customWindows =
1212 [fullscreenTransition_ customWindowsForFullScreenTransition]; 1218 [fullscreenTransition_ customWindowsForFullScreenTransition];
1213 if (customWindows && lowPowerWindow) 1219 if (customWindows && lowPowerWindow)
1214 customWindows = [customWindows arrayByAddingObject:lowPowerWindow]; 1220 customWindows = [customWindows arrayByAddingObject:lowPowerWindow];
1215 else 1221 else
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
1283 if (fullscreenLowPowerCoordinator_) 1289 if (fullscreenLowPowerCoordinator_)
1284 fullscreenLowPowerCoordinator_->SetHasActiveSheet(false); 1290 fullscreenLowPowerCoordinator_->SetHasActiveSheet(false);
1285 } 1291 }
1286 1292
1287 - (void)childWindowsDidChange { 1293 - (void)childWindowsDidChange {
1288 if (fullscreenLowPowerCoordinator_) 1294 if (fullscreenLowPowerCoordinator_)
1289 fullscreenLowPowerCoordinator_->ChildWindowsChanged(); 1295 fullscreenLowPowerCoordinator_->ChildWindowsChanged();
1290 } 1296 }
1291 1297
1292 @end // @implementation BrowserWindowController(Private) 1298 @end // @implementation BrowserWindowController(Private)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698