| OLD | NEW |
| 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/tab_contents/tab_contents_controller.h" | 5 #import "chrome/browser/ui/cocoa/tab_contents/tab_contents_controller.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/command_line.h" | |
| 10 #include "base/mac/scoped_cftyperef.h" | 9 #include "base/mac/scoped_cftyperef.h" |
| 11 #include "base/mac/scoped_nsobject.h" | 10 #include "base/mac/scoped_nsobject.h" |
| 12 #include "chrome/browser/devtools/devtools_window.h" | 11 #include "chrome/browser/devtools/devtools_window.h" |
| 13 #import "chrome/browser/themes/theme_properties.h" | 12 #import "chrome/browser/themes/theme_properties.h" |
| 14 #import "chrome/browser/themes/theme_service.h" | 13 #import "chrome/browser/themes/theme_service.h" |
| 15 #import "chrome/browser/ui/cocoa/themed_window.h" | 14 #import "chrome/browser/ui/cocoa/themed_window.h" |
| 16 #include "content/public/browser/render_view_host.h" | 15 #include "content/public/browser/render_view_host.h" |
| 17 #include "content/public/browser/render_widget_host_view.h" | 16 #include "content/public/browser/render_widget_host_view.h" |
| 18 #include "content/public/browser/web_contents.h" | 17 #include "content/public/browser/web_contents.h" |
| 19 #include "content/public/browser/web_contents_observer.h" | 18 #include "content/public/browser/web_contents_observer.h" |
| 20 #include "ui/base/cocoa/animation_utils.h" | 19 #include "ui/base/cocoa/animation_utils.h" |
| 21 #include "ui/base/ui_base_switches.h" | |
| 22 #include "ui/gfx/geometry/rect.h" | 20 #include "ui/gfx/geometry/rect.h" |
| 23 | 21 |
| 24 using content::WebContents; | 22 using content::WebContents; |
| 25 using content::WebContentsObserver; | 23 using content::WebContentsObserver; |
| 26 | 24 |
| 27 // FullscreenObserver is used by TabContentsController to monitor for the | 25 // FullscreenObserver is used by TabContentsController to monitor for the |
| 28 // showing/destruction of fullscreen render widgets. When notified, | 26 // showing/destruction of fullscreen render widgets. When notified, |
| 29 // TabContentsController will alter its child view hierarchy to either embed a | 27 // TabContentsController will alter its child view hierarchy to either embed a |
| 30 // fullscreen render widget view or restore the normal WebContentsView render | 28 // fullscreen render widget view or restore the normal WebContentsView render |
| 31 // view. The embedded fullscreen render widget will fill the user's screen in | 29 // view. The embedded fullscreen render widget will fill the user's screen in |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 } | 77 } |
| 80 | 78 |
| 81 - (NSColor*)computeBackgroundColor; | 79 - (NSColor*)computeBackgroundColor; |
| 82 @end | 80 @end |
| 83 | 81 |
| 84 @implementation TabContentsContainerView | 82 @implementation TabContentsContainerView |
| 85 | 83 |
| 86 - (id)initWithDelegate:(TabContentsController*)delegate { | 84 - (id)initWithDelegate:(TabContentsController*)delegate { |
| 87 if ((self = [super initWithFrame:NSZeroRect])) { | 85 if ((self = [super initWithFrame:NSZeroRect])) { |
| 88 delegate_ = delegate; | 86 delegate_ = delegate; |
| 89 if (!CommandLine::ForCurrentProcess()->HasSwitch( | 87 ScopedCAActionDisabler disabler; |
| 90 switches::kDisableCoreAnimation)) { | 88 base::scoped_nsobject<CALayer> layer([[CALayer alloc] init]); |
| 91 // TODO(ccameron): Remove the -drawRect: method once the | 89 [layer setBackgroundColor:CGColorGetConstantColor(kCGColorWhite)]; |
| 92 // kDisableCoreAnimation switch is removed. | 90 [self setLayer:layer]; |
| 93 ScopedCAActionDisabler disabler; | 91 [self setWantsLayer:YES]; |
| 94 base::scoped_nsobject<CALayer> layer([[CALayer alloc] init]); | |
| 95 [layer setBackgroundColor:CGColorGetConstantColor(kCGColorWhite)]; | |
| 96 [self setLayer:layer]; | |
| 97 [self setWantsLayer:YES]; | |
| 98 } | |
| 99 } | 92 } |
| 100 return self; | 93 return self; |
| 101 } | 94 } |
| 102 | 95 |
| 103 // Called by the delegate during dealloc to invalidate the pointer held by this | 96 // Called by the delegate during dealloc to invalidate the pointer held by this |
| 104 // view. | 97 // view. |
| 105 - (void)delegateDestroyed { | 98 - (void)delegateDestroyed { |
| 106 delegate_ = nil; | 99 delegate_ = nil; |
| 107 } | 100 } |
| 108 | 101 |
| (...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 350 } else { | 343 } else { |
| 351 rect.ClampToCenteredSize(gfx::Size( | 344 rect.ClampToCenteredSize(gfx::Size( |
| 352 static_cast<int>(x / captureSize.height()), rect.height())); | 345 static_cast<int>(x / captureSize.height()), rect.height())); |
| 353 } | 346 } |
| 354 } | 347 } |
| 355 | 348 |
| 356 return NSRectFromCGRect(rect.ToCGRect()); | 349 return NSRectFromCGRect(rect.ToCGRect()); |
| 357 } | 350 } |
| 358 | 351 |
| 359 @end | 352 @end |
| OLD | NEW |