1// Copyright (c) 2009 The Chromium Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#include "webkit/glue/window_open_disposition.h"
6
7#include "base/logging.h"
8
9WindowOpenDisposition NavigationPolicyToDisposition(
10    WebKit::WebNavigationPolicy policy) {
11  switch (policy) {
12    case WebKit::WebNavigationPolicyIgnore:
13      return IGNORE_ACTION;
14    case WebKit::WebNavigationPolicyDownload:
15      return SAVE_TO_DISK;
16    case WebKit::WebNavigationPolicyCurrentTab:
17      return CURRENT_TAB;
18    case WebKit::WebNavigationPolicyNewBackgroundTab:
19      return NEW_BACKGROUND_TAB;
20    case WebKit::WebNavigationPolicyNewForegroundTab:
21      return NEW_FOREGROUND_TAB;
22    case WebKit::WebNavigationPolicyNewWindow:
23      return NEW_WINDOW;
24    case WebKit::WebNavigationPolicyNewPopup:
25      return NEW_POPUP;
26  default:
27    NOTREACHED() << "Unexpected WebNavigationPolicy";
28    return IGNORE_ACTION;
29  }
30}
31