electron/shell/browser/osr/osr_web_contents_view_mac.mm

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

54 lines
1.5 KiB
Text
Raw Normal View History

2016-08-04 06:34:29 +00:00
// Copyright (c) 2016 GitHub, Inc.
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.
#include "shell/browser/osr/osr_web_contents_view.h"
2016-08-04 06:34:29 +00:00
2016-09-06 08:24:37 +00:00
#import <Cocoa/Cocoa.h>
2016-08-04 06:34:29 +00:00
@interface OffScreenView : NSView
@end
@implementation OffScreenView
- (void)drawRect:(NSRect)dirtyRect {
NSString* str = @"No content under offscreen mode";
NSMutableParagraphStyle* paragraphStyle =
chore: bump chromium to 117.0.5923.0 (main) (#39304) * chore: bump chromium in DEPS to 117.0.5921.0 * chore: update chromium patches * 4721409: Remove redundant ARC configuration in /components | https://chromium-review.googlesource.com/c/chromium/src/+/4721409 * 4643750: Add V8_LOW_PRIORITY_TQ for main thread | https://chromium-review.googlesource.com/c/chromium/src/+/4643750 * 4022621: Re-register status item when owner of status watcher is changed | https://chromium-review.googlesource.com/c/chromium/src/+/4022621 * chore: update V8/boringssl patches * fixup! 4643750: Add V8_LOW_PRIORITY_TQ for main thread | https://chromium-review.googlesource.com/c/chromium/src/+/4643750 * chore: bump chromium in DEPS to 117.0.5923.0 * build [debug]: remove assert 4722125: Update enterprise content analysis buildflags usage | https://chromium-review.googlesource.com/c/chromium/src/+/4722125 * chore: manually rollback to 117.0.5921.0 * build [arc]: ARC conversion in auto_updater * build [arc]: ARC conversion in browser/api * build [arc]: ARC conversion in notifications/mac * build [arc]: ARC conversion in in_app_purchase * build [arc]: ARC conversion in browser/ui * build [arc]: ARC conversion in ui/cocoa * build [arc]: ARC conversion in shell/common * build [arc]: ARC conversion in OSR * build [arc]: ARC conversion in login_helper * build [arc]: ARC conversion in app_mas * build [arc]: fix up ARC syntax (thanks @codebytere!) * 4726946: [Extensions] Work around dangling BrowserContext pointer. | https://chromium-review.googlesource.com/c/chromium/src/+/4726946 --------- Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com> Co-authored-by: Keeley Hammond <vertedinde@electronjs.org> Co-authored-by: VerteDinde <keeleymhammond@gmail.com>
2023-08-04 08:47:29 +00:00
[[NSParagraphStyle defaultParagraphStyle] mutableCopy];
[paragraphStyle setAlignment:NSTextAlignmentCenter];
2018-04-20 18:47:04 +00:00
NSDictionary* attributes =
[NSDictionary dictionaryWithObject:paragraphStyle
forKey:NSParagraphStyleAttributeName];
2016-08-04 06:34:29 +00:00
NSAttributedString* text =
chore: bump chromium to 117.0.5923.0 (main) (#39304) * chore: bump chromium in DEPS to 117.0.5921.0 * chore: update chromium patches * 4721409: Remove redundant ARC configuration in /components | https://chromium-review.googlesource.com/c/chromium/src/+/4721409 * 4643750: Add V8_LOW_PRIORITY_TQ for main thread | https://chromium-review.googlesource.com/c/chromium/src/+/4643750 * 4022621: Re-register status item when owner of status watcher is changed | https://chromium-review.googlesource.com/c/chromium/src/+/4022621 * chore: update V8/boringssl patches * fixup! 4643750: Add V8_LOW_PRIORITY_TQ for main thread | https://chromium-review.googlesource.com/c/chromium/src/+/4643750 * chore: bump chromium in DEPS to 117.0.5923.0 * build [debug]: remove assert 4722125: Update enterprise content analysis buildflags usage | https://chromium-review.googlesource.com/c/chromium/src/+/4722125 * chore: manually rollback to 117.0.5921.0 * build [arc]: ARC conversion in auto_updater * build [arc]: ARC conversion in browser/api * build [arc]: ARC conversion in notifications/mac * build [arc]: ARC conversion in in_app_purchase * build [arc]: ARC conversion in browser/ui * build [arc]: ARC conversion in ui/cocoa * build [arc]: ARC conversion in shell/common * build [arc]: ARC conversion in OSR * build [arc]: ARC conversion in login_helper * build [arc]: ARC conversion in app_mas * build [arc]: fix up ARC syntax (thanks @codebytere!) * 4726946: [Extensions] Work around dangling BrowserContext pointer. | https://chromium-review.googlesource.com/c/chromium/src/+/4726946 --------- Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com> Co-authored-by: Keeley Hammond <vertedinde@electronjs.org> Co-authored-by: VerteDinde <keeleymhammond@gmail.com>
2023-08-04 08:47:29 +00:00
[[NSAttributedString alloc] initWithString:str attributes:attributes];
2016-08-04 06:34:29 +00:00
NSRect frame = NSMakeRect(0, (self.frame.size.height - text.size.height) / 2,
self.frame.size.width, text.size.height);
[str drawInRect:frame withAttributes:attributes];
}
@end
namespace electron {
gfx::NativeView OffScreenWebContentsView::GetNativeView() const {
return offScreenView_;
}
gfx::NativeView OffScreenWebContentsView::GetContentNativeView() const {
return offScreenView_;
}
gfx::NativeWindow OffScreenWebContentsView::GetTopLevelNativeWindow() const {
return [offScreenView_ window];
}
void OffScreenWebContentsView::PlatformCreate() {
offScreenView_ = [[OffScreenView alloc] init];
}
void OffScreenWebContentsView::PlatformDestroy() {
chore: bump chromium to 117.0.5923.0 (main) (#39304) * chore: bump chromium in DEPS to 117.0.5921.0 * chore: update chromium patches * 4721409: Remove redundant ARC configuration in /components | https://chromium-review.googlesource.com/c/chromium/src/+/4721409 * 4643750: Add V8_LOW_PRIORITY_TQ for main thread | https://chromium-review.googlesource.com/c/chromium/src/+/4643750 * 4022621: Re-register status item when owner of status watcher is changed | https://chromium-review.googlesource.com/c/chromium/src/+/4022621 * chore: update V8/boringssl patches * fixup! 4643750: Add V8_LOW_PRIORITY_TQ for main thread | https://chromium-review.googlesource.com/c/chromium/src/+/4643750 * chore: bump chromium in DEPS to 117.0.5923.0 * build [debug]: remove assert 4722125: Update enterprise content analysis buildflags usage | https://chromium-review.googlesource.com/c/chromium/src/+/4722125 * chore: manually rollback to 117.0.5921.0 * build [arc]: ARC conversion in auto_updater * build [arc]: ARC conversion in browser/api * build [arc]: ARC conversion in notifications/mac * build [arc]: ARC conversion in in_app_purchase * build [arc]: ARC conversion in browser/ui * build [arc]: ARC conversion in ui/cocoa * build [arc]: ARC conversion in shell/common * build [arc]: ARC conversion in OSR * build [arc]: ARC conversion in login_helper * build [arc]: ARC conversion in app_mas * build [arc]: fix up ARC syntax (thanks @codebytere!) * 4726946: [Extensions] Work around dangling BrowserContext pointer. | https://chromium-review.googlesource.com/c/chromium/src/+/4726946 --------- Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com> Co-authored-by: Keeley Hammond <vertedinde@electronjs.org> Co-authored-by: VerteDinde <keeleymhammond@gmail.com>
2023-08-04 08:47:29 +00:00
offScreenView_ = nil;
2016-08-04 06:34:29 +00:00
}
} // namespace electron