diff options
author | rohitrao@chromium.org <rohitrao@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-18 16:58:08 +0000 |
---|---|---|
committer | rohitrao@chromium.org <rohitrao@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-18 16:58:08 +0000 |
commit | 357226a1f9f615379a0add23fb8c81a7f598c282 (patch) | |
tree | 16ab65ecad0ae46e903403f5fb17958aeda56712 /chrome/browser/cocoa/bookmark_bar_controller.mm | |
parent | 457f5cf27e7b74c5e6d161015532794f2ae88365 (diff) | |
download | chromium_src-357226a1f9f615379a0add23fb8c81a7f598c282.zip chromium_src-357226a1f9f615379a0add23fb8c81a7f598c282.tar.gz chromium_src-357226a1f9f615379a0add23fb8c81a7f598c282.tar.bz2 |
Add modifier key support for window open dispositions throught the Mac UI
* Add cocoa_utils.{h,mm} and a unit test for the one method it contains:
event_utils::DispositionFromEventFlags().
* Add modifier key support to the history menu, bookmark menu, infobars,
bookmark bar, and Omnibox.
BUG=17912,17301
TEST=When using the aforementioned UI elements, Cmd should open in new
foreground tab, Cmd+Shift should open in new background tab, and Shift should
open in a new window.
Patch by Robert Sesek.
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@23636 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/cocoa/bookmark_bar_controller.mm')
-rw-r--r-- | chrome/browser/cocoa/bookmark_bar_controller.mm | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/chrome/browser/cocoa/bookmark_bar_controller.mm b/chrome/browser/cocoa/bookmark_bar_controller.mm index ebba2f3..5d25b67 100644 --- a/chrome/browser/cocoa/bookmark_bar_controller.mm +++ b/chrome/browser/cocoa/bookmark_bar_controller.mm @@ -17,6 +17,7 @@ #import "chrome/browser/cocoa/view_resizer.h" #include "chrome/browser/cocoa/nsimage_cache.h" #include "chrome/browser/profile.h" +#import "chrome/common/cocoa_utils.h" #include "chrome/common/pref_names.h" #include "chrome/common/pref_service.h" #include "skia/ext/skia_utils_mac.h" @@ -185,7 +186,9 @@ const CGFloat kBookmarkHorizontalPadding = 1.0; - (IBAction)openBookmark:(id)sender { BookmarkNode* node = [self nodeFromButton:sender]; - [urlDelegate_ openBookmarkURL:node->GetURL() disposition:CURRENT_TAB]; + WindowOpenDisposition disposition = event_utils::DispositionFromEventFlags( + [[NSApp currentEvent] modifierFlags]); + [urlDelegate_ openBookmarkURL:node->GetURL() disposition:disposition]; } // Given a NSMenuItem tag, return the appropriate bookmark node id. @@ -498,7 +501,9 @@ const CGFloat kBookmarkHorizontalPadding = 1.0; - (IBAction)openBookmarkMenuItem:(id)sender { int64 tag = [self nodeIdFromMenuTag:[sender tag]]; const BookmarkNode* node = bookmarkModel_->GetNodeByID(tag); - [urlDelegate_ openBookmarkURL:node->GetURL() disposition:CURRENT_TAB]; + WindowOpenDisposition disposition = event_utils::DispositionFromEventFlags( + [[NSApp currentEvent] modifierFlags]); + [urlDelegate_ openBookmarkURL:node->GetURL() disposition:disposition]; } // Add all items from the given model to our bookmark bar. |