[go: nahoru, domu]

blob: b9945560d700f8f2329e767bf8a89de5dfd4eb2a [file] [log] [blame]
Avi Drissman4e1b7bc32022-09-15 14:03:501// Copyright 2018 The Chromium Authors
Christopher Cameronec34e182018-12-06 05:45:542// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
Christopher Camerona5ff6572019-05-07 01:41:275#ifndef CONTENT_APP_SHIM_REMOTE_COCOA_WEB_CONTENTS_VIEW_COCOA_H_
6#define CONTENT_APP_SHIM_REMOTE_COCOA_WEB_CONTENTS_VIEW_COCOA_H_
Christopher Cameronec34e182018-12-06 05:45:547
Keishi Hattori7c3c7182022-06-24 22:18:148#include "base/memory/raw_ptr.h"
Christopher Cameronec34e182018-12-06 05:45:549#include "content/common/content_export.h"
Jayson Adams1a3f08d62022-01-07 04:36:2410#include "content/common/web_contents_ns_view_bridge.mojom.h"
Christopher Cameronec34e182018-12-06 05:45:5411#import "ui/base/cocoa/base_view.h"
12#import "ui/base/cocoa/views_hostable.h"
13
14namespace content {
15struct DropData;
Christopher Cameronec34e182018-12-06 05:45:5416} // namespace content
17
Avi Drissman5ddd9c172023-07-06 14:47:4318namespace remote_cocoa::mojom {
Christopher Cameronf0bdd12b2019-06-01 18:10:2919class WebContentsNSViewHost;
Avi Drissman5ddd9c172023-07-06 14:47:4320} // namespace remote_cocoa::mojom
Christopher Cameronf0bdd12b2019-06-01 18:10:2921
Daniel Cheng2cb89f92023-09-28 00:46:5422namespace url {
23class Origin;
24}
25
Christopher Cameronec34e182018-12-06 05:45:5426@class WebDragSource;
27
28CONTENT_EXPORT
Avi Drissman8628f892022-12-20 16:11:1829@interface WebContentsViewCocoa
Avi Drissman5ddd9c172023-07-06 14:47:4330 : BaseView <ViewsHostable, NSDraggingSource, NSDraggingDestination>
Christopher Cameronec34e182018-12-06 05:45:5431
Christopher Cameron02e5964f2019-03-05 22:23:1632// Set or un-set the mojo interface through which to communicate with the
33// browser process.
Christopher Cameronf0bdd12b2019-06-01 18:10:2934- (void)setHost:(remote_cocoa::mojom::WebContentsNSViewHost*)host;
Christopher Camerone30928e2019-01-23 20:12:3235
Christopher Cameronec34e182018-12-06 05:45:5436- (void)setMouseDownCanMoveWindow:(BOOL)canMove;
37
Christopher Cameron0d8764972021-07-13 20:15:1038// Enable the workaround for https://crbug.com/1148078. This is called by
39// in-PWA-process instances, to limit the workaround's effect to just PWAs.
40- (void)enableDroppedScreenShotCopier;
41
Christopher Cameronec34e182018-12-06 05:45:5442// Private interface.
43// TODO(ccameron): Document these functions.
Leonard Grey2f55fb92021-05-14 20:42:4344- (instancetype)initWithViewsHostableView:(ui::ViewsHostableView*)v;
Christopher Cameronec34e182018-12-06 05:45:5445- (void)registerDragTypes;
Christopher Cameronec34e182018-12-06 05:45:5446- (void)startDragWithDropData:(const content::DropData&)dropData
Daniel Cheng2cb89f92023-09-28 00:46:5447 sourceOrigin:(const url::Origin&)sourceOrigin
Christopher Cameronec34e182018-12-06 05:45:5448 dragOperationMask:(NSDragOperation)operationMask
49 image:(NSImage*)image
Avi Drissman905fa882023-02-13 17:49:4950 offset:(NSPoint)offset
51 isPrivileged:(BOOL)isPrivileged;
Christopher Cameron02e5964f2019-03-05 22:23:1652- (void)clearViewsHostableView;
Christopher Cameronec34e182018-12-06 05:45:5453- (void)viewDidBecomeFirstResponder:(NSNotification*)notification;
Jayson Adamsef4af89ba2022-06-13 20:07:5454
55// API exposed for testing.
56
57// Used to set the web contents's visibility status to occluded after a delay.
58- (void)performDelayedSetWebContentsOccluded;
59
60// Returns YES if the WCVC is scheduled to set its web contents's to the
61// occluded state.
62- (BOOL)willSetWebContentsOccludedAfterDelayForTesting;
63
64// Updates the WCVC's web contents's visibility state. The update may occur
65// immediately or in the near future.
66- (void)updateWebContentsVisibility:(remote_cocoa::mojom::Visibility)visibility;
67
Marijn Kruisselbrink61cdd4d2023-01-26 02:47:4868- (void)updateWindowControlsOverlay:(const gfx::Rect&)boundingRect;
69
Christopher Cameronec34e182018-12-06 05:45:5470@end
71
Jayson Adams1a3f08d62022-01-07 04:36:2472@interface NSWindow (WebContentsViewCocoa)
73// Returns all the WebContentsViewCocoas in the window.
74- (NSArray<WebContentsViewCocoa*>*)webContentsViewCocoa;
Jayson Adamsef4af89ba2022-06-13 20:07:5475// Returns YES if the window contains at least one WebContentsViewCocoa.
76- (BOOL)containsWebContentsViewCocoa;
Jayson Adams1a3f08d62022-01-07 04:36:2477@end
78
Christopher Camerona5ff6572019-05-07 01:41:2779#endif // CONTENT_APP_SHIM_REMOTE_COCOA_WEB_CONTENTS_VIEW_COCOA_H_