| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2009, 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2009, 2012 Google Inc. All rights reserved. |
| 3 * Copyright (C) 2011 Apple Inc. All rights reserved. | 3 * Copyright (C) 2011 Apple Inc. All rights reserved. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions are | 6 * modification, are permitted provided that the following conditions are |
| 7 * met: | 7 * met: |
| 8 * | 8 * |
| 9 * * Redistributions of source code must retain the above copyright | 9 * * Redistributions of source code must retain the above copyright |
| 10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
| (...skipping 448 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 459 if (m_webFrame->client()) | 459 if (m_webFrame->client()) |
| 460 m_webFrame->client()->didFirstVisuallyNonEmptyLayout(m_webFrame); | 460 m_webFrame->client()->didFirstVisuallyNonEmptyLayout(m_webFrame); |
| 461 } | 461 } |
| 462 | 462 |
| 463 void FrameLoaderClientImpl::dispatchDidChangeThemeColor() | 463 void FrameLoaderClientImpl::dispatchDidChangeThemeColor() |
| 464 { | 464 { |
| 465 if (m_webFrame->client()) | 465 if (m_webFrame->client()) |
| 466 m_webFrame->client()->didChangeThemeColor(); | 466 m_webFrame->client()->didChangeThemeColor(); |
| 467 } | 467 } |
| 468 | 468 |
| 469 static bool allowCreatingBackgroundTabs() | |
| 470 { | |
| 471 const WebInputEvent* inputEvent = WebViewImpl::currentInputEvent(); | |
| 472 if (!inputEvent || inputEvent->type != WebInputEvent::MouseUp) | |
| 473 return false; | |
| 474 | |
| 475 const WebMouseEvent* mouseEvent = static_cast<const WebMouseEvent*>(inputEve
nt); | |
| 476 | |
| 477 unsigned short buttonNumber; | |
| 478 switch (mouseEvent->button) { | |
| 479 case WebMouseEvent::ButtonLeft: | |
| 480 buttonNumber = 0; | |
| 481 break; | |
| 482 case WebMouseEvent::ButtonMiddle: | |
| 483 buttonNumber = 1; | |
| 484 break; | |
| 485 case WebMouseEvent::ButtonRight: | |
| 486 buttonNumber = 2; | |
| 487 break; | |
| 488 default: | |
| 489 return false; | |
| 490 } | |
| 491 bool ctrl = mouseEvent->modifiers & WebMouseEvent::ControlKey; | |
| 492 bool shift = mouseEvent->modifiers & WebMouseEvent::ShiftKey; | |
| 493 bool alt = mouseEvent->modifiers & WebMouseEvent::AltKey; | |
| 494 bool meta = mouseEvent->modifiers & WebMouseEvent::MetaKey; | |
| 495 | |
| 496 NavigationPolicy userPolicy; | |
| 497 if (!navigationPolicyFromMouseEvent(buttonNumber, ctrl, shift, alt, meta, &u
serPolicy)) | |
| 498 return false; | |
| 499 return userPolicy == NavigationPolicyNewBackgroundTab; | |
| 500 } | |
| 501 | |
| 502 NavigationPolicy FrameLoaderClientImpl::decidePolicyForNavigation(const Resource
Request& request, DocumentLoader* loader, NavigationPolicy policy, bool isTransi
tionNavigation) | 469 NavigationPolicy FrameLoaderClientImpl::decidePolicyForNavigation(const Resource
Request& request, DocumentLoader* loader, NavigationPolicy policy, bool isTransi
tionNavigation) |
| 503 { | 470 { |
| 504 if (!m_webFrame->client()) | 471 if (!m_webFrame->client()) |
| 505 return NavigationPolicyIgnore; | 472 return NavigationPolicyIgnore; |
| 506 | |
| 507 if (policy == NavigationPolicyNewBackgroundTab && !allowCreatingBackgroundTa
bs()) | |
| 508 policy = NavigationPolicyNewForegroundTab; | |
| 509 | |
| 510 WebDataSourceImpl* ds = WebDataSourceImpl::fromDocumentLoader(loader); | 473 WebDataSourceImpl* ds = WebDataSourceImpl::fromDocumentLoader(loader); |
| 511 | 474 |
| 512 WrappedResourceRequest wrappedResourceRequest(request); | 475 WrappedResourceRequest wrappedResourceRequest(request); |
| 513 WebFrameClient::NavigationPolicyInfo navigationInfo(wrappedResourceRequest); | 476 WebFrameClient::NavigationPolicyInfo navigationInfo(wrappedResourceRequest); |
| 514 navigationInfo.frame = m_webFrame; | 477 navigationInfo.frame = m_webFrame; |
| 515 navigationInfo.extraData = ds->extraData(); | 478 navigationInfo.extraData = ds->extraData(); |
| 516 navigationInfo.navigationType = ds->navigationType(); | 479 navigationInfo.navigationType = ds->navigationType(); |
| 517 navigationInfo.defaultPolicy = static_cast<WebNavigationPolicy>(policy); | 480 navigationInfo.defaultPolicy = static_cast<WebNavigationPolicy>(policy); |
| 518 navigationInfo.isRedirect = ds->isRedirect(); | 481 navigationInfo.isRedirect = ds->isRedirect(); |
| 519 navigationInfo.isTransitionNavigation = isTransitionNavigation; | 482 navigationInfo.isTransitionNavigation = isTransitionNavigation; |
| (...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 926 | 889 |
| 927 unsigned FrameLoaderClientImpl::backForwardLength() | 890 unsigned FrameLoaderClientImpl::backForwardLength() |
| 928 { | 891 { |
| 929 WebViewImpl* webview = m_webFrame->viewImpl(); | 892 WebViewImpl* webview = m_webFrame->viewImpl(); |
| 930 if (!webview || !webview->client()) | 893 if (!webview || !webview->client()) |
| 931 return 0; | 894 return 0; |
| 932 return webview->client()->historyBackListCount() + 1 + webview->client()->hi
storyForwardListCount(); | 895 return webview->client()->historyBackListCount() + 1 + webview->client()->hi
storyForwardListCount(); |
| 933 } | 896 } |
| 934 | 897 |
| 935 } // namespace blink | 898 } // namespace blink |
| OLD | NEW |