File: native_widget_mac_nswindow.h

package info (click to toggle)
chromium 138.0.7204.183-1~deb12u1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm-proposed-updates
  • size: 6,080,960 kB
  • sloc: cpp: 34,937,079; ansic: 7,176,967; javascript: 4,110,704; python: 1,419,954; asm: 946,768; xml: 739,971; pascal: 187,324; sh: 89,623; perl: 88,663; objc: 79,944; sql: 50,304; cs: 41,786; fortran: 24,137; makefile: 21,811; php: 13,980; tcl: 13,166; yacc: 8,925; ruby: 7,485; awk: 3,720; lisp: 3,096; lex: 1,327; ada: 727; jsp: 228; sed: 36
file content (124 lines) | stat: -rw-r--r-- 4,926 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef COMPONENTS_REMOTE_COCOA_APP_SHIM_NATIVE_WIDGET_MAC_NSWINDOW_H_
#define COMPONENTS_REMOTE_COCOA_APP_SHIM_NATIVE_WIDGET_MAC_NSWINDOW_H_

#import <Cocoa/Cocoa.h>

#include "base/apple/foundation_util.h"
#include "components/remote_cocoa/app_shim/remote_cocoa_app_shim_export.h"
#import "ui/base/cocoa/command_dispatcher.h"

namespace remote_cocoa {
class NativeWidgetNSWindowBridge;
}  // namespace remote_cocoa

@protocol WindowTouchBarDelegate;

// Weak lets Chrome launch even if a future macOS doesn't have the below classes
WEAK_IMPORT_ATTRIBUTE
@interface NSNextStepFrame : NSView
@end

WEAK_IMPORT_ATTRIBUTE
@interface NSThemeFrame : NSView
@end

REMOTE_COCOA_APP_SHIM_EXPORT
@interface NativeWidgetMacNSWindowBorderlessFrame : NSNextStepFrame
@end

REMOTE_COCOA_APP_SHIM_EXPORT
@interface NativeWidgetMacNSWindowTitledFrame : NSThemeFrame
@end

// The NSWindow used by BridgedNativeWidget. Provides hooks into AppKit that
// can only be accomplished by overriding methods.
REMOTE_COCOA_APP_SHIM_EXPORT
@interface NativeWidgetMacNSWindow : NSWindow <CommandDispatchingWindow>

// Set a CommandDispatcherDelegate, i.e. to implement key event handling.
- (void)setCommandDispatcherDelegate:(id<CommandDispatcherDelegate>)delegate;

// Set a WindowTouchBarDelegate to allow creation of a custom TouchBar when
// AppKit follows the responder chain and reaches the NSWindow when trying to
// create one.
- (void)setWindowTouchBarDelegate:(id<WindowTouchBarDelegate>)delegate;

// Enforce that this window never be made visible. In the event that it is made
// visible, it will log a crash report.
// https://crbug.com/960904
- (void)enforceNeverMadeVisible;

// `- [NSWindow orderWindow:]` does not have any effect when called on child
// windows. If you need to order a child window, use this method. Important:
// this method adds or removes children from the parent. If you're observing
// events related to adding or removing children, this could lead to issues. To
// check whether ordering is currently in progress, inspect the
// `isShufflingForOrdering` property on the child window.
- (void)orderWindowByShuffling:(NSWindowOrderingMode)place
                    relativeTo:(NSInteger)otherWin;

// "Activation independence" allows the activation of the window to be
// independent of the activation of the owning app. This is a combination of two
// different properties:
//
// - !NSWindow.canHide
// - The equivalent of NSWindowStyleMaskNonactivatingPanel being set, if that
//   were possible on NSWindows.
- (void)setActivationIndependence:(BOOL)independence;

- (bool)activationIndependence;

// Order the window to the front (space switch if necessary), and ensure that
// the window maintains its key state. A space switch will normally activate a
// window, so this function prevents that if the window is currently inactive.
- (void)orderFrontKeepWindowKeyState;

// Overridden to prevent headless windows to be constrained to the physical
// screen bounds.
- (NSRect)constrainFrameRect:(NSRect)frameRect toScreen:(NSScreen*)screen;

// Is the window a part of a browser window tree that is currently in an
// immersive fullscreen session.
- (BOOL)immersiveFullscreen;

// The sheet parent that should be used. In immersive fullscreen the preferred
// sheet parent is the root window (the browser window).
- (NSWindow*)preferredSheetParent;

// Identifier for the NativeWidgetMac from which this window was created. This
// may be used to look up the NativeWidgetMacNSWindowHost in the browser process
// or the NativeWidgetNSWindowBridge in a display process.
@property(assign, nonatomic) uint64_t bridgedNativeWidgetId;

// The NativeWidgetNSWindowBridge that this will use to call back to the host.
@property(assign, nonatomic) remote_cocoa::NativeWidgetNSWindowBridge* bridge;

// Whether this window functions as a tooltip.
@property(assign, nonatomic) BOOL isTooltip;

// Whether this window is headless.
@property(assign, nonatomic) BOOL isHeadless;

// Whether this window is currently being added to and removed from parent for
// ordering.
@property(assign, nonatomic) BOOL isShufflingForOrdering;

// Called whenever a child window is added to the receiver.
@property(nonatomic, copy) void (^childWindowAddedHandler)(NSWindow* child);

// Called whenever a child window is removed to the receiver.
@property(nonatomic, copy) void (^childWindowRemovedHandler)(NSWindow* child);

// Window to dispatch commands to. Needed for situations where the window that
// needs to handle events is not the target's immediate parent; for example
// alerts in immersive fullscreen.
@property(nonatomic, weak)
    NSWindow<CommandDispatchingWindow>* commandDispatchParentOverride;

@end

#endif  // COMPONENTS_REMOTE_COCOA_APP_SHIM_NATIVE_WIDGET_MAC_NSWINDOW_H_