summaryrefslogtreecommitdiffstats
path: root/webkit/glue/window_open_disposition.cc
diff options
context:
space:
mode:
authordarin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-16 16:50:12 +0000
committerdarin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-16 16:50:12 +0000
commit0d864a98f4749e7f81987a0ee84cabaebd6b6cee (patch)
tree903d0dc001f33995fd100ed99ef2f544c91da101 /webkit/glue/window_open_disposition.cc
parent522b1e1c7dc9e9898543e018647d22126aa02177 (diff)
downloadchromium_src-0d864a98f4749e7f81987a0ee84cabaebd6b6cee.zip
chromium_src-0d864a98f4749e7f81987a0ee84cabaebd6b6cee.tar.gz
chromium_src-0d864a98f4749e7f81987a0ee84cabaebd6b6cee.tar.bz2
Simplify window_open_disposition.cc since we only require conversion from
WebNavigationPolicy. This is cleanup from the WebWidget patch that you reviewed yesterday. TEST=none BUG=none R=dglazkov Review URL: http://codereview.chromium.org/155637 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@20874 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/glue/window_open_disposition.cc')
-rw-r--r--webkit/glue/window_open_disposition.cc41
1 files changed, 14 insertions, 27 deletions
diff --git a/webkit/glue/window_open_disposition.cc b/webkit/glue/window_open_disposition.cc
index 417ab1a..6a117d3 100644
--- a/webkit/glue/window_open_disposition.cc
+++ b/webkit/glue/window_open_disposition.cc
@@ -6,38 +6,25 @@
#include "base/logging.h"
-// The macro dance here allows us to only express the mapping once.
-#define MAPPINGS(MAP) \
- MAP(WebNavigationPolicyIgnore, IGNORE_ACTION) \
- MAP(WebNavigationPolicyDownload, SAVE_TO_DISK) \
- MAP(WebNavigationPolicyCurrentTab, CURRENT_TAB) \
- MAP(WebNavigationPolicyNewBackgroundTab, NEW_BACKGROUND_TAB) \
- MAP(WebNavigationPolicyNewForegroundTab, NEW_FOREGROUND_TAB) \
- MAP(WebNavigationPolicyNewWindow, NEW_WINDOW) \
- MAP(WebNavigationPolicyNewPopup, NEW_POPUP)
-
-#define POLICY_TO_DISPOSITION(policy, disposition) \
- case WebKit::policy: return disposition;
-
WindowOpenDisposition NavigationPolicyToDisposition(
WebKit::WebNavigationPolicy policy) {
switch (policy) {
- MAPPINGS(POLICY_TO_DISPOSITION)
+ case WebKit::WebNavigationPolicyIgnore:
+ return IGNORE_ACTION;
+ case WebKit::WebNavigationPolicyDownload:
+ return SAVE_TO_DISK;
+ case WebKit::WebNavigationPolicyCurrentTab:
+ return CURRENT_TAB;
+ case WebKit::WebNavigationPolicyNewBackgroundTab:
+ return NEW_BACKGROUND_TAB;
+ case WebKit::WebNavigationPolicyNewForegroundTab:
+ return NEW_FOREGROUND_TAB;
+ case WebKit::WebNavigationPolicyNewWindow:
+ return NEW_WINDOW;
+ case WebKit::WebNavigationPolicyNewPopup:
+ return NEW_POPUP;
default:
NOTREACHED() << "Unexpected WebNavigationPolicy";
return IGNORE_ACTION;
}
}
-
-#define DISPOSITION_TO_POLICY(policy, disposition) \
- case disposition: return WebKit::policy;
-
-WebKit::WebNavigationPolicy DispositionToNavigationPolicy(
- WindowOpenDisposition disposition) {
- switch (disposition) {
- MAPPINGS(DISPOSITION_TO_POLICY)
- default:
- NOTREACHED() << "Unexpected WindowOpenDisposition";
- return WebKit::WebNavigationPolicyIgnore;
- }
-}