OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2009 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 #include "PluginInfoStore.h" | 70 #include "PluginInfoStore.h" |
71 #include "PopupMenuChromium.h" | 71 #include "PopupMenuChromium.h" |
72 #include "PopupMenuClient.h" | 72 #include "PopupMenuClient.h" |
73 #include "RenderView.h" | 73 #include "RenderView.h" |
74 #include "ResourceHandle.h" | 74 #include "ResourceHandle.h" |
75 #include "SecurityOrigin.h" | 75 #include "SecurityOrigin.h" |
76 #include "SelectionController.h" | 76 #include "SelectionController.h" |
77 #include "Settings.h" | 77 #include "Settings.h" |
78 #include "TypingCommand.h" | 78 #include "TypingCommand.h" |
79 #include "WebAccessibilityObject.h" | 79 #include "WebAccessibilityObject.h" |
| 80 #include "WebDevToolsAgentPrivate.h" |
80 #include "WebDragData.h" | 81 #include "WebDragData.h" |
81 #include "WebFrameImpl.h" | 82 #include "WebFrameImpl.h" |
82 #include "WebInputEvent.h" | 83 #include "WebInputEvent.h" |
83 #include "WebInputEventConversion.h" | 84 #include "WebInputEventConversion.h" |
84 #include "WebMediaPlayerAction.h" | 85 #include "WebMediaPlayerAction.h" |
85 #include "WebNode.h" | 86 #include "WebNode.h" |
86 #include "WebPoint.h" | 87 #include "WebPoint.h" |
87 #include "WebPopupMenuImpl.h" | 88 #include "WebPopupMenuImpl.h" |
88 #include "WebRect.h" | 89 #include "WebRect.h" |
89 #include "WebSettingsImpl.h" | 90 #include "WebSettingsImpl.h" |
90 #include "WebString.h" | 91 #include "WebString.h" |
91 #include "WebVector.h" | 92 #include "WebVector.h" |
92 #include "WebViewClient.h" | 93 #include "WebViewClient.h" |
93 | 94 |
94 #if PLATFORM(WIN_OS) | 95 #if PLATFORM(WIN_OS) |
95 #include "KeyboardCodesWin.h" | 96 #include "KeyboardCodesWin.h" |
96 #include "RenderThemeChromiumWin.h" | 97 #include "RenderThemeChromiumWin.h" |
97 #else | 98 #else |
98 #include "KeyboardCodesPosix.h" | 99 #include "KeyboardCodesPosix.h" |
99 #include "RenderTheme.h" | 100 #include "RenderTheme.h" |
100 #endif | 101 #endif |
101 | 102 |
102 // FIXME | |
103 #include "webkit/glue/webdevtoolsagent_impl.h" | |
104 | |
105 // Get rid of WTF's pow define so we can use std::pow. | 103 // Get rid of WTF's pow define so we can use std::pow. |
106 #undef pow | 104 #undef pow |
107 #include <cmath> // for std::pow | 105 #include <cmath> // for std::pow |
108 | 106 |
109 using namespace WebCore; | 107 using namespace WebCore; |
110 | 108 |
111 namespace WebKit { | 109 namespace WebKit { |
112 | 110 |
113 // Change the text zoom level by kTextSizeMultiplierRatio each time the user | 111 // Change the text zoom level by kTextSizeMultiplierRatio each time the user |
114 // zooms text in or out (ie., change by 20%). The min and max values limit | 112 // zooms text in or out (ie., change by 20%). The min and max values limit |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 Page::allVisitedStateChanged(PageGroup::pageGroup(pageGroupName)); | 167 Page::allVisitedStateChanged(PageGroup::pageGroup(pageGroupName)); |
170 } | 168 } |
171 | 169 |
172 void WebViewImpl::initializeMainFrame(WebFrameClient* frameClient) { | 170 void WebViewImpl::initializeMainFrame(WebFrameClient* frameClient) { |
173 // NOTE: The WebFrameImpl takes a reference to itself within InitMainFrame | 171 // NOTE: The WebFrameImpl takes a reference to itself within InitMainFrame |
174 // and releases that reference once the corresponding Frame is destroyed. | 172 // and releases that reference once the corresponding Frame is destroyed. |
175 RefPtr<WebFrameImpl> frame = WebFrameImpl::create(frameClient); | 173 RefPtr<WebFrameImpl> frame = WebFrameImpl::create(frameClient); |
176 | 174 |
177 frame->initializeAsMainFrame(this); | 175 frame->initializeAsMainFrame(this); |
178 | 176 |
179 if (m_client) { | |
180 WebDevToolsAgentClient* toolsClient = m_client->devToolsAgentClient(); | |
181 if (toolsClient) | |
182 m_devToolsAgent.set(new WebDevToolsAgentImpl(this, toolsClient)); | |
183 } | |
184 | |
185 // Restrict the access to the local file system | 177 // Restrict the access to the local file system |
186 // (see WebView.mm WebView::_commonInitializationWithFrameName). | 178 // (see WebView.mm WebView::_commonInitializationWithFrameName). |
187 SecurityOrigin::setLocalLoadPolicy(SecurityOrigin::AllowLocalLoadsForLocalOnly); | 179 SecurityOrigin::setLocalLoadPolicy(SecurityOrigin::AllowLocalLoadsForLocalOnly); |
188 } | 180 } |
189 | 181 |
190 WebViewImpl::WebViewImpl(WebViewClient* client) | 182 WebViewImpl::WebViewImpl(WebViewClient* client) |
191 : m_client(client) | 183 : m_client(client) |
192 , m_backForwardListClientImpl(this) | 184 , m_backForwardListClientImpl(this) |
193 , m_chromeClientImpl(this) | 185 , m_chromeClientImpl(this) |
194 , m_contextMenuClientImpl(this) | 186 , m_contextMenuClientImpl(this) |
(...skipping 575 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
770 if (m_page.get()) { | 762 if (m_page.get()) { |
771 // Initiate shutdown for the entire frameset. This will cause a lot of | 763 // Initiate shutdown for the entire frameset. This will cause a lot of |
772 // notifications to be sent. | 764 // notifications to be sent. |
773 if (m_page->mainFrame()) { | 765 if (m_page->mainFrame()) { |
774 mainFrameImpl = WebFrameImpl::fromFrame(m_page->mainFrame()); | 766 mainFrameImpl = WebFrameImpl::fromFrame(m_page->mainFrame()); |
775 m_page->mainFrame()->loader()->frameDetached(); | 767 m_page->mainFrame()->loader()->frameDetached(); |
776 } | 768 } |
777 m_page.clear(); | 769 m_page.clear(); |
778 } | 770 } |
779 | 771 |
780 // Should happen after m_page.reset(). | 772 // Should happen after m_page.clear(). |
781 if (m_devToolsAgent.get()) | 773 if (m_devToolsAgent.get()) |
782 m_devToolsAgent.clear(); | 774 m_devToolsAgent.clear(); |
783 | 775 |
784 // We drop the client after the page has been destroyed to support the | 776 // We drop the client after the page has been destroyed to support the |
785 // WebFrameClient::didDestroyScriptContext method. | 777 // WebFrameClient::didDestroyScriptContext method. |
786 if (mainFrameImpl) | 778 if (mainFrameImpl) |
787 mainFrameImpl->dropClient(); | 779 mainFrameImpl->dropClient(); |
788 | 780 |
789 // Reset the delegate to prevent notifications being sent as we're being | 781 // Reset the delegate to prevent notifications being sent as we're being |
790 // deleted. | 782 // deleted. |
(...skipping 700 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1491 void WebViewImpl::setInspectorSettings(const WebString& settings) | 1483 void WebViewImpl::setInspectorSettings(const WebString& settings) |
1492 { | 1484 { |
1493 m_inspectorSettings = settings; | 1485 m_inspectorSettings = settings; |
1494 } | 1486 } |
1495 | 1487 |
1496 WebDevToolsAgent* WebViewImpl::devToolsAgent() | 1488 WebDevToolsAgent* WebViewImpl::devToolsAgent() |
1497 { | 1489 { |
1498 return m_devToolsAgent.get(); | 1490 return m_devToolsAgent.get(); |
1499 } | 1491 } |
1500 | 1492 |
| 1493 void WebViewImpl::setDevToolsAgent(WebDevToolsAgent* devToolsAgent) |
| 1494 { |
| 1495 ASSERT(!m_devToolsAgent.get()); // May only set once! |
| 1496 m_devToolsAgent.set(static_cast<WebDevToolsAgentPrivate*>(devToolsAgent)); |
| 1497 } |
| 1498 |
1501 WebAccessibilityObject WebViewImpl::accessibilityObject() | 1499 WebAccessibilityObject WebViewImpl::accessibilityObject() |
1502 { | 1500 { |
1503 if (!mainFrameImpl()) | 1501 if (!mainFrameImpl()) |
1504 return WebAccessibilityObject(); | 1502 return WebAccessibilityObject(); |
1505 | 1503 |
1506 Document* document = mainFrameImpl()->frame()->document(); | 1504 Document* document = mainFrameImpl()->frame()->document(); |
1507 return WebAccessibilityObject( | 1505 return WebAccessibilityObject( |
1508 document->axObjectCache()->getOrCreate(document->renderer())); | 1506 document->axObjectCache()->getOrCreate(document->renderer())); |
1509 } | 1507 } |
1510 | 1508 |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1576 // WebView -------------------------------------------------------------------- | 1574 // WebView -------------------------------------------------------------------- |
1577 | 1575 |
1578 bool WebViewImpl::setDropEffect(bool accept) { | 1576 bool WebViewImpl::setDropEffect(bool accept) { |
1579 if (m_dragTargetDispatch) { | 1577 if (m_dragTargetDispatch) { |
1580 m_dropEffect = accept ? DropEffectCopy : DropEffectNone; | 1578 m_dropEffect = accept ? DropEffectCopy : DropEffectNone; |
1581 return true; | 1579 return true; |
1582 } | 1580 } |
1583 return false; | 1581 return false; |
1584 } | 1582 } |
1585 | 1583 |
1586 WebDevToolsAgentImpl* WebViewImpl::devToolsAgentImpl() | |
1587 { | |
1588 return m_devToolsAgent.get(); | |
1589 } | |
1590 | |
1591 void WebViewImpl::setIsTransparent(bool isTransparent) | 1584 void WebViewImpl::setIsTransparent(bool isTransparent) |
1592 { | 1585 { |
1593 // Set any existing frames to be transparent. | 1586 // Set any existing frames to be transparent. |
1594 Frame* frame = m_page->mainFrame(); | 1587 Frame* frame = m_page->mainFrame(); |
1595 while (frame) { | 1588 while (frame) { |
1596 frame->view()->setTransparent(isTransparent); | 1589 frame->view()->setTransparent(isTransparent); |
1597 frame = frame->tree()->traverseNext(); | 1590 frame = frame->tree()->traverseNext(); |
1598 } | 1591 } |
1599 | 1592 |
1600 // Future frames check this to know whether to be transparent. | 1593 // Future frames check this to know whether to be transparent. |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1758 { | 1751 { |
1759 m_tabsToLinks = enable; | 1752 m_tabsToLinks = enable; |
1760 } | 1753 } |
1761 | 1754 |
1762 bool WebViewImpl::tabsToLinks() const | 1755 bool WebViewImpl::tabsToLinks() const |
1763 { | 1756 { |
1764 return m_tabsToLinks; | 1757 return m_tabsToLinks; |
1765 } | 1758 } |
1766 | 1759 |
1767 } // namespace WebKit | 1760 } // namespace WebKit |
OLD | NEW |