| OLD | NEW |
| 1 // Copyright (c) 2007-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2007-2009 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "config.h" | 5 #include "config.h" |
| 6 #include "build/build_config.h" | 6 #include "build/build_config.h" |
| 7 | 7 |
| 8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
| 9 MSVC_PUSH_WARNING_LEVEL(0); | 9 MSVC_PUSH_WARNING_LEVEL(0); |
| 10 #include "AXObjectCache.h" | 10 #include "AXObjectCache.h" |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 #include "webkit/api/src/WebInputEventConversion.h" | 73 #include "webkit/api/src/WebInputEventConversion.h" |
| 74 #include "webkit/api/src/WebSettingsImpl.h" | 74 #include "webkit/api/src/WebSettingsImpl.h" |
| 75 #include "webkit/glue/dom_operations.h" | 75 #include "webkit/glue/dom_operations.h" |
| 76 #include "webkit/glue/glue_serialize.h" | 76 #include "webkit/glue/glue_serialize.h" |
| 77 #include "webkit/glue/glue_util.h" | 77 #include "webkit/glue/glue_util.h" |
| 78 #include "webkit/glue/image_resource_fetcher.h" | 78 #include "webkit/glue/image_resource_fetcher.h" |
| 79 #include "webkit/glue/searchable_form_data.h" | 79 #include "webkit/glue/searchable_form_data.h" |
| 80 #include "webkit/glue/webdevtoolsagent_impl.h" | 80 #include "webkit/glue/webdevtoolsagent_impl.h" |
| 81 #include "webkit/glue/webkit_glue.h" | 81 #include "webkit/glue/webkit_glue.h" |
| 82 #include "webkit/glue/webpopupmenu_impl.h" | 82 #include "webkit/glue/webpopupmenu_impl.h" |
| 83 #include "webkit/glue/webdevtoolsagent.h" | |
| 84 #include "webkit/glue/webdevtoolsclient.h" | 83 #include "webkit/glue/webdevtoolsclient.h" |
| 85 #include "webkit/glue/webview_delegate.h" | 84 #include "webkit/glue/webview_delegate.h" |
| 86 #include "webkit/glue/webview_impl.h" | 85 #include "webkit/glue/webview_impl.h" |
| 87 | 86 |
| 88 // Get rid of WTF's pow define so we can use std::pow. | 87 // Get rid of WTF's pow define so we can use std::pow. |
| 89 #undef pow | 88 #undef pow |
| 90 #include <cmath> // for std::pow | 89 #include <cmath> // for std::pow |
| 91 | 90 |
| 92 using namespace WebCore; | 91 using namespace WebCore; |
| 93 | 92 |
| 94 using WebKit::PlatformKeyboardEventBuilder; | 93 using WebKit::PlatformKeyboardEventBuilder; |
| 95 using WebKit::PlatformMouseEventBuilder; | 94 using WebKit::PlatformMouseEventBuilder; |
| 96 using WebKit::PlatformWheelEventBuilder; | 95 using WebKit::PlatformWheelEventBuilder; |
| 97 using WebKit::WebAccessibilityObject; | 96 using WebKit::WebAccessibilityObject; |
| 98 using WebKit::WebCanvas; | 97 using WebKit::WebCanvas; |
| 99 using WebKit::WebCompositionCommand; | 98 using WebKit::WebCompositionCommand; |
| 100 using WebKit::WebCompositionCommandConfirm; | 99 using WebKit::WebCompositionCommandConfirm; |
| 101 using WebKit::WebCompositionCommandDiscard; | 100 using WebKit::WebCompositionCommandDiscard; |
| 101 using WebKit::WebDevToolsAgent; |
| 102 using WebKit::WebDevToolsAgentClient; |
| 102 using WebKit::WebDragData; | 103 using WebKit::WebDragData; |
| 103 using WebKit::WebDragOperation; | 104 using WebKit::WebDragOperation; |
| 104 using WebKit::WebDragOperationCopy; | 105 using WebKit::WebDragOperationCopy; |
| 105 using WebKit::WebDragOperationNone; | 106 using WebKit::WebDragOperationNone; |
| 106 using WebKit::WebDragOperationsMask; | 107 using WebKit::WebDragOperationsMask; |
| 107 using WebKit::WebFrame; | 108 using WebKit::WebFrame; |
| 108 using WebKit::WebFrameClient; | 109 using WebKit::WebFrameClient; |
| 109 using WebKit::WebInputEvent; | 110 using WebKit::WebInputEvent; |
| 110 using WebKit::WebKeyboardEvent; | 111 using WebKit::WebKeyboardEvent; |
| 111 using WebKit::WebMediaPlayerAction; | 112 using WebKit::WebMediaPlayerAction; |
| (...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 347 return instance; | 348 return instance; |
| 348 } | 349 } |
| 349 | 350 |
| 350 void WebViewImpl::initializeMainFrame(WebFrameClient* frame_client) { | 351 void WebViewImpl::initializeMainFrame(WebFrameClient* frame_client) { |
| 351 // NOTE: The WebFrameImpl takes a reference to itself within InitMainFrame | 352 // NOTE: The WebFrameImpl takes a reference to itself within InitMainFrame |
| 352 // and releases that reference once the corresponding Frame is destroyed. | 353 // and releases that reference once the corresponding Frame is destroyed. |
| 353 RefPtr<WebFrameImpl> main_frame = WebFrameImpl::create(frame_client); | 354 RefPtr<WebFrameImpl> main_frame = WebFrameImpl::create(frame_client); |
| 354 | 355 |
| 355 main_frame->InitMainFrame(this); | 356 main_frame->InitMainFrame(this); |
| 356 | 357 |
| 357 if (delegate_) { | 358 if (client()) { |
| 358 WebDevToolsAgentDelegate* tools_delegate = | 359 WebDevToolsAgentClient* tools_client = client()->devToolsAgentClient(); |
| 359 delegate_->GetWebDevToolsAgentDelegate(); | 360 if (tools_client) |
| 360 if (tools_delegate) | 361 devtools_agent_.reset(new WebDevToolsAgentImpl(this, tools_client)); |
| 361 devtools_agent_.reset(new WebDevToolsAgentImpl(this, tools_delegate)); | |
| 362 } | 362 } |
| 363 | 363 |
| 364 // Restrict the access to the local file system | 364 // Restrict the access to the local file system |
| 365 // (see WebView.mm WebView::_commonInitializationWithFrameName). | 365 // (see WebView.mm WebView::_commonInitializationWithFrameName). |
| 366 SecurityOrigin::setLocalLoadPolicy( | 366 SecurityOrigin::setLocalLoadPolicy( |
| 367 SecurityOrigin::AllowLocalLoadsForLocalOnly); | 367 SecurityOrigin::AllowLocalLoadsForLocalOnly); |
| 368 } | 368 } |
| 369 | 369 |
| 370 // static | 370 // static |
| 371 void WebView::UpdateVisitedLinkState(uint64 link_hash) { | 371 void WebView::UpdateVisitedLinkState(uint64 link_hash) { |
| (...skipping 1286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1658 } | 1658 } |
| 1659 | 1659 |
| 1660 WebString WebViewImpl::inspectorSettings() const { | 1660 WebString WebViewImpl::inspectorSettings() const { |
| 1661 return inspector_settings_; | 1661 return inspector_settings_; |
| 1662 } | 1662 } |
| 1663 | 1663 |
| 1664 void WebViewImpl::setInspectorSettings(const WebString& settings) { | 1664 void WebViewImpl::setInspectorSettings(const WebString& settings) { |
| 1665 inspector_settings_ = settings; | 1665 inspector_settings_ = settings; |
| 1666 } | 1666 } |
| 1667 | 1667 |
| 1668 WebDevToolsAgent* WebViewImpl::devToolsAgent() { |
| 1669 return devtools_agent_.get(); |
| 1670 } |
| 1671 |
| 1668 WebAccessibilityObject WebViewImpl::accessibilityObject() { | 1672 WebAccessibilityObject WebViewImpl::accessibilityObject() { |
| 1669 if (!main_frame()) | 1673 if (!main_frame()) |
| 1670 return WebAccessibilityObject(); | 1674 return WebAccessibilityObject(); |
| 1671 | 1675 |
| 1672 WebCore::Document* document = main_frame()->frame()->document(); | 1676 WebCore::Document* document = main_frame()->frame()->document(); |
| 1673 | 1677 |
| 1674 return AccessibilityObjectToWebAccessibilityObject( | 1678 return AccessibilityObjectToWebAccessibilityObject( |
| 1675 document->axObjectCache()->getOrCreate(document->renderer())); | 1679 document->axObjectCache()->getOrCreate(document->renderer())); |
| 1676 } | 1680 } |
| 1677 | 1681 |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1744 | 1748 |
| 1745 bool WebViewImpl::setDropEffect(bool accept) { | 1749 bool WebViewImpl::setDropEffect(bool accept) { |
| 1746 if (drag_target_dispatch_) { | 1750 if (drag_target_dispatch_) { |
| 1747 drop_effect_ = accept ? DROP_EFFECT_COPY : DROP_EFFECT_NONE; | 1751 drop_effect_ = accept ? DROP_EFFECT_COPY : DROP_EFFECT_NONE; |
| 1748 return true; | 1752 return true; |
| 1749 } else { | 1753 } else { |
| 1750 return false; | 1754 return false; |
| 1751 } | 1755 } |
| 1752 } | 1756 } |
| 1753 | 1757 |
| 1754 WebDevToolsAgent* WebViewImpl::GetWebDevToolsAgent() { | |
| 1755 return GetWebDevToolsAgentImpl(); | |
| 1756 } | |
| 1757 | |
| 1758 WebDevToolsAgentImpl* WebViewImpl::GetWebDevToolsAgentImpl() { | 1758 WebDevToolsAgentImpl* WebViewImpl::GetWebDevToolsAgentImpl() { |
| 1759 return devtools_agent_.get(); | 1759 return devtools_agent_.get(); |
| 1760 } | 1760 } |
| 1761 | 1761 |
| 1762 void WebViewImpl::setIsTransparent(bool is_transparent) { | 1762 void WebViewImpl::setIsTransparent(bool is_transparent) { |
| 1763 // Set any existing frames to be transparent. | 1763 // Set any existing frames to be transparent. |
| 1764 WebCore::Frame* frame = page_->mainFrame(); | 1764 WebCore::Frame* frame = page_->mainFrame(); |
| 1765 while (frame) { | 1765 while (frame) { |
| 1766 frame->view()->setTransparent(is_transparent); | 1766 frame->view()->setTransparent(is_transparent); |
| 1767 frame = frame->tree()->traverseNext(); | 1767 frame = frame->tree()->traverseNext(); |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1862 | 1862 |
| 1863 void WebViewImpl::AutoCompletePopupDidHide() { | 1863 void WebViewImpl::AutoCompletePopupDidHide() { |
| 1864 autocomplete_popup_showing_ = false; | 1864 autocomplete_popup_showing_ = false; |
| 1865 } | 1865 } |
| 1866 | 1866 |
| 1867 void WebViewImpl::SetIgnoreInputEvents(bool new_value) { | 1867 void WebViewImpl::SetIgnoreInputEvents(bool new_value) { |
| 1868 DCHECK(ignore_input_events_ != new_value); | 1868 DCHECK(ignore_input_events_ != new_value); |
| 1869 ignore_input_events_ = new_value; | 1869 ignore_input_events_ = new_value; |
| 1870 } | 1870 } |
| 1871 | 1871 |
| 1872 WebCore::Node* WebViewImpl::GetNodeForWindowPos(int x, int y) { | |
| 1873 HitTestResult result = HitTestResultForWindowPos(IntPoint(x, y)); | |
| 1874 return result.innerNonSharedNode(); | |
| 1875 } | |
| 1876 | |
| 1877 #if ENABLE(NOTIFICATIONS) | 1872 #if ENABLE(NOTIFICATIONS) |
| 1878 WebKit::NotificationPresenterImpl* WebViewImpl::GetNotificationPresenter() { | 1873 WebKit::NotificationPresenterImpl* WebViewImpl::GetNotificationPresenter() { |
| 1879 if (!notification_presenter_.isInitialized() && client()) | 1874 if (!notification_presenter_.isInitialized() && client()) |
| 1880 notification_presenter_.initialize(client()->notificationPresenter()); | 1875 notification_presenter_.initialize(client()->notificationPresenter()); |
| 1881 return ¬ification_presenter_; | 1876 return ¬ification_presenter_; |
| 1882 } | 1877 } |
| 1883 #endif | 1878 #endif |
| 1884 | 1879 |
| 1885 void WebViewImpl::RefreshAutofillPopup() { | 1880 void WebViewImpl::RefreshAutofillPopup() { |
| 1886 DCHECK(autocomplete_popup_showing_); | 1881 DCHECK(autocomplete_popup_showing_); |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1922 hitTestResultAtPoint(doc_point, false); | 1917 hitTestResultAtPoint(doc_point, false); |
| 1923 } | 1918 } |
| 1924 | 1919 |
| 1925 void WebViewImpl::setTabsToLinks(bool enable) { | 1920 void WebViewImpl::setTabsToLinks(bool enable) { |
| 1926 tabs_to_links_ = enable; | 1921 tabs_to_links_ = enable; |
| 1927 } | 1922 } |
| 1928 | 1923 |
| 1929 bool WebViewImpl::tabsToLinks() const { | 1924 bool WebViewImpl::tabsToLinks() const { |
| 1930 return tabs_to_links_; | 1925 return tabs_to_links_; |
| 1931 } | 1926 } |
| OLD | NEW |