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

Unified Diff: chrome/browser/tab_contents/web_contents_view_mac.mm

Issue 42018: Initial pass at copy/paste. Menu items are always enabled. This matches Windo... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/tab_contents/web_contents_view_mac.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/tab_contents/web_contents_view_mac.mm
===================================================================
--- chrome/browser/tab_contents/web_contents_view_mac.mm (revision 11386)
+++ chrome/browser/tab_contents/web_contents_view_mac.mm (working copy)
@@ -13,6 +13,7 @@
#include "chrome/common/temp_scaffolding_stubs.h"
@interface WebContentsViewCocoa (Private)
+- (id)initWithWebContentsViewMac:(WebContentsViewMac*)w;
- (void)processKeyboardEvent:(NSEvent*)event;
@end
@@ -38,9 +39,9 @@
void WebContentsViewMac::CreateView() {
WebContentsViewCocoa* view =
- [[WebContentsViewCocoa alloc] initWithFrame:NSZeroRect];
+ [[WebContentsViewCocoa alloc] initWithWebContentsViewMac:this];
// Under GC, ObjC and CF retains/releases are no longer equivalent. So we
- // change our ObjC retain to a CF retain se we can use a scoped_cftyperef.
+ // change our ObjC retain to a CF retain so we can use a scoped_cftyperef.
CFRetain(view);
[view release];
cocoa_view_.reset(view);
@@ -245,6 +246,14 @@
@implementation WebContentsViewCocoa
+- (id)initWithWebContentsViewMac:(WebContentsViewMac*)w {
+ self = [super initWithFrame:NSZeroRect];
+ if (self != nil) {
+ webContentsView_ = w;
+ }
+ return self;
+}
+
- (void)processKeyboardEvent:(NSEvent*)event {
if ([event type] == NSKeyDown)
[super keyDown:event];
@@ -252,6 +261,22 @@
[super keyUp:event];
}
+// In the Windows version, we always have cut/copy/paste enabled. This is sub-
+// optimal, but we do it too. TODO(avi): Plumb the "can*" methods up from
+// WebCore.
+
+- (void)cut:(id)sender {
+ webContentsView_->GetWebContents()->Cut();
+}
+
+- (void)copy:(id)sender {
+ webContentsView_->GetWebContents()->Copy();
+}
+
+- (void)paste:(id)sender {
+ webContentsView_->GetWebContents()->Paste();
+}
+
// Tons of stuff goes here, where we grab events going on in Cocoaland and send
// them into the C++ system. TODO(avi): all that jazz
« no previous file with comments | « chrome/browser/tab_contents/web_contents_view_mac.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698