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

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

Issue 10038026: TabContents -> WebContentsImpl, part 12. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: *web*contents Created 8 years, 8 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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 44
45 @interface WebContentsViewCocoa (Private) 45 @interface WebContentsViewCocoa (Private)
46 - (id)initWithWebContentsViewMac:(WebContentsViewMac*)w; 46 - (id)initWithWebContentsViewMac:(WebContentsViewMac*)w;
47 - (void)registerDragTypes; 47 - (void)registerDragTypes;
48 - (void)setCurrentDragOperation:(NSDragOperation)operation; 48 - (void)setCurrentDragOperation:(NSDragOperation)operation;
49 - (void)startDragWithDropData:(const WebDropData&)dropData 49 - (void)startDragWithDropData:(const WebDropData&)dropData
50 dragOperationMask:(NSDragOperation)operationMask 50 dragOperationMask:(NSDragOperation)operationMask
51 image:(NSImage*)image 51 image:(NSImage*)image
52 offset:(NSPoint)offset; 52 offset:(NSPoint)offset;
53 - (void)cancelDeferredClose; 53 - (void)cancelDeferredClose;
54 - (void)clearTabContentsView; 54 - (void)clearWebContentsView;
55 - (void)closeTabAfterEvent; 55 - (void)closeTabAfterEvent;
56 - (void)viewDidBecomeFirstResponder:(NSNotification*)notification; 56 - (void)viewDidBecomeFirstResponder:(NSNotification*)notification;
57 @end 57 @end
58 58
59 namespace web_contents_view_mac { 59 namespace web_contents_view_mac {
60 content::WebContentsView* CreateWebContentsView( 60 content::WebContentsView* CreateWebContentsView(
61 TabContents* tab_contents, 61 WebContentsImpl* web_contents,
62 content::WebContentsViewDelegate* delegate) { 62 content::WebContentsViewDelegate* delegate) {
63 return new WebContentsViewMac(tab_contents, delegate); 63 return new WebContentsViewMac(web_contents, delegate);
64 } 64 }
65 } 65 }
66 66
67 WebContentsViewMac::WebContentsViewMac( 67 WebContentsViewMac::WebContentsViewMac(
68 WebContentsImpl* web_contents, 68 WebContentsImpl* web_contents,
69 content::WebContentsViewDelegate* delegate) 69 content::WebContentsViewDelegate* delegate)
70 : web_contents_(web_contents), 70 : web_contents_(web_contents),
71 delegate_(delegate) { 71 delegate_(delegate) {
72 } 72 }
73 73
74 WebContentsViewMac::~WebContentsViewMac() { 74 WebContentsViewMac::~WebContentsViewMac() {
75 // This handles the case where a renderer close call was deferred 75 // This handles the case where a renderer close call was deferred
76 // while the user was operating a UI control which resulted in a 76 // while the user was operating a UI control which resulted in a
77 // close. In that case, the Cocoa view outlives the 77 // close. In that case, the Cocoa view outlives the
78 // WebContentsViewMac instance due to Cocoa retain count. 78 // WebContentsViewMac instance due to Cocoa retain count.
79 [cocoa_view_ cancelDeferredClose]; 79 [cocoa_view_ cancelDeferredClose];
80 [cocoa_view_ clearTabContentsView]; 80 [cocoa_view_ clearWebContentsView];
81 } 81 }
82 82
83 void WebContentsViewMac::CreateView(const gfx::Size& initial_size) { 83 void WebContentsViewMac::CreateView(const gfx::Size& initial_size) {
84 WebContentsViewCocoa* view = 84 WebContentsViewCocoa* view =
85 [[WebContentsViewCocoa alloc] initWithWebContentsViewMac:this]; 85 [[WebContentsViewCocoa alloc] initWithWebContentsViewMac:this];
86 cocoa_view_.reset(view); 86 cocoa_view_.reset(view);
87 } 87 }
88 88
89 RenderWidgetHostView* WebContentsViewMac::CreateViewForWidget( 89 RenderWidgetHostView* WebContentsViewMac::CreateViewForWidget(
90 content::RenderWidgetHost* render_widget_host) { 90 content::RenderWidgetHost* render_widget_host) {
(...skipping 459 matching lines...) Expand 10 before | Expand all | Expand 10 after
550 return [dragDest_ performDragOperation:sender view:self]; 550 return [dragDest_ performDragOperation:sender view:self];
551 } 551 }
552 552
553 - (void)cancelDeferredClose { 553 - (void)cancelDeferredClose {
554 SEL aSel = @selector(closeTabAfterEvent); 554 SEL aSel = @selector(closeTabAfterEvent);
555 [NSObject cancelPreviousPerformRequestsWithTarget:self 555 [NSObject cancelPreviousPerformRequestsWithTarget:self
556 selector:aSel 556 selector:aSel
557 object:nil]; 557 object:nil];
558 } 558 }
559 559
560 - (void)clearTabContentsView { 560 - (void)clearWebContentsView {
561 webContentsView_ = NULL; 561 webContentsView_ = NULL;
562 } 562 }
563 563
564 - (void)closeTabAfterEvent { 564 - (void)closeTabAfterEvent {
565 webContentsView_->CloseTab(); 565 webContentsView_->CloseTab();
566 } 566 }
567 567
568 - (void)viewDidBecomeFirstResponder:(NSNotification*)notification { 568 - (void)viewDidBecomeFirstResponder:(NSNotification*)notification {
569 NSView* view = [notification object]; 569 NSView* view = [notification object];
570 if (![[self subviews] containsObject:view]) 570 if (![[self subviews] containsObject:view])
571 return; 571 return;
572 572
573 NSSelectionDirection direction = 573 NSSelectionDirection direction =
574 [[[notification userInfo] objectForKey:kSelectionDirection] 574 [[[notification userInfo] objectForKey:kSelectionDirection]
575 unsignedIntegerValue]; 575 unsignedIntegerValue];
576 if (direction == NSDirectSelection) 576 if (direction == NSDirectSelection)
577 return; 577 return;
578 578
579 [self webContents]-> 579 [self webContents]->
580 FocusThroughTabTraversal(direction == NSSelectingPrevious); 580 FocusThroughTabTraversal(direction == NSSelectingPrevious);
581 } 581 }
582 582
583 @end 583 @end
OLDNEW
« no previous file with comments | « content/browser/web_contents/web_contents_view_helper.cc ('k') | content/browser/web_contents/web_contents_view_win.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698