@@ -194,10 +194,13 @@ - (CGFloat)roundedCornerRadius;
194
194
@interface ShellNSWindow : UnderlayOpenGLHostingWindow {
195
195
@private
196
196
content::Shell* shell_;
197
+ bool is_transparent_;
197
198
}
198
199
- (void )setShell : (content::Shell*)shell ;
199
200
- (void )showDevTools : (id )sender ;
200
201
- (void )closeAllWindows : (id )sender ;
202
+ - (void )setTransparent ;
203
+ - (BOOL )getTransparent ;
201
204
@end
202
205
203
206
@implementation ShellNSWindow
@@ -214,6 +217,14 @@ - (void)closeAllWindows:(id)sender {
214
217
api::App::CloseAllWindows ();
215
218
}
216
219
220
+ - (void )setTransparent {
221
+ is_transparent_ = true ;
222
+ }
223
+
224
+ - (BOOL )getTransparent {
225
+ return is_transparent_;
226
+ }
227
+
217
228
@end
218
229
219
230
@interface ShellFramelessNSWindow : ShellNSWindow
@@ -231,15 +242,18 @@ - (void)drawCustomFrameRect:(NSRect)rect forView:(NSView*)view {
231
242
[[NSColor clearColor ] set ];
232
243
NSRectFill (rect);
233
244
234
- // Set up our clip.
235
- CGFloat cornerRadius = 4.0 ;
236
- if ([view respondsToSelector: @selector (roundedCornerRadius )])
237
- cornerRadius = [view roundedCornerRadius ];
238
- [[NSBezierPath bezierPathWithRoundedRect: [view bounds ]
239
- xRadius: cornerRadius
240
- yRadius: cornerRadius] addClip ];
241
- [[NSColor whiteColor ] set ];
242
- NSRectFill (rect);
245
+ if (![self getTransparent ])
246
+ {
247
+ // Set up our clip.
248
+ CGFloat cornerRadius = 4.0 ;
249
+ if ([view respondsToSelector: @selector (roundedCornerRadius )])
250
+ cornerRadius = [view roundedCornerRadius ];
251
+ [[NSBezierPath bezierPathWithRoundedRect: [view bounds ]
252
+ xRadius: cornerRadius
253
+ yRadius: cornerRadius] addClip ];
254
+ [[NSColor whiteColor ] set ];
255
+ NSRectFill (rect);
256
+ }
243
257
}
244
258
245
259
+ (NSRect )frameRectForContentRect : (NSRect )contentRect
@@ -270,6 +284,7 @@ - (NSRect)contentRectForFrameRect:(NSRect)frameRect {
270
284
: NativeWindow(shell, manifest),
271
285
is_fullscreen_ (false ),
272
286
is_kiosk_(false ),
287
+ is_transparent_(false ),
273
288
attention_request_id_(0 ),
274
289
use_system_drag_(true ) {
275
290
int width, height;
@@ -428,6 +443,24 @@ - (NSRect)contentRectForFrameRect:(NSRect)frameRect {
428
443
return is_fullscreen_;
429
444
}
430
445
446
+ void NativeWindowCocoa::SetTransparent () {
447
+ is_transparent_ = true ;
448
+ restored_bounds_ = [window () frame ];
449
+ [window () setStyleMask: (NSTitledWindowMask | NSClosableWindowMask | NSMiniaturizableWindowMask | NSResizableWindowMask )];
450
+ [window () setFrame: [window ()
451
+ frameRectForContentRect: [window () frame ]]
452
+ display: YES ];
453
+ [window () setHasShadow: NO ];
454
+ ShellNSWindow* swin = (ShellNSWindow*)window ();
455
+ [swin setTransparent ];
456
+ [window () setOpaque: NO ];
457
+ [window () setBackgroundColor: [NSColor clearColor ]];
458
+ }
459
+
460
+ bool NativeWindowCocoa::IsTransparent () {
461
+ return is_transparent_;
462
+ }
463
+
431
464
void NativeWindowCocoa::SetNonLionFullscreen (bool fullscreen) {
432
465
if (fullscreen == is_fullscreen_)
433
466
return ;
@@ -820,6 +853,21 @@ - (NSRect)contentRectForFrameRect:(NSRect)frameRect {
820
853
}
821
854
}
822
855
856
+ gfx::Point NativeWindowCocoa::GetMousePosition () {
857
+ CGEventRef event = CGEventCreate (NULL );
858
+ CGPoint cursor = CGEventGetLocation (event);
859
+ CFRelease (event);
860
+ return gfx::Point (cursor.x ,cursor.y );
861
+ }
862
+
863
+ void NativeWindowCocoa::BeginOffclientMouseMove () {
864
+ // Not implemented
865
+ }
866
+
867
+ void NativeWindowCocoa::EndOffclientMouseMove () {
868
+ // Not implemented
869
+ }
870
+
823
871
NativeWindow* CreateNativeWindowCocoa (content::Shell* shell,
824
872
base::DictionaryValue* manifest) {
825
873
return new NativeWindowCocoa (shell, manifest);
0 commit comments