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

Side by Side Diff: content/browser/renderer_host/render_widget_host_view_mac.mm

Issue 2738373002: Enhance chrome.app.window API with window background color (Closed)
Patch Set: Created 3 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) 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 #include "content/browser/renderer_host/render_widget_host_view_mac.h" 5 #include "content/browser/renderer_host/render_widget_host_view_mac.h"
6 6
7 #import <Carbon/Carbon.h> 7 #import <Carbon/Carbon.h>
8 #import <objc/runtime.h> 8 #import <objc/runtime.h>
9 #include <OpenGL/gl.h> 9 #include <OpenGL/gl.h>
10 #include <QuartzCore/QuartzCore.h> 10 #include <QuartzCore/QuartzCore.h>
(...skipping 1632 matching lines...) Expand 10 before | Expand all | Expand 10 after
1643 void RenderWidgetHostViewMac::SetBackgroundColor(SkColor color) { 1643 void RenderWidgetHostViewMac::SetBackgroundColor(SkColor color) {
1644 if (color == background_color_) 1644 if (color == background_color_)
1645 return; 1645 return;
1646 1646
1647 RenderWidgetHostViewBase::SetBackgroundColor(color); 1647 RenderWidgetHostViewBase::SetBackgroundColor(color);
1648 bool opaque = GetBackgroundOpaque(); 1648 bool opaque = GetBackgroundOpaque();
1649 1649
1650 if (render_widget_host_) 1650 if (render_widget_host_)
1651 render_widget_host_->SetBackgroundOpaque(opaque); 1651 render_widget_host_->SetBackgroundOpaque(opaque);
1652 1652
1653 if (opaque && color != SK_ColorWHITE)
1654 render_widget_host_->SetBaseBackgroundColor(color);
1655
1653 [cocoa_view_ setOpaque:opaque]; 1656 [cocoa_view_ setOpaque:opaque];
1654 1657
1655 browser_compositor_->SetHasTransparentBackground(!opaque); 1658 browser_compositor_->SetHasTransparentBackground(!opaque);
1656 1659
1657 ScopedCAActionDisabler disabler; 1660 ScopedCAActionDisabler disabler;
1658 base::ScopedCFTypeRef<CGColorRef> cg_color( 1661 base::ScopedCFTypeRef<CGColorRef> cg_color(
1659 skia::CGColorCreateFromSkColor(color)); 1662 skia::CGColorCreateFromSkColor(color));
1660 [background_layer_ setBackgroundColor:cg_color]; 1663 [background_layer_ setBackgroundColor:cg_color];
1661 } 1664 }
1662 1665
(...skipping 1826 matching lines...) Expand 10 before | Expand all | Expand 10 after
3489 3492
3490 // "-webkit-app-region: drag | no-drag" is implemented on Mac by excluding 3493 // "-webkit-app-region: drag | no-drag" is implemented on Mac by excluding
3491 // regions that are not draggable. (See ControlRegionView in 3494 // regions that are not draggable. (See ControlRegionView in
3492 // native_app_window_cocoa.mm). This requires the render host view to be 3495 // native_app_window_cocoa.mm). This requires the render host view to be
3493 // draggable by default. 3496 // draggable by default.
3494 - (BOOL)mouseDownCanMoveWindow { 3497 - (BOOL)mouseDownCanMoveWindow {
3495 return YES; 3498 return YES;
3496 } 3499 }
3497 3500
3498 @end 3501 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698