diff options
author | avi@chromium.org <avi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-03-11 14:53:13 +0000 |
---|---|---|
committer | avi@chromium.org <avi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-03-11 14:53:13 +0000 |
commit | 922244b319c4cb9c68b10cc3a206ae1bb1ebbfbd (patch) | |
tree | d7e17101086c5da7177db73883f7f0b515c2b395 /chrome | |
parent | 4330ad19ce4e258ee8b3e36930c2265b1df029ab (diff) | |
download | chromium_src-922244b319c4cb9c68b10cc3a206ae1bb1ebbfbd.zip chromium_src-922244b319c4cb9c68b10cc3a206ae1bb1ebbfbd.tar.gz chromium_src-922244b319c4cb9c68b10cc3a206ae1bb1ebbfbd.tar.bz2 |
Initial pass at copy/paste. Menu items are always enabled. This matches Windows; we'll do better soon.
Review URL: http://codereview.chromium.org/42018
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@11444 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/app/nibs/en.lproj/TabContents.xib | 14 | ||||
-rw-r--r-- | chrome/browser/tab_contents/web_contents_view_mac.h | 3 | ||||
-rw-r--r-- | chrome/browser/tab_contents/web_contents_view_mac.mm | 29 |
3 files changed, 37 insertions, 9 deletions
diff --git a/chrome/app/nibs/en.lproj/TabContents.xib b/chrome/app/nibs/en.lproj/TabContents.xib index 217660b..a084868 100644 --- a/chrome/app/nibs/en.lproj/TabContents.xib +++ b/chrome/app/nibs/en.lproj/TabContents.xib @@ -2,13 +2,13 @@ <archive type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="7.03"> <data> <int key="IBDocument.SystemTarget">1050</int> - <string key="IBDocument.SystemVersion">9F33</string> + <string key="IBDocument.SystemVersion">9G55</string> <string key="IBDocument.InterfaceBuilderVersion">677</string> - <string key="IBDocument.AppKitVersion">949.34</string> - <string key="IBDocument.HIToolboxVersion">352.00</string> + <string key="IBDocument.AppKitVersion">949.43</string> + <string key="IBDocument.HIToolboxVersion">353.00</string> <object class="NSMutableArray" key="IBDocument.EditedObjectIDs"> <bool key="EncodedWithXMLCoder">YES</bool> - <integer value="164"/> + <integer value="112"/> </object> <object class="NSArray" key="IBDocument.PluginDependencies"> <bool key="EncodedWithXMLCoder">YES</bool> @@ -146,7 +146,7 @@ <bool key="NSEnabled">YES</bool> <object class="NSTextFieldCell" key="NSCell" id="971876011"> <int key="NSCellFlags">-1804468671</int> - <int key="NSCellFlags2">1073775616</int> + <int key="NSCellFlags2">33792</int> <object class="NSAttributedString" key="NSContents"> <string key="NSString">chromium.org</string> <object class="NSDictionary" key="NSAttributes"> @@ -713,9 +713,9 @@ <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> - <string>{{273, 241}, {480, 360}}</string> + <string>{{273, 242}, {480, 360}}</string> <boolean value="YES" id="5"/> - <string>{{273, 241}, {480, 360}}</string> + <string>{{273, 242}, {480, 360}}</string> <reference ref="5"/> <reference ref="5"/> <string>{480, 360}</string> diff --git a/chrome/browser/tab_contents/web_contents_view_mac.h b/chrome/browser/tab_contents/web_contents_view_mac.h index 497725c..9f562c0 100644 --- a/chrome/browser/tab_contents/web_contents_view_mac.h +++ b/chrome/browser/tab_contents/web_contents_view_mac.h @@ -15,8 +15,11 @@ class FindBarMac; @class SadTabView; +class WebContentsViewMac; @interface WebContentsViewCocoa : BaseView { + @private + WebContentsViewMac* webContentsView_; // WEAK; owns us } @end diff --git a/chrome/browser/tab_contents/web_contents_view_mac.mm b/chrome/browser/tab_contents/web_contents_view_mac.mm index 19c2d64..deb452c 100644 --- a/chrome/browser/tab_contents/web_contents_view_mac.mm +++ b/chrome/browser/tab_contents/web_contents_view_mac.mm @@ -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 @@ WebContents* WebContentsViewMac::GetWebContents() { 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 @@ void WebContentsViewMac::Observe(NotificationType type, @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 @@ void WebContentsViewMac::Observe(NotificationType type, [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 |