summaryrefslogtreecommitdiffstats
path: root/chrome/common
diff options
context:
space:
mode:
authorben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-08-19 03:52:11 +0000
committerben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-08-19 03:52:11 +0000
commit1a6b30a619cba771cb9c4ed4da9c3778634567ad (patch)
tree4ced69ac8eb511a6f9bc7949348551ee62b57989 /chrome/common
parenta8815b3277284778247545728bc41a077ff55b43 (diff)
downloadchromium_src-1a6b30a619cba771cb9c4ed4da9c3778634567ad.zip
chromium_src-1a6b30a619cba771cb9c4ed4da9c3778634567ad.tar.gz
chromium_src-1a6b30a619cba771cb9c4ed4da9c3778634567ad.tar.bz2
This changelist represents the necessary merger of two others:
http://codereview.chromium.org/172082 Create new event_utils.h file for Cocoa-specific event to WindowOpenDisposition cracking. Hook this up to BookmarkBarController so that clicks to bookmark items use the oracle function to determine where the bookmark should be opened. BUG=17301 TEST=Cmd+Click etc on bookmark items should work. See bug and unit test attached. http://codereview.chromium.org/174021 Convert users of the "get last active browser, get selected tab contents, open url" pattern to just call OpenURL on Browser directly. Makes GetOrCreateTabbedBrowser public on Browser, and makes it static so it can be called with a provided profile. BUG=none TEST=Try opening links from the bookmark/history menus on mac, with and without an existing window open, with an active incognito window, etc. The links should all open in the last active non-incognito window, or create a new non-incognito window if none is open. Review URL: http://codereview.chromium.org/173044 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@23693 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/common')
-rw-r--r--chrome/common/cocoa_utils.h20
-rw-r--r--chrome/common/cocoa_utils.mm26
-rw-r--r--chrome/common/cocoa_utils_unittest.mm23
3 files changed, 0 insertions, 69 deletions
diff --git a/chrome/common/cocoa_utils.h b/chrome/common/cocoa_utils.h
deleted file mode 100644
index 4607f987..0000000
--- a/chrome/common/cocoa_utils.h
+++ /dev/null
@@ -1,20 +0,0 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef CHROME_COMMON_COCOA_UTIL_H_
-#define CHROME_COMMON_COCOA_UTIL_H_
-
-#import <Cocoa/Cocoa.h>
-#include "webkit/glue/window_open_disposition.h"
-
-namespace event_utils {
-
-// Translates modifier flags from an NSEvent into a WindowOpenDisposition. For
-// example, holding down Cmd (Apple) will cause pages to be opened in a new
-// foreground tab. Pass this the result of -[NSEvent modifierFlags].
-WindowOpenDisposition DispositionFromEventFlags(NSUInteger modifiers);
-
-} // namespace event_utils
-
-#endif // CHROME_COMMON_COCOA_UTIL_H_
diff --git a/chrome/common/cocoa_utils.mm b/chrome/common/cocoa_utils.mm
deleted file mode 100644
index 3472178..0000000
--- a/chrome/common/cocoa_utils.mm
+++ /dev/null
@@ -1,26 +0,0 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#import "chrome/common/cocoa_utils.h"
-
-namespace event_utils {
-
-// Translates modifier flags from an NSEvent into a WindowOpenDisposition. For
-// example, holding down Cmd (Apple) will cause pages to be opened in a new
-// foreground tab. Pass this the result of -[NSEvent modifierFlags].
-WindowOpenDisposition DispositionFromEventFlags(NSUInteger modifiers) {
- if (modifiers & NSCommandKeyMask) {
- return (modifiers & NSShiftKeyMask) ?
- NEW_BACKGROUND_TAB : NEW_FOREGROUND_TAB;
- }
-
- if (modifiers & NSShiftKeyMask)
- return NEW_WINDOW;
- // TODO: Browser::OpenURLAtIndex does not support SAVE_TO_DISK, so we can't
- // offer to download the page. See DCHECK() and TODOs there.
- return (false /* modifiers & NSAlternateKeyMask */) ?
- SAVE_TO_DISK : CURRENT_TAB;
-}
-
-} // namespace event_utils
diff --git a/chrome/common/cocoa_utils_unittest.mm b/chrome/common/cocoa_utils_unittest.mm
deleted file mode 100644
index e9ce0ae..0000000
--- a/chrome/common/cocoa_utils_unittest.mm
+++ /dev/null
@@ -1,23 +0,0 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#import "chrome/common/cocoa_utils.h"
-#include "testing/gtest/include/gtest/gtest.h"
-
-TEST(CocoaUtilsTest, DispositionFromEventFlagsTest) {
- ASSERT_EQ(NEW_FOREGROUND_TAB,
- event_utils::DispositionFromEventFlags(NSCommandKeyMask));
- ASSERT_EQ(NEW_BACKGROUND_TAB,
- event_utils::DispositionFromEventFlags(NSCommandKeyMask |
- NSShiftKeyMask));
- ASSERT_EQ(NEW_WINDOW,
- event_utils::DispositionFromEventFlags(NSShiftKeyMask));
- // The SAVE_TO_DISK disposition is not currently supported, so we use
- // CURRENT_TAB instead.
- ASSERT_EQ(CURRENT_TAB,
- event_utils::DispositionFromEventFlags(NSAlternateKeyMask));
- ASSERT_EQ(CURRENT_TAB, event_utils::DispositionFromEventFlags(0));
- ASSERT_EQ(CURRENT_TAB,
- event_utils::DispositionFromEventFlags(NSControlKeyMask));
-}