mirror of
https://github.com/klzgrad/naiveproxy.git
synced 2024-11-24 22:36:09 +03:00
122 lines
4.4 KiB
Plaintext
122 lines
4.4 KiB
Plaintext
|
// Copyright 2018 The Chromium Authors. All rights reserved.
|
||
|
// Use of this source code is governed by a BSD-style license that can be
|
||
|
// found in the LICENSE file.
|
||
|
|
||
|
module views_bridge_mac.mojom;
|
||
|
|
||
|
import "mojo/public/mojom/base/string16.mojom";
|
||
|
import "ui/base/mojo/ui_base_types.mojom";
|
||
|
import "ui/gfx/geometry/mojo/geometry.mojom";
|
||
|
import "ui/gfx/mojo/ca_layer_params.mojom";
|
||
|
|
||
|
// Ways of changing the visibility of the bridged NSWindow.
|
||
|
enum WindowVisibilityState {
|
||
|
// Hides with -[NSWindow orderOut:].
|
||
|
kHideWindow,
|
||
|
// Shows with -[NSWindow makeKeyAndOrderFront:].
|
||
|
kShowAndActivateWindow,
|
||
|
// Shows with -[NSWindow orderWindow:..]. Orders the window above its parent
|
||
|
// if it has one.
|
||
|
kShowInactive
|
||
|
};
|
||
|
|
||
|
struct BridgedNativeWidgetInitParams {
|
||
|
ui.mojom.ModalType modal_type;
|
||
|
// If true, the underlying window potentially be seen through.
|
||
|
bool is_translucent;
|
||
|
// If true, then the NSWindow is set to have a shadow using
|
||
|
// -[NSWindow setHasShadow:YES].
|
||
|
bool has_window_server_shadow;
|
||
|
// If true, the NSWindow's collection behavior is set to include
|
||
|
// NSWindowCollectionBehaviorParticipatesInCycle (this is not the
|
||
|
// default for NSWindows with NSBorderlessWindowMask).
|
||
|
bool force_into_collection_cycle;
|
||
|
};
|
||
|
|
||
|
// The interface through which a NativeWidgetMac may interact with an NSWindow
|
||
|
// in another process.
|
||
|
interface BridgedNativeWidget {
|
||
|
// Initialize the window's style.
|
||
|
InitWindow(BridgedNativeWidgetInitParams params);
|
||
|
|
||
|
// Initialize the view to display compositor output. This will send the
|
||
|
// current visibility and dimensions (and any future updates) to the
|
||
|
// BridgedNativeWidgetHost.
|
||
|
InitCompositorView();
|
||
|
|
||
|
// Create the NSView to be the content view for the window.
|
||
|
CreateContentView(gfx.mojom.Rect bounds);
|
||
|
|
||
|
// Destroy the content NSView for this window. Note that the window will
|
||
|
// become blank once this has been called.
|
||
|
DestroyContentView();
|
||
|
|
||
|
// Initiate the closing of the window (the closing may be animated or posted
|
||
|
// to be run later).
|
||
|
CloseWindow();
|
||
|
|
||
|
// Immediately close the window (which will have the consequence of deleting
|
||
|
// |this| and its host).
|
||
|
CloseWindowNow();
|
||
|
|
||
|
// Specify initial bounds for the window via |new_bounds| in screen
|
||
|
// coordinates. It is invalid for |new_bounds| to have an empty size and
|
||
|
// non-zero position. The size of the window will be expanded so that the
|
||
|
// content size will be at least |minimum_content_size|. The bounds are offset
|
||
|
// by |parent_offset| (this isn't incorporated directly into |new_bounds| for
|
||
|
// the aforementioned checks of |new_bounds|' position).
|
||
|
SetInitialBounds(gfx.mojom.Rect new_bounds,
|
||
|
gfx.mojom.Size minimum_content_size,
|
||
|
gfx.mojom.Vector2d parent_offset);
|
||
|
|
||
|
// Specify new bounds for the window via |new_bounds| in screen coordinates.
|
||
|
// The size of the window will be expanded so that the content size will be
|
||
|
// at least |minimum_content_size|.
|
||
|
SetBounds(gfx.mojom.Rect new_bounds,
|
||
|
gfx.mojom.Size minimum_content_size);
|
||
|
|
||
|
// Sets the desired visibility of the window and updates the visibility of
|
||
|
// descendant windows where necessary.
|
||
|
SetVisibilityState(WindowVisibilityState new_state);
|
||
|
|
||
|
// Sets the collection behavior so that the window will or will not be visible
|
||
|
// on all spaces.
|
||
|
SetVisibleOnAllSpaces(bool always_visible);
|
||
|
|
||
|
// Called by NativeWidgetMac to initiate a transition to the specified target
|
||
|
// fullscreen state.
|
||
|
SetFullscreen(bool fullscreen);
|
||
|
|
||
|
// Miniaturize or deminiaturize the window.
|
||
|
SetMiniaturized(bool miniaturized);
|
||
|
|
||
|
// Called by NativeWidgetMac when the window size constraints change.
|
||
|
SetSizeConstraints(gfx.mojom.Size min_size,
|
||
|
gfx.mojom.Size max_size,
|
||
|
bool is_resizable,
|
||
|
bool is_maximizable);
|
||
|
|
||
|
// Set the opacity of the NSWindow.
|
||
|
SetOpacity(float opacity);
|
||
|
|
||
|
// Set the content aspect ratio of the NSWindow.
|
||
|
SetContentAspectRatio(gfx.mojom.SizeF aspect_ratio);
|
||
|
|
||
|
// Specify the content to draw in the NSView.
|
||
|
SetCALayerParams(gfx.mojom.CALayerParams ca_layer_params);
|
||
|
|
||
|
// Set the NSWindow's title text.
|
||
|
SetWindowTitle(mojo_base.mojom.String16 title);
|
||
|
|
||
|
// Make the content view be the first responder for the NSWindow.
|
||
|
MakeFirstResponder();
|
||
|
|
||
|
// Clear the touchbar.
|
||
|
ClearTouchBar();
|
||
|
|
||
|
// Acquiring mouse capture first steals capture from any existing
|
||
|
// CocoaMouseCaptureDelegate, then captures all mouse events until released.
|
||
|
AcquireCapture();
|
||
|
ReleaseCapture();
|
||
|
};
|