Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(194)

Side by Side Diff: content/browser/web_contents/web_contents_view_mac.mm

Issue 10824004: [mac] Implement {frame: 'none'} app window on Mac. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #import <Carbon/Carbon.h> 5 #import <Carbon/Carbon.h>
6 6
7 #import "content/browser/web_contents/web_contents_view_mac.h" 7 #import "content/browser/web_contents/web_contents_view_mac.h"
8 8
9 #include <string> 9 #include <string>
10 10
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after
323 withObject:nil 323 withObject:nil
324 afterDelay:0.0]; 324 afterDelay:0.0];
325 } 325 }
326 326
327 gfx::Rect WebContentsViewMac::GetViewBounds() const { 327 gfx::Rect WebContentsViewMac::GetViewBounds() const {
328 // This method is not currently used on mac. 328 // This method is not currently used on mac.
329 NOTIMPLEMENTED(); 329 NOTIMPLEMENTED();
330 return gfx::Rect(); 330 return gfx::Rect();
331 } 331 }
332 332
333 void WebContentsViewMac::SetMouseDownCanMoveWindow(bool can_move) {
334 [cocoa_view_ setMouseDownCanMoveWindow:can_move];
335 }
336
333 void WebContentsViewMac::CloseTab() { 337 void WebContentsViewMac::CloseTab() {
334 web_contents_->Close(web_contents_->GetRenderViewHost()); 338 web_contents_->Close(web_contents_->GetRenderViewHost());
335 } 339 }
336 340
337 @implementation WebContentsViewCocoa 341 @implementation WebContentsViewCocoa
338 342
339 - (id)initWithWebContentsViewMac:(WebContentsViewMac*)w { 343 - (id)initWithWebContentsViewMac:(WebContentsViewMac*)w {
340 self = [super initWithFrame:NSZeroRect]; 344 self = [super initWithFrame:NSZeroRect];
341 if (self != nil) { 345 if (self != nil) {
342 webContentsView_ = w; 346 webContentsView_ = w;
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
405 NSPoint location = [NSEvent mouseLocation]; 409 NSPoint location = [NSEvent mouseLocation];
406 if ([theEvent type] == NSMouseMoved) 410 if ([theEvent type] == NSMouseMoved)
407 webContents->GetDelegate()->ContentsMouseEvent( 411 webContents->GetDelegate()->ContentsMouseEvent(
408 webContents, gfx::Point(location.x, location.y), true); 412 webContents, gfx::Point(location.x, location.y), true);
409 if ([theEvent type] == NSMouseExited) 413 if ([theEvent type] == NSMouseExited)
410 webContents->GetDelegate()->ContentsMouseEvent( 414 webContents->GetDelegate()->ContentsMouseEvent(
411 webContents, gfx::Point(location.x, location.y), false); 415 webContents, gfx::Point(location.x, location.y), false);
412 } 416 }
413 } 417 }
414 418
419 - (void)setMouseDownCanMoveWindow:(BOOL)canMove {
420 mouseDownCanMoveWindow_ = canMove;
421 }
422
415 - (BOOL)mouseDownCanMoveWindow { 423 - (BOOL)mouseDownCanMoveWindow {
416 // This is needed to prevent mouseDowns from moving the window 424 // This is needed to prevent mouseDowns from moving the window
417 // around. The default implementation returns YES only for opaque 425 // around. The default implementation returns YES only for opaque
418 // views. WebContentsViewCocoa does not draw itself in any way, but 426 // views. WebContentsViewCocoa does not draw itself in any way, but
419 // its subviews do paint their entire frames. Returning NO here 427 // its subviews do paint their entire frames. Returning NO here
420 // saves us the effort of overriding this method in every possible 428 // saves us the effort of overriding this method in every possible
421 // subview. 429 // subview.
422 return NO; 430 return mouseDownCanMoveWindow_;
423 } 431 }
424 432
425 - (void)pasteboard:(NSPasteboard*)sender provideDataForType:(NSString*)type { 433 - (void)pasteboard:(NSPasteboard*)sender provideDataForType:(NSString*)type {
426 [dragSource_ lazyWriteToPasteboard:sender 434 [dragSource_ lazyWriteToPasteboard:sender
427 forType:type]; 435 forType:type];
428 } 436 }
429 437
430 - (void)startDragWithDropData:(const WebDropData&)dropData 438 - (void)startDragWithDropData:(const WebDropData&)dropData
431 dragOperationMask:(NSDragOperation)operationMask 439 dragOperationMask:(NSDragOperation)operationMask
432 image:(NSImage*)image 440 image:(NSImage*)image
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
525 [[[notification userInfo] objectForKey:kSelectionDirection] 533 [[[notification userInfo] objectForKey:kSelectionDirection]
526 unsignedIntegerValue]; 534 unsignedIntegerValue];
527 if (direction == NSDirectSelection) 535 if (direction == NSDirectSelection)
528 return; 536 return;
529 537
530 [self webContents]-> 538 [self webContents]->
531 FocusThroughTabTraversal(direction == NSSelectingPrevious); 539 FocusThroughTabTraversal(direction == NSSelectingPrevious);
532 } 540 }
533 541
534 @end 542 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698