OLD | NEW |
---|---|
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "chrome/browser/ui/views/apps/app_window_native_widget_mac.h" | 5 #include "chrome/browser/ui/views/apps/app_window_native_widget_mac.h" |
6 | 6 |
7 #import <Cocoa/Cocoa.h> | 7 #import <Cocoa/Cocoa.h> |
8 | 8 |
9 #import "chrome/browser/ui/cocoa/apps/titlebar_background_view.h" | |
9 #import "chrome/browser/ui/views/frame/native_widget_mac_frameless_nswindow.h" | 10 #import "chrome/browser/ui/views/frame/native_widget_mac_frameless_nswindow.h" |
11 #include "extensions/browser/app_window/native_app_window.h" | |
10 #import "ui/base/cocoa/window_size_constants.h" | 12 #import "ui/base/cocoa/window_size_constants.h" |
13 #import "ui/gfx/mac/nswindow_frame_controls.h" | |
tapted
2015/05/12 06:15:43
unused?
jackhou1
2015/05/14 02:59:13
Done.
| |
11 | 14 |
12 AppWindowNativeWidgetMac::AppWindowNativeWidgetMac(views::Widget* widget) | 15 AppWindowNativeWidgetMac::AppWindowNativeWidgetMac( |
13 : NativeWidgetMac(widget) { | 16 views::Widget* widget, |
17 extensions::NativeAppWindow* native_app_window) | |
18 : NativeWidgetMac(widget), native_app_window_(native_app_window) { | |
14 } | 19 } |
15 | 20 |
16 AppWindowNativeWidgetMac::~AppWindowNativeWidgetMac() { | 21 AppWindowNativeWidgetMac::~AppWindowNativeWidgetMac() { |
17 } | 22 } |
18 | 23 |
19 NSWindow* AppWindowNativeWidgetMac::CreateNSWindow( | 24 NSWindow* AppWindowNativeWidgetMac::CreateNSWindow( |
20 const views::Widget::InitParams& params) { | 25 const views::Widget::InitParams& params) { |
21 // If the window has a standard frame, use the same NSWindow as | 26 // If the window has a native or colored frame, use the same NSWindow as |
22 // NativeWidgetMac. | 27 // NativeWidgetMac. |
23 if (!params.remove_standard_frame) | 28 if (!native_app_window_->IsFrameless()) { |
24 return NativeWidgetMac::CreateNSWindow(params); | 29 NSWindow* ns_window = NativeWidgetMac::CreateNSWindow(params); |
30 if (native_app_window_->HasFrameColor()) { | |
31 [TitlebarBackgroundView | |
32 addToNSWindow:ns_window | |
33 activeColor:native_app_window_->ActiveFrameColor() | |
34 inactiveColor:native_app_window_->InactiveFrameColor()]; | |
35 } | |
36 return ns_window; | |
37 } | |
25 | 38 |
26 // NSTexturedBackgroundWindowMask is needed to implement draggable window | 39 // NSTexturedBackgroundWindowMask is needed to implement draggable window |
27 // regions. | 40 // regions. |
28 NSUInteger style_mask = NSTexturedBackgroundWindowMask | NSTitledWindowMask | | 41 NSUInteger style_mask = NSTexturedBackgroundWindowMask | NSTitledWindowMask | |
29 NSClosableWindowMask | NSMiniaturizableWindowMask | | 42 NSClosableWindowMask | NSMiniaturizableWindowMask | |
30 NSResizableWindowMask; | 43 NSResizableWindowMask; |
31 return [[[NativeWidgetMacFramelessNSWindow alloc] | 44 return [[[NativeWidgetMacFramelessNSWindow alloc] |
32 initWithContentRect:ui::kWindowSizeDeterminedLater | 45 initWithContentRect:ui::kWindowSizeDeterminedLater |
33 styleMask:style_mask | 46 styleMask:style_mask |
34 backing:NSBackingStoreBuffered | 47 backing:NSBackingStoreBuffered |
35 defer:YES] autorelease]; | 48 defer:YES] autorelease]; |
36 } | 49 } |
OLD | NEW |