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

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

Issue 659233002: STASH: Epic Experimental patch for toolkit-views App List on Mac Base URL: https://chromium.googlesource.com/chromium/src.git/+/master
Patch Set: Fix a few things. Works@master Created 6 years, 2 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
« no previous file with comments | « ui/views/widget/native_widget_mac.h ('k') | ui/views/widget/native_widget_mac_unittest.mm » ('j') | 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 #import <Cocoa/Cocoa.h> 7 #import <Cocoa/Cocoa.h>
8 8
9 #include "base/mac/foundation_util.h" 9 #include "base/mac/foundation_util.h"
10 #import "base/mac/sdk_forward_declarations.h"
10 #include "base/mac/scoped_nsobject.h" 11 #include "base/mac/scoped_nsobject.h"
11 #include "base/strings/sys_string_conversions.h" 12 #include "base/strings/sys_string_conversions.h"
12 #include "ui/gfx/font_list.h" 13 #include "ui/gfx/font_list.h"
13 #import "ui/gfx/mac/coordinate_conversion.h" 14 #import "ui/gfx/mac/coordinate_conversion.h"
15 #include "ui/gfx/screen.h"
14 #include "ui/native_theme/native_theme.h" 16 #include "ui/native_theme/native_theme.h"
15 #import "ui/views/cocoa/bridged_content_view.h" 17 #import "ui/views/cocoa/bridged_content_view.h"
16 #import "ui/views/cocoa/bridged_native_widget.h" 18 #import "ui/views/cocoa/bridged_native_widget.h"
17 #import "ui/views/cocoa/views_nswindow_delegate.h" 19 #import "ui/views/cocoa/views_nswindow_delegate.h"
18 #include "ui/views/window/native_frame_view.h" 20 #include "ui/views/window/native_frame_view.h"
19 21
20 @interface NativeWidgetMacNSWindow : NSWindow 22 @interface NativeWidgetMacNSWindow : NSWindow
21 - (ViewsNSWindowDelegate*)viewsNSWindowDelegate; 23 - (ViewsNSWindowDelegate*)viewsNSWindowDelegate;
22 @end 24 @end
23 25
24 @implementation NativeWidgetMacNSWindow 26 @implementation NativeWidgetMacNSWindow
25 27
26 - (ViewsNSWindowDelegate*)viewsNSWindowDelegate { 28 - (ViewsNSWindowDelegate*)viewsNSWindowDelegate {
27 return base::mac::ObjCCastStrict<ViewsNSWindowDelegate>([self delegate]); 29 return base::mac::ObjCCastStrict<ViewsNSWindowDelegate>([self delegate]);
28 } 30 }
29 31
30 // Override canBecome{Key,Main}Window to always return YES, otherwise Windows 32 // Override canBecome{Key,Main}Window to always return YES, otherwise Windows
31 // with a styleMask of NSBorderlessWindowMask default to NO. 33 // with a styleMask of NSBorderlessWindowMask default to NO.
32 - (BOOL)canBecomeKeyWindow { 34 - (BOOL)canBecomeKeyWindow {
33 return YES; 35 return YES;
34 } 36 }
35 37
38 // Also override canBecomeMainWindow, but ensure that transient child windows
39 // do not achieve main status, even if key. Main status should stay with the
40 // parent window.
36 - (BOOL)canBecomeMainWindow { 41 - (BOOL)canBecomeMainWindow {
37 return YES; 42 return ![[self viewsNSWindowDelegate] isTransientChild];
38 } 43 }
39 44
40 // Override orderWindow to intercept visibility changes, since there is no way 45 // Override orderWindow to intercept visibility changes, since there is no way
41 // to observe these changes via NSWindowDelegate. 46 // to observe these changes via NSWindowDelegate.
42 - (void)orderWindow:(NSWindowOrderingMode)orderingMode 47 - (void)orderWindow:(NSWindowOrderingMode)orderingMode
43 relativeTo:(NSInteger)otherWindowNumber { 48 relativeTo:(NSInteger)otherWindowNumber {
44 [[self viewsNSWindowDelegate] onWindowOrderWillChange:orderingMode]; 49 [[self viewsNSWindowDelegate] onWindowOrderWillChange:orderingMode];
45 [super orderWindow:orderingMode relativeTo:otherWindowNumber]; 50 [super orderWindow:orderingMode relativeTo:otherWindowNumber];
46 [[self viewsNSWindowDelegate] onWindowOrderChanged]; 51 [[self viewsNSWindowDelegate] onWindowOrderChanged:nil];
47 } 52 }
48 53
49 @end 54 @end
50 55
51 namespace views { 56 namespace views {
52 namespace { 57 namespace {
53 58
54 NSInteger StyleMaskForParams(const Widget::InitParams& params) { 59 NSInteger StyleMaskForParams(const Widget::InitParams& params) {
55 // TODO(tapted): Determine better masks when there are use cases for it. 60 // TODO(tapted): Determine better masks when there are use cases for it.
56 if (params.remove_standard_frame) 61 if (params.remove_standard_frame)
(...skipping 13 matching lines...) Expand all
70 if (NSWidth(content_rect) == 0) 75 if (NSWidth(content_rect) == 0)
71 content_rect.size.width = 1; 76 content_rect.size.width = 1;
72 77
73 if (NSHeight(content_rect) == 0) 78 if (NSHeight(content_rect) == 0)
74 content_rect.size.height = 1; 79 content_rect.size.height = 1;
75 80
76 return content_rect; 81 return content_rect;
77 } 82 }
78 83
79 gfx::Size WindowSizeForClientAreaSize(NSWindow* window, const gfx::Size& size) { 84 gfx::Size WindowSizeForClientAreaSize(NSWindow* window, const gfx::Size& size) {
80 NSRect content_rect = NSMakeRect(0, 0, size.width(), size.height()); 85 DCHECK(window);
86 NSRect content_rect =
87 ValidateContentRect(NSMakeRect(0, 0, size.width(), size.height()));
81 NSRect frame_rect = [window frameRectForContentRect:content_rect]; 88 NSRect frame_rect = [window frameRectForContentRect:content_rect];
82 return gfx::Size(NSWidth(frame_rect), NSHeight(frame_rect)); 89 return gfx::Size(NSWidth(frame_rect), NSHeight(frame_rect));
83 } 90 }
84 91
85 } // namespace 92 } // namespace
86 93
87 //////////////////////////////////////////////////////////////////////////////// 94 ////////////////////////////////////////////////////////////////////////////////
88 // NativeWidgetMac, public: 95 // NativeWidgetMac, public:
89 96
90 NativeWidgetMac::NativeWidgetMac(internal::NativeWidgetDelegate* delegate) 97 NativeWidgetMac::NativeWidgetMac(internal::NativeWidgetDelegate* delegate)
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 146
140 NonClientFrameView* NativeWidgetMac::CreateNonClientFrameView() { 147 NonClientFrameView* NativeWidgetMac::CreateNonClientFrameView() {
141 return new NativeFrameView(GetWidget()); 148 return new NativeFrameView(GetWidget());
142 } 149 }
143 150
144 bool NativeWidgetMac::ShouldUseNativeFrame() const { 151 bool NativeWidgetMac::ShouldUseNativeFrame() const {
145 return true; 152 return true;
146 } 153 }
147 154
148 bool NativeWidgetMac::ShouldWindowContentsBeTransparent() const { 155 bool NativeWidgetMac::ShouldWindowContentsBeTransparent() const {
149 NOTIMPLEMENTED(); 156 return true;
150 return false;
151 } 157 }
152 158
153 void NativeWidgetMac::FrameTypeChanged() { 159 void NativeWidgetMac::FrameTypeChanged() {
154 NOTIMPLEMENTED(); 160 NOTIMPLEMENTED();
155 } 161 }
156 162
157 Widget* NativeWidgetMac::GetWidget() { 163 Widget* NativeWidgetMac::GetWidget() {
158 return delegate_->AsWidget(); 164 return delegate_->AsWidget();
159 } 165 }
160 166
161 const Widget* NativeWidgetMac::GetWidget() const { 167 const Widget* NativeWidgetMac::GetWidget() const {
162 return delegate_->AsWidget(); 168 return delegate_->AsWidget();
163 } 169 }
164 170
165 gfx::NativeView NativeWidgetMac::GetNativeView() const { 171 gfx::NativeView NativeWidgetMac::GetNativeView() const {
166 // Returns a BridgedContentView, unless there is no views::RootView set. 172 // Returns a BridgedContentView, unless there is no views::RootView set.
167 return [GetNativeWindow() contentView]; 173 return [GetNativeWindow() contentView];
168 } 174 }
169 175
170 gfx::NativeWindow NativeWidgetMac::GetNativeWindow() const { 176 gfx::NativeWindow NativeWidgetMac::GetNativeWindow() const {
171 return bridge_ ? bridge_->ns_window() : nil; 177 return bridge_ ? bridge_->ns_window() : nil;
172 } 178 }
173 179
174 Widget* NativeWidgetMac::GetTopLevelWidget() { 180 Widget* NativeWidgetMac::GetTopLevelWidget() {
175 NativeWidgetPrivate* native_widget = GetTopLevelNativeWidget(GetNativeView()); 181 NativeWidgetPrivate* native_widget = GetTopLevelNativeWidget(GetNativeView());
176 return native_widget ? native_widget->GetWidget() : NULL; 182 return native_widget ? native_widget->GetWidget() : NULL;
177 } 183 }
178 184
179 const ui::Compositor* NativeWidgetMac::GetCompositor() const { 185 const ui::Compositor* NativeWidgetMac::GetCompositor() const {
180 NOTIMPLEMENTED(); 186 return bridge_->layer() ? bridge_->layer()->GetCompositor() : NULL;
181 return NULL;
182 } 187 }
183 188
184 ui::Compositor* NativeWidgetMac::GetCompositor() { 189 ui::Compositor* NativeWidgetMac::GetCompositor() {
185 NOTIMPLEMENTED(); 190 return bridge_->layer() ? bridge_->layer()->GetCompositor() : NULL;
186 return NULL;
187 } 191 }
188 192
189 ui::Layer* NativeWidgetMac::GetLayer() { 193 ui::Layer* NativeWidgetMac::GetLayer() {
190 NOTIMPLEMENTED(); 194 return bridge_->GetOrCreateLayer();
191 return NULL;
192 } 195 }
193 196
194 void NativeWidgetMac::ReorderNativeViews() { 197 void NativeWidgetMac::ReorderNativeViews() {
195 if (bridge_) 198 if (bridge_)
196 bridge_->SetRootView(GetWidget()->GetRootView()); 199 bridge_->SetRootView(GetWidget()->GetRootView());
197 } 200 }
198 201
199 void NativeWidgetMac::ViewRemoved(View* view) { 202 void NativeWidgetMac::ViewRemoved(View* view) {
200 NOTIMPLEMENTED(); 203 NOTIMPLEMENTED();
201 } 204 }
202 205
203 void NativeWidgetMac::SetNativeWindowProperty(const char* name, void* value) { 206 void NativeWidgetMac::SetNativeWindowProperty(const char* name, void* value) {
204 NOTIMPLEMENTED(); 207 NOTIMPLEMENTED();
205 } 208 }
206 209
207 void* NativeWidgetMac::GetNativeWindowProperty(const char* name) const { 210 void* NativeWidgetMac::GetNativeWindowProperty(const char* name) const {
208 NOTIMPLEMENTED(); 211 NOTIMPLEMENTED();
209 return NULL; 212 return NULL;
210 } 213 }
211 214
212 TooltipManager* NativeWidgetMac::GetTooltipManager() const { 215 TooltipManager* NativeWidgetMac::GetTooltipManager() const {
213 NOTIMPLEMENTED(); 216 NOTIMPLEMENTED();
214 return NULL; 217 return NULL;
215 } 218 }
216 219
217 void NativeWidgetMac::SetCapture() { 220 void NativeWidgetMac::SetCapture() {
218 NOTIMPLEMENTED(); 221 // Basic mouse capture to simulate ::SetCapture() from Windows. Capture on OSX
222 // is automatic for mouse drag events. This allows mouse move events to also
223 // be sent to responders, but only when the mouse is over the window. To get
224 // move events outside the window, Mac will need an event tap.
225 [GetNativeWindow() setAcceptsMouseMovedEvents:YES];
226 //[GetNativeWindow() makeKeyWindow];
219 } 227 }
220 228
221 void NativeWidgetMac::ReleaseCapture() { 229 void NativeWidgetMac::ReleaseCapture() {
222 NOTIMPLEMENTED(); 230 [GetNativeWindow() setAcceptsMouseMovedEvents:NO];
223 } 231 }
224 232
225 bool NativeWidgetMac::HasCapture() const { 233 bool NativeWidgetMac::HasCapture() const {
226 NOTIMPLEMENTED(); 234 return [GetNativeWindow() acceptsMouseMovedEvents];
227 return false;
228 } 235 }
229 236
230 InputMethod* NativeWidgetMac::CreateInputMethod() { 237 InputMethod* NativeWidgetMac::CreateInputMethod() {
231 return bridge_ ? bridge_->CreateInputMethod() : NULL; 238 return bridge_ ? bridge_->CreateInputMethod() : NULL;
232 } 239 }
233 240
234 internal::InputMethodDelegate* NativeWidgetMac::GetInputMethodDelegate() { 241 internal::InputMethodDelegate* NativeWidgetMac::GetInputMethodDelegate() {
235 return bridge_.get(); 242 return bridge_.get();
236 } 243 }
237 244
238 ui::InputMethod* NativeWidgetMac::GetHostInputMethod() { 245 ui::InputMethod* NativeWidgetMac::GetHostInputMethod() {
239 return bridge_ ? bridge_->GetHostInputMethod() : NULL; 246 return bridge_ ? bridge_->GetHostInputMethod() : NULL;
240 } 247 }
241 248
242 void NativeWidgetMac::CenterWindow(const gfx::Size& size) { 249 void NativeWidgetMac::CenterWindow(const gfx::Size& size) {
243 SetSize(WindowSizeForClientAreaSize(GetNativeWindow(), size)); 250 SetSize(WindowSizeForClientAreaSize(GetNativeWindow(), size));
244 // Note that this is not the precise center of screen, but it is the standard 251 // Note that this is not the precise center of screen, but it is the standard
245 // location for windows like dialogs to appear on screen for Mac. 252 // location for windows like dialogs to appear on screen for Mac.
246 // TODO(tapted): If there is a parent window, center in that instead. 253 // TODO(tapted): If there is a parent window, center in that instead.
247 [GetNativeWindow() center]; 254 [GetNativeWindow() center];
248 } 255 }
249 256
250 void NativeWidgetMac::GetWindowPlacement(gfx::Rect* bounds, 257 void NativeWidgetMac::GetWindowPlacement(
251 ui::WindowShowState* maximized) const { 258 gfx::Rect* bounds,
252 NOTIMPLEMENTED(); 259 ui::WindowShowState* show_state) const {
260 *bounds = GetRestoredBounds();
261 if (IsMinimized()) {
262 *show_state = ui::SHOW_STATE_MINIMIZED;
263 return;
264 }
265
266 if (IsFullscreen()) {
267 *show_state = ui::SHOW_STATE_FULLSCREEN;
268 return;
269 }
270
271 *show_state = ui::SHOW_STATE_DEFAULT;
253 } 272 }
254 273
255 bool NativeWidgetMac::SetWindowTitle(const base::string16& title) { 274 bool NativeWidgetMac::SetWindowTitle(const base::string16& title) {
256 NSWindow* window = GetNativeWindow(); 275 NSWindow* window = GetNativeWindow();
257 NSString* current_title = [window title]; 276 NSString* current_title = [window title];
258 NSString* new_title = SysUTF16ToNSString(title); 277 NSString* new_title = SysUTF16ToNSString(title);
259 if ([current_title isEqualToString:new_title]) 278 if ([current_title isEqualToString:new_title])
260 return false; 279 return false;
261 280
262 [window setTitle:new_title]; 281 [window setTitle:new_title];
(...skipping 17 matching lines...) Expand all
280 NSWindow* window = GetNativeWindow(); 299 NSWindow* window = GetNativeWindow();
281 return gfx::ScreenRectFromNSRect( 300 return gfx::ScreenRectFromNSRect(
282 [window contentRectForFrameRect:[window frame]]); 301 [window contentRectForFrameRect:[window frame]]);
283 } 302 }
284 303
285 gfx::Rect NativeWidgetMac::GetRestoredBounds() const { 304 gfx::Rect NativeWidgetMac::GetRestoredBounds() const {
286 return bridge_ ? bridge_->GetRestoredBounds() : gfx::Rect(); 305 return bridge_ ? bridge_->GetRestoredBounds() : gfx::Rect();
287 } 306 }
288 307
289 void NativeWidgetMac::SetBounds(const gfx::Rect& bounds) { 308 void NativeWidgetMac::SetBounds(const gfx::Rect& bounds) {
309 #if 1
290 [GetNativeWindow() setFrame:gfx::ScreenRectToNSRect(bounds) 310 [GetNativeWindow() setFrame:gfx::ScreenRectToNSRect(bounds)
291 display:YES 311 display:YES
292 animate:NO]; 312 animate:NO];
313 if (!IsVisible()) {
314 // If not visible, notifications do not come from Cocoa, so send our own.
315 //NSSize new_size = [GetNativeWindow() frame].size;
316 //GetWidget()->OnNativeWidgetSizeChanged(
317 // gfx::Size(new_size.width, new_size.height));
318 }
319 #else
320 if (bridge_)
321 bridge_->SetBounds(bounds);
322 #endif
293 } 323 }
294 324
295 void NativeWidgetMac::SetSize(const gfx::Size& size) { 325 void NativeWidgetMac::SetSize(const gfx::Size& size) {
296 // Ensure the top-left corner stays in-place (rather than the bottom-left, 326 // Ensure the top-left corner stays in-place (rather than the bottom-left,
297 // which -[NSWindow setContentSize:] would do). 327 // which -[NSWindow setContentSize:] would do).
298 SetBounds(gfx::Rect(GetWindowBoundsInScreen().origin(), size)); 328 SetBounds(gfx::Rect(GetWindowBoundsInScreen().origin(), size));
299 } 329 }
300 330
301 void NativeWidgetMac::StackAbove(gfx::NativeView native_view) { 331 void NativeWidgetMac::StackAbove(gfx::NativeView native_view) {
302 NOTIMPLEMENTED(); 332 NOTIMPLEMENTED();
(...skipping 30 matching lines...) Expand all
333 void NativeWidgetMac::CloseNow() { 363 void NativeWidgetMac::CloseNow() {
334 // Reset |bridge_| to NULL before destroying it. 364 // Reset |bridge_| to NULL before destroying it.
335 scoped_ptr<BridgedNativeWidget> bridge(bridge_.Pass()); 365 scoped_ptr<BridgedNativeWidget> bridge(bridge_.Pass());
336 } 366 }
337 367
338 void NativeWidgetMac::Show() { 368 void NativeWidgetMac::Show() {
339 ShowWithWindowState(ui::SHOW_STATE_NORMAL); 369 ShowWithWindowState(ui::SHOW_STATE_NORMAL);
340 } 370 }
341 371
342 void NativeWidgetMac::Hide() { 372 void NativeWidgetMac::Hide() {
343 NOTIMPLEMENTED(); 373 [GetNativeWindow() orderOut:nil];
344 } 374 }
345 375
346 void NativeWidgetMac::ShowMaximizedWithBounds( 376 void NativeWidgetMac::ShowMaximizedWithBounds(
347 const gfx::Rect& restored_bounds) { 377 const gfx::Rect& restored_bounds) {
348 NOTIMPLEMENTED(); 378 NOTIMPLEMENTED();
349 } 379 }
350 380
351 void NativeWidgetMac::ShowWithWindowState(ui::WindowShowState state) { 381 void NativeWidgetMac::ShowWithWindowState(ui::WindowShowState state) {
352 switch (state) { 382 switch (state) {
353 case ui::SHOW_STATE_DEFAULT: 383 case ui::SHOW_STATE_DEFAULT:
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
421 451
422 void NativeWidgetMac::SetVisibleOnAllWorkspaces(bool always_visible) { 452 void NativeWidgetMac::SetVisibleOnAllWorkspaces(bool always_visible) {
423 NOTIMPLEMENTED(); 453 NOTIMPLEMENTED();
424 } 454 }
425 455
426 void NativeWidgetMac::Maximize() { 456 void NativeWidgetMac::Maximize() {
427 NOTIMPLEMENTED(); // See IsMaximized(). 457 NOTIMPLEMENTED(); // See IsMaximized().
428 } 458 }
429 459
430 void NativeWidgetMac::Minimize() { 460 void NativeWidgetMac::Minimize() {
431 NOTIMPLEMENTED(); 461 NSWindow* window = GetNativeWindow();
462 // Calling performMiniaturize: will momentarily highlight the button, but
463 // AppKit will reject it if there is no miniaturize button.
464 if ([window styleMask] & NSMiniaturizableWindowMask)
465 [window performMiniaturize:nil];
466 else
467 [window miniaturize:nil];
432 } 468 }
433 469
434 bool NativeWidgetMac::IsMaximized() const { 470 bool NativeWidgetMac::IsMaximized() const {
435 // The window frame isn't altered on Mac unless going fullscreen. The green 471 // The window frame isn't altered on Mac unless going fullscreen. The green
436 // "+" button just makes the window bigger. So, always false. 472 // "+" button just makes the window bigger. So, always false.
437 return false; 473 return false;
438 } 474 }
439 475
440 bool NativeWidgetMac::IsMinimized() const { 476 bool NativeWidgetMac::IsMinimized() const {
441 NOTIMPLEMENTED(); 477 return [GetNativeWindow() isMiniaturized];
442 return false;
443 } 478 }
444 479
445 void NativeWidgetMac::Restore() { 480 void NativeWidgetMac::Restore() {
446 NOTIMPLEMENTED(); 481 [GetNativeWindow() deminiaturize:nil];
447 } 482 }
448 483
449 void NativeWidgetMac::SetFullscreen(bool fullscreen) { 484 void NativeWidgetMac::SetFullscreen(bool fullscreen) {
450 if (!bridge_ || fullscreen == IsFullscreen()) 485 if (!bridge_ || fullscreen == IsFullscreen())
451 return; 486 return;
452 487
453 bridge_->ToggleDesiredFullscreenState(); 488 bridge_->ToggleDesiredFullscreenState();
454 } 489 }
455 490
456 bool NativeWidgetMac::IsFullscreen() const { 491 bool NativeWidgetMac::IsFullscreen() const {
(...skipping 17 matching lines...) Expand all
474 const gfx::Point& location, 509 const gfx::Point& location,
475 int operation, 510 int operation,
476 ui::DragDropTypes::DragEventSource source) { 511 ui::DragDropTypes::DragEventSource source) {
477 NOTIMPLEMENTED(); 512 NOTIMPLEMENTED();
478 } 513 }
479 514
480 void NativeWidgetMac::SchedulePaintInRect(const gfx::Rect& rect) { 515 void NativeWidgetMac::SchedulePaintInRect(const gfx::Rect& rect) {
481 // TODO(tapted): This should use setNeedsDisplayInRect:, once the coordinate 516 // TODO(tapted): This should use setNeedsDisplayInRect:, once the coordinate
482 // system of |rect| has been converted. 517 // system of |rect| has been converted.
483 [GetNativeView() setNeedsDisplay:YES]; 518 [GetNativeView() setNeedsDisplay:YES];
519 if (bridge_ && bridge_->layer()) {
520 bridge_->layer()->SchedulePaint(rect);
521 }
484 } 522 }
485 523
486 void NativeWidgetMac::SetCursor(gfx::NativeCursor cursor) { 524 void NativeWidgetMac::SetCursor(gfx::NativeCursor cursor) {
487 NOTIMPLEMENTED(); 525 NOTIMPLEMENTED();
488 } 526 }
489 527
490 bool NativeWidgetMac::IsMouseEventsEnabled() const { 528 bool NativeWidgetMac::IsMouseEventsEnabled() const {
491 NOTIMPLEMENTED(); 529 NOTIMPLEMENTED();
492 return true; 530 return true;
493 } 531 }
494 532
495 void NativeWidgetMac::ClearNativeFocus() { 533 void NativeWidgetMac::ClearNativeFocus() {
496 NOTIMPLEMENTED(); 534 NOTIMPLEMENTED();
497 } 535 }
498 536
499 gfx::Rect NativeWidgetMac::GetWorkAreaBoundsInScreen() const { 537 gfx::Rect NativeWidgetMac::GetWorkAreaBoundsInScreen() const {
500 NOTIMPLEMENTED(); 538 NSView* view = GetNativeView();
501 return gfx::Rect(); 539 if (!view)
540 return gfx::Rect();
541 return gfx::Screen::GetScreenFor(view)
542 ->GetDisplayNearestWindow(view)
543 .work_area();
502 } 544 }
503 545
504 Widget::MoveLoopResult NativeWidgetMac::RunMoveLoop( 546 Widget::MoveLoopResult NativeWidgetMac::RunMoveLoop(
505 const gfx::Vector2d& drag_offset, 547 const gfx::Vector2d& drag_offset,
506 Widget::MoveLoopSource source, 548 Widget::MoveLoopSource source,
507 Widget::MoveLoopEscapeBehavior escape_behavior) { 549 Widget::MoveLoopEscapeBehavior escape_behavior) {
508 NOTIMPLEMENTED(); 550 NOTIMPLEMENTED();
509 return Widget::MOVE_LOOP_CANCELED; 551 return Widget::MOVE_LOOP_CANCELED;
510 } 552 }
511 553
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
625 } 667 }
626 668
627 // static 669 // static
628 gfx::FontList NativeWidgetPrivate::GetWindowTitleFontList() { 670 gfx::FontList NativeWidgetPrivate::GetWindowTitleFontList() {
629 NOTIMPLEMENTED(); 671 NOTIMPLEMENTED();
630 return gfx::FontList(); 672 return gfx::FontList();
631 } 673 }
632 674
633 } // namespace internal 675 } // namespace internal
634 } // namespace views 676 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/widget/native_widget_mac.h ('k') | ui/views/widget/native_widget_mac_unittest.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698