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

Side by Side Diff: ui/views/widget/native_widget_mac.mm

Issue 329743002: MacViews: Initial skeleton for implementing NativeWidgetMac (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: respond to comments Created 6 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 | Annotate | Revision Log
« no previous file with comments | « ui/views/widget/native_widget_mac.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "ui/views/widget/native_widget_mac.h" 5 #include "ui/views/widget/native_widget_mac.h"
6 6
7 #include <Cocoa/Cocoa.h> 7 #import <Cocoa/Cocoa.h>
8 8
9 #include "base/mac/scoped_nsobject.h"
9 #include "ui/gfx/font_list.h" 10 #include "ui/gfx/font_list.h"
10 #include "ui/native_theme/native_theme.h" 11 #include "ui/native_theme/native_theme.h"
12 #import "ui/views/cocoa/bridged_content_view.h"
13 #import "ui/views/cocoa/bridged_native_widget.h"
11 14
12 namespace views { 15 namespace views {
13 16
14 //////////////////////////////////////////////////////////////////////////////// 17 ////////////////////////////////////////////////////////////////////////////////
15 // NativeWidgetMac, public: 18 // NativeWidgetMac, public:
16 19
17 NativeWidgetMac::NativeWidgetMac(internal::NativeWidgetDelegate* delegate) 20 NativeWidgetMac::NativeWidgetMac(internal::NativeWidgetDelegate* delegate)
18 : delegate_(delegate), window_(nil) { 21 : delegate_(delegate), bridge_(new BridgedNativeWidget) {
19 } 22 }
20 23
21 NativeWidgetMac::~NativeWidgetMac() { 24 NativeWidgetMac::~NativeWidgetMac() {
22 } 25 }
23 26
24 //////////////////////////////////////////////////////////////////////////////// 27 ////////////////////////////////////////////////////////////////////////////////
25 // NativeWidgetMac, internal::NativeWidgetPrivate implementation: 28 // NativeWidgetMac, internal::NativeWidgetPrivate implementation:
26 29
27 void NativeWidgetMac::InitNativeWidget(const Widget::InitParams& params) { 30 void NativeWidgetMac::InitNativeWidget(const Widget::InitParams& params) {
28 // TODO(tapted): Convert position into Cocoa's flipped coordinate space. 31 // TODO(tapted): Convert position into Cocoa's flipped coordinate space.
29 NSRect content_rect = 32 NSRect content_rect =
30 NSMakeRect(0, 0, params.bounds.width(), params.bounds.height()); 33 NSMakeRect(0, 0, params.bounds.width(), params.bounds.height());
31 // TODO(tapted): Determine a good initial style mask from |params|. 34 // TODO(tapted): Determine a good initial style mask from |params|.
32 NSInteger style_mask = NSTitledWindowMask | NSClosableWindowMask | 35 NSInteger style_mask = NSTitledWindowMask | NSClosableWindowMask |
33 NSMiniaturizableWindowMask | NSResizableWindowMask; 36 NSMiniaturizableWindowMask | NSResizableWindowMask;
34 window_.reset([[NSWindow alloc] initWithContentRect:content_rect 37 base::scoped_nsobject<NSWindow> window(
35 styleMask:style_mask 38 [[NSWindow alloc] initWithContentRect:content_rect
36 backing:NSBackingStoreBuffered 39 styleMask:style_mask
37 defer:NO]); 40 backing:NSBackingStoreBuffered
41 defer:NO]);
42 bridge_->Init(window);
38 } 43 }
39 44
40 NonClientFrameView* NativeWidgetMac::CreateNonClientFrameView() { 45 NonClientFrameView* NativeWidgetMac::CreateNonClientFrameView() {
41 return NULL; 46 return NULL;
42 } 47 }
43 48
44 bool NativeWidgetMac::ShouldUseNativeFrame() const { 49 bool NativeWidgetMac::ShouldUseNativeFrame() const {
45 return false; 50 return false;
46 } 51 }
47 52
48 bool NativeWidgetMac::ShouldWindowContentsBeTransparent() const { 53 bool NativeWidgetMac::ShouldWindowContentsBeTransparent() const {
49 NOTIMPLEMENTED(); 54 NOTIMPLEMENTED();
50 return false; 55 return false;
51 } 56 }
52 57
53 void NativeWidgetMac::FrameTypeChanged() { 58 void NativeWidgetMac::FrameTypeChanged() {
54 NOTIMPLEMENTED(); 59 NOTIMPLEMENTED();
55 } 60 }
56 61
57 Widget* NativeWidgetMac::GetWidget() { 62 Widget* NativeWidgetMac::GetWidget() {
58 return delegate_->AsWidget(); 63 return delegate_->AsWidget();
59 } 64 }
60 65
61 const Widget* NativeWidgetMac::GetWidget() const { 66 const Widget* NativeWidgetMac::GetWidget() const {
62 return delegate_->AsWidget(); 67 return delegate_->AsWidget();
63 } 68 }
64 69
65 gfx::NativeView NativeWidgetMac::GetNativeView() const { 70 gfx::NativeView NativeWidgetMac::GetNativeView() const {
66 return [window_ contentView]; 71 return bridge_->ns_view();
67 } 72 }
68 73
69 gfx::NativeWindow NativeWidgetMac::GetNativeWindow() const { 74 gfx::NativeWindow NativeWidgetMac::GetNativeWindow() const {
70 return window_; 75 return bridge_->ns_window();
71 } 76 }
72 77
73 Widget* NativeWidgetMac::GetTopLevelWidget() { 78 Widget* NativeWidgetMac::GetTopLevelWidget() {
74 NOTIMPLEMENTED(); 79 NOTIMPLEMENTED();
75 return GetWidget(); 80 return GetWidget();
76 } 81 }
77 82
78 const ui::Compositor* NativeWidgetMac::GetCompositor() const { 83 const ui::Compositor* NativeWidgetMac::GetCompositor() const {
79 NOTIMPLEMENTED(); 84 NOTIMPLEMENTED();
80 return NULL; 85 return NULL;
81 } 86 }
82 87
83 ui::Compositor* NativeWidgetMac::GetCompositor() { 88 ui::Compositor* NativeWidgetMac::GetCompositor() {
84 NOTIMPLEMENTED(); 89 NOTIMPLEMENTED();
85 return NULL; 90 return NULL;
86 } 91 }
87 92
88 ui::Layer* NativeWidgetMac::GetLayer() { 93 ui::Layer* NativeWidgetMac::GetLayer() {
89 NOTIMPLEMENTED(); 94 NOTIMPLEMENTED();
90 return NULL; 95 return NULL;
91 } 96 }
92 97
93 void NativeWidgetMac::ReorderNativeViews() { 98 void NativeWidgetMac::ReorderNativeViews() {
94 NOTIMPLEMENTED(); 99 bridge_->SetRootView(GetWidget()->GetRootView());
95 } 100 }
96 101
97 void NativeWidgetMac::ViewRemoved(View* view) { 102 void NativeWidgetMac::ViewRemoved(View* view) {
98 NOTIMPLEMENTED(); 103 NOTIMPLEMENTED();
99 } 104 }
100 105
101 void NativeWidgetMac::SetNativeWindowProperty(const char* name, void* value) { 106 void NativeWidgetMac::SetNativeWindowProperty(const char* name, void* value) {
102 NOTIMPLEMENTED(); 107 NOTIMPLEMENTED();
103 } 108 }
104 109
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 gfx::Rect NativeWidgetMac::GetRestoredBounds() const { 181 gfx::Rect NativeWidgetMac::GetRestoredBounds() const {
177 NOTIMPLEMENTED(); 182 NOTIMPLEMENTED();
178 return gfx::Rect(); 183 return gfx::Rect();
179 } 184 }
180 185
181 void NativeWidgetMac::SetBounds(const gfx::Rect& bounds) { 186 void NativeWidgetMac::SetBounds(const gfx::Rect& bounds) {
182 NOTIMPLEMENTED(); 187 NOTIMPLEMENTED();
183 } 188 }
184 189
185 void NativeWidgetMac::SetSize(const gfx::Size& size) { 190 void NativeWidgetMac::SetSize(const gfx::Size& size) {
186 [window_ setContentSize:NSMakeSize(size.width(), size.height())]; 191 [bridge_->ns_window() setContentSize:NSMakeSize(size.width(), size.height())];
187 } 192 }
188 193
189 void NativeWidgetMac::StackAbove(gfx::NativeView native_view) { 194 void NativeWidgetMac::StackAbove(gfx::NativeView native_view) {
190 NOTIMPLEMENTED(); 195 NOTIMPLEMENTED();
191 } 196 }
192 197
193 void NativeWidgetMac::StackAtTop() { 198 void NativeWidgetMac::StackAtTop() {
194 NOTIMPLEMENTED(); 199 NOTIMPLEMENTED();
195 } 200 }
196 201
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
303 308
304 void NativeWidgetMac::RunShellDrag(View* view, 309 void NativeWidgetMac::RunShellDrag(View* view,
305 const ui::OSExchangeData& data, 310 const ui::OSExchangeData& data,
306 const gfx::Point& location, 311 const gfx::Point& location,
307 int operation, 312 int operation,
308 ui::DragDropTypes::DragEventSource source) { 313 ui::DragDropTypes::DragEventSource source) {
309 NOTIMPLEMENTED(); 314 NOTIMPLEMENTED();
310 } 315 }
311 316
312 void NativeWidgetMac::SchedulePaintInRect(const gfx::Rect& rect) { 317 void NativeWidgetMac::SchedulePaintInRect(const gfx::Rect& rect) {
313 NOTIMPLEMENTED(); 318 // TODO(tapted): This should use setNeedsDisplayInRect:, once the coordinate
319 // system of |rect| has been converted.
320 [bridge_->ns_view() setNeedsDisplay:YES];
314 } 321 }
315 322
316 void NativeWidgetMac::SetCursor(gfx::NativeCursor cursor) { 323 void NativeWidgetMac::SetCursor(gfx::NativeCursor cursor) {
317 NOTIMPLEMENTED(); 324 NOTIMPLEMENTED();
318 } 325 }
319 326
320 bool NativeWidgetMac::IsMouseEventsEnabled() const { 327 bool NativeWidgetMac::IsMouseEventsEnabled() const {
321 NOTIMPLEMENTED(); 328 NOTIMPLEMENTED();
322 return true; 329 return true;
323 } 330 }
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
431 } 438 }
432 439
433 // static 440 // static
434 gfx::FontList NativeWidgetPrivate::GetWindowTitleFontList() { 441 gfx::FontList NativeWidgetPrivate::GetWindowTitleFontList() {
435 NOTIMPLEMENTED(); 442 NOTIMPLEMENTED();
436 return gfx::FontList(); 443 return gfx::FontList();
437 } 444 }
438 445
439 } // namespace internal 446 } // namespace internal
440 } // namespace views 447 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/widget/native_widget_mac.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698