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

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

Issue 1105613002: [MacViews] Implement AlwaysOnTop and VisibleOnAllWorkspaces. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add comments Created 5 years, 8 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 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 #include "base/mac/scoped_nsobject.h" 10 #include "base/mac/scoped_nsobject.h"
11 #include "base/strings/sys_string_conversions.h" 11 #include "base/strings/sys_string_conversions.h"
12 #import "ui/base/cocoa/window_size_constants.h" 12 #import "ui/base/cocoa/window_size_constants.h"
13 #include "ui/gfx/font_list.h" 13 #include "ui/gfx/font_list.h"
14 #import "ui/gfx/mac/coordinate_conversion.h" 14 #import "ui/gfx/mac/coordinate_conversion.h"
15 #import "ui/gfx/mac/nswindow_frame_controls.h"
15 #include "ui/native_theme/native_theme.h" 16 #include "ui/native_theme/native_theme.h"
16 #import "ui/views/cocoa/bridged_content_view.h" 17 #import "ui/views/cocoa/bridged_content_view.h"
17 #import "ui/views/cocoa/bridged_native_widget.h" 18 #import "ui/views/cocoa/bridged_native_widget.h"
18 #import "ui/views/cocoa/native_widget_mac_nswindow.h" 19 #import "ui/views/cocoa/native_widget_mac_nswindow.h"
19 #import "ui/views/cocoa/views_nswindow_delegate.h" 20 #import "ui/views/cocoa/views_nswindow_delegate.h"
20 #include "ui/views/window/native_frame_view.h" 21 #include "ui/views/window/native_frame_view.h"
21 22
22 namespace views { 23 namespace views {
23 namespace { 24 namespace {
24 25
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 77
77 //////////////////////////////////////////////////////////////////////////////// 78 ////////////////////////////////////////////////////////////////////////////////
78 // NativeWidgetMac, internal::NativeWidgetPrivate implementation: 79 // NativeWidgetMac, internal::NativeWidgetPrivate implementation:
79 80
80 void NativeWidgetMac::InitNativeWidget(const Widget::InitParams& params) { 81 void NativeWidgetMac::InitNativeWidget(const Widget::InitParams& params) {
81 ownership_ = params.ownership; 82 ownership_ = params.ownership;
82 base::scoped_nsobject<NSWindow> window([CreateNSWindow(params) retain]); 83 base::scoped_nsobject<NSWindow> window([CreateNSWindow(params) retain]);
83 [window setReleasedWhenClosed:NO]; // Owned by scoped_nsobject. 84 [window setReleasedWhenClosed:NO]; // Owned by scoped_nsobject.
84 bridge_->Init(window, params); 85 bridge_->Init(window, params);
85 86
87 SetAlwaysOnTop(params.keep_on_top);
88
86 delegate_->OnNativeWidgetCreated(true); 89 delegate_->OnNativeWidgetCreated(true);
87 90
88 bridge_->SetFocusManager(GetWidget()->GetFocusManager()); 91 bridge_->SetFocusManager(GetWidget()->GetFocusManager());
89 92
90 DCHECK(GetWidget()->GetRootView()); 93 DCHECK(GetWidget()->GetRootView());
91 bridge_->SetRootView(GetWidget()->GetRootView()); 94 bridge_->SetRootView(GetWidget()->GetRootView());
92 95
93 // "Infer" must be handled by ViewsDelegate::OnBeforeWidgetInit(). 96 // "Infer" must be handled by ViewsDelegate::OnBeforeWidgetInit().
94 DCHECK_NE(Widget::InitParams::INFER_OPACITY, params.opacity); 97 DCHECK_NE(Widget::InitParams::INFER_OPACITY, params.opacity);
95 bool translucent = params.opacity == Widget::InitParams::TRANSLUCENT_WINDOW; 98 bool translucent = params.opacity == Widget::InitParams::TRANSLUCENT_WINDOW;
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after
369 372
370 void NativeWidgetMac::Deactivate() { 373 void NativeWidgetMac::Deactivate() {
371 NOTIMPLEMENTED(); 374 NOTIMPLEMENTED();
372 } 375 }
373 376
374 bool NativeWidgetMac::IsActive() const { 377 bool NativeWidgetMac::IsActive() const {
375 return [GetNativeWindow() isKeyWindow]; 378 return [GetNativeWindow() isKeyWindow];
376 } 379 }
377 380
378 void NativeWidgetMac::SetAlwaysOnTop(bool always_on_top) { 381 void NativeWidgetMac::SetAlwaysOnTop(bool always_on_top) {
379 NOTIMPLEMENTED(); 382 gfx::SetNSWindowAlwaysOnTop(GetNativeWindow(), always_on_top, false);
380 } 383 }
381 384
382 bool NativeWidgetMac::IsAlwaysOnTop() const { 385 bool NativeWidgetMac::IsAlwaysOnTop() const {
383 NOTIMPLEMENTED(); 386 return gfx::IsNSWindowAlwaysOnTop(GetNativeWindow());
384 return false;
385 } 387 }
386 388
387 void NativeWidgetMac::SetVisibleOnAllWorkspaces(bool always_visible) { 389 void NativeWidgetMac::SetVisibleOnAllWorkspaces(bool always_visible) {
388 NOTIMPLEMENTED(); 390 gfx::SetNSWindowVisibleOnAllWorkspaces(GetNativeWindow(), always_visible);
389 } 391 }
390 392
391 void NativeWidgetMac::Maximize() { 393 void NativeWidgetMac::Maximize() {
392 NOTIMPLEMENTED(); // See IsMaximized(). 394 NOTIMPLEMENTED(); // See IsMaximized().
393 } 395 }
394 396
395 void NativeWidgetMac::Minimize() { 397 void NativeWidgetMac::Minimize() {
396 NSWindow* window = GetNativeWindow(); 398 NSWindow* window = GetNativeWindow();
397 // Calling performMiniaturize: will momentarily highlight the button, but 399 // Calling performMiniaturize: will momentarily highlight the button, but
398 // AppKit will reject it if there is no miniaturize button. 400 // AppKit will reject it if there is no miniaturize button.
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after
632 } 634 }
633 635
634 // static 636 // static
635 gfx::FontList NativeWidgetPrivate::GetWindowTitleFontList() { 637 gfx::FontList NativeWidgetPrivate::GetWindowTitleFontList() {
636 NOTIMPLEMENTED(); 638 NOTIMPLEMENTED();
637 return gfx::FontList(); 639 return gfx::FontList();
638 } 640 }
639 641
640 } // namespace internal 642 } // namespace internal
641 } // namespace views 643 } // namespace views
OLDNEW
« ui/gfx/mac/nswindow_frame_controls.mm ('K') | « ui/gfx/mac/nswindow_frame_controls.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698