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

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: Address comments Created 5 years, 7 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);
tapted 2015/05/12 04:05:35 I think... only call this when params.keep_on_top
jackhou1 2015/05/12 05:44:19 Done.
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 274 matching lines...) Expand 10 before | Expand all | Expand 10 after
370 373
371 void NativeWidgetMac::Deactivate() { 374 void NativeWidgetMac::Deactivate() {
372 NOTIMPLEMENTED(); 375 NOTIMPLEMENTED();
373 } 376 }
374 377
375 bool NativeWidgetMac::IsActive() const { 378 bool NativeWidgetMac::IsActive() const {
376 return [GetNativeWindow() isKeyWindow]; 379 return [GetNativeWindow() isKeyWindow];
377 } 380 }
378 381
379 void NativeWidgetMac::SetAlwaysOnTop(bool always_on_top) { 382 void NativeWidgetMac::SetAlwaysOnTop(bool always_on_top) {
380 NOTIMPLEMENTED(); 383 gfx::SetNSWindowAlwaysOnTop(GetNativeWindow(), always_on_top);
381 } 384 }
382 385
383 bool NativeWidgetMac::IsAlwaysOnTop() const { 386 bool NativeWidgetMac::IsAlwaysOnTop() const {
384 NOTIMPLEMENTED(); 387 return gfx::IsNSWindowAlwaysOnTop(GetNativeWindow());
385 return false;
386 } 388 }
387 389
388 void NativeWidgetMac::SetVisibleOnAllWorkspaces(bool always_visible) { 390 void NativeWidgetMac::SetVisibleOnAllWorkspaces(bool always_visible) {
389 NOTIMPLEMENTED(); 391 gfx::SetNSWindowVisibleOnAllWorkspaces(GetNativeWindow(), always_visible);
390 } 392 }
391 393
392 void NativeWidgetMac::Maximize() { 394 void NativeWidgetMac::Maximize() {
393 NOTIMPLEMENTED(); // See IsMaximized(). 395 NOTIMPLEMENTED(); // See IsMaximized().
394 } 396 }
395 397
396 void NativeWidgetMac::Minimize() { 398 void NativeWidgetMac::Minimize() {
397 NSWindow* window = GetNativeWindow(); 399 NSWindow* window = GetNativeWindow();
398 // Calling performMiniaturize: will momentarily highlight the button, but 400 // Calling performMiniaturize: will momentarily highlight the button, but
399 // AppKit will reject it if there is no miniaturize button. 401 // AppKit will reject it if there is no miniaturize button.
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after
633 } 635 }
634 636
635 // static 637 // static
636 gfx::FontList NativeWidgetPrivate::GetWindowTitleFontList() { 638 gfx::FontList NativeWidgetPrivate::GetWindowTitleFontList() {
637 NOTIMPLEMENTED(); 639 NOTIMPLEMENTED();
638 return gfx::FontList(); 640 return gfx::FontList();
639 } 641 }
640 642
641 } // namespace internal 643 } // namespace internal
642 } // namespace views 644 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698