| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 #ifndef CONTENT_SHELL_RENDERER_TEST_RUNNER_WEBFRAMETESTPROXY_H_ | 5 #ifndef CONTENT_SHELL_RENDERER_TEST_RUNNER_WEBFRAMETESTPROXY_H_ |
| 6 #define CONTENT_SHELL_RENDERER_TEST_RUNNER_WEBFRAMETESTPROXY_H_ | 6 #define CONTENT_SHELL_RENDERER_TEST_RUNNER_WEBFRAMETESTPROXY_H_ |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "content/shell/renderer/test_runner/WebTestProxy.h" | 9 #include "content/shell/renderer/test_runner/WebTestProxy.h" |
| 10 #include "third_party/WebKit/public/platform/WebString.h" | 10 #include "third_party/WebKit/public/platform/WebString.h" |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 void setBaseProxy(WebTestProxyBase* proxy) | 26 void setBaseProxy(WebTestProxyBase* proxy) |
| 27 { | 27 { |
| 28 m_baseProxy = proxy; | 28 m_baseProxy = proxy; |
| 29 } | 29 } |
| 30 | 30 |
| 31 void setVersion(int version) | 31 void setVersion(int version) |
| 32 { | 32 { |
| 33 m_version = version; | 33 m_version = version; |
| 34 } | 34 } |
| 35 | 35 |
| 36 blink::WebPlugin* createPlugin(blink::WebFrame* frame, const blink::WebPlugi
nParams& params) | 36 blink::WebPlugin* createPlugin(blink::WebLocalFrame* frame, const blink::Web
PluginParams& params) |
| 37 { | 37 { |
| 38 blink::WebPlugin* plugin = m_baseProxy->createPlugin(frame, params); | 38 blink::WebPlugin* plugin = m_baseProxy->createPlugin(frame, params); |
| 39 if (plugin) | 39 if (plugin) |
| 40 return plugin; | 40 return plugin; |
| 41 return Base::createPlugin(frame, params); | 41 return Base::createPlugin(frame, params); |
| 42 } | 42 } |
| 43 | 43 |
| 44 // WebFrameClient implementation. | 44 // WebFrameClient implementation. |
| 45 virtual void didAddMessageToConsole(const blink::WebConsoleMessage& message,
const blink::WebString& sourceName, unsigned sourceLine, const blink::WebString
& stackTrace) | 45 virtual void didAddMessageToConsole(const blink::WebConsoleMessage& message,
const blink::WebString& sourceName, unsigned sourceLine, const blink::WebString
& stackTrace) |
| 46 { | 46 { |
| 47 m_baseProxy->didAddMessageToConsole(message, sourceName, sourceLine); | 47 m_baseProxy->didAddMessageToConsole(message, sourceName, sourceLine); |
| 48 Base::didAddMessageToConsole(message, sourceName, sourceLine, stackTrace
); | 48 Base::didAddMessageToConsole(message, sourceName, sourceLine, stackTrace
); |
| 49 } | 49 } |
| 50 virtual bool canCreatePluginWithoutRenderer(const blink::WebString& mimeType
) | 50 virtual bool canCreatePluginWithoutRenderer(const blink::WebString& mimeType
) |
| 51 { | 51 { |
| 52 using blink::WebString; | 52 using blink::WebString; |
| 53 | 53 |
| 54 const CR_DEFINE_STATIC_LOCAL(WebString, suffix, ("-can-create-without-re
nderer")); | 54 const CR_DEFINE_STATIC_LOCAL(WebString, suffix, ("-can-create-without-re
nderer")); |
| 55 return mimeType.utf8().find(suffix.utf8()) != std::string::npos; | 55 return mimeType.utf8().find(suffix.utf8()) != std::string::npos; |
| 56 } | 56 } |
| 57 virtual void didStartProvisionalLoad(blink::WebFrame* frame) | 57 virtual void didStartProvisionalLoad(blink::WebLocalFrame* frame) |
| 58 { | 58 { |
| 59 if (m_version > 2) | 59 if (m_version > 2) |
| 60 m_baseProxy->didStartProvisionalLoad(frame); | 60 m_baseProxy->didStartProvisionalLoad(frame); |
| 61 Base::didStartProvisionalLoad(frame); | 61 Base::didStartProvisionalLoad(frame); |
| 62 } | 62 } |
| 63 virtual void didReceiveServerRedirectForProvisionalLoad(blink::WebFrame* fra
me) | 63 virtual void didReceiveServerRedirectForProvisionalLoad(blink::WebLocalFrame
* frame) |
| 64 { | 64 { |
| 65 m_baseProxy->didReceiveServerRedirectForProvisionalLoad(frame); | 65 m_baseProxy->didReceiveServerRedirectForProvisionalLoad(frame); |
| 66 Base::didReceiveServerRedirectForProvisionalLoad(frame); | 66 Base::didReceiveServerRedirectForProvisionalLoad(frame); |
| 67 } | 67 } |
| 68 virtual void didFailProvisionalLoad(blink::WebFrame* frame, const blink::Web
URLError& error) | 68 virtual void didFailProvisionalLoad(blink::WebLocalFrame* frame, const blink
::WebURLError& error) |
| 69 { | 69 { |
| 70 Base::didFailProvisionalLoad(frame, error); | 70 Base::didFailProvisionalLoad(frame, error); |
| 71 } | 71 } |
| 72 virtual void didCommitProvisionalLoad(blink::WebFrame* frame, bool isNewNavi
gation) | 72 virtual void didCommitProvisionalLoad(blink::WebLocalFrame* frame, bool isNe
wNavigation) |
| 73 { | 73 { |
| 74 Base::didCommitProvisionalLoad(frame, isNewNavigation); | 74 Base::didCommitProvisionalLoad(frame, isNewNavigation); |
| 75 } | 75 } |
| 76 virtual void didReceiveTitle(blink::WebFrame* frame, const blink::WebString&
title, blink::WebTextDirection direction) | 76 virtual void didReceiveTitle(blink::WebLocalFrame* frame, const blink::WebSt
ring& title, blink::WebTextDirection direction) |
| 77 { | 77 { |
| 78 Base::didReceiveTitle(frame, title, direction); | 78 Base::didReceiveTitle(frame, title, direction); |
| 79 } | 79 } |
| 80 virtual void didChangeIcon(blink::WebFrame* frame, blink::WebIconURL::Type i
conType) | 80 virtual void didChangeIcon(blink::WebLocalFrame* frame, blink::WebIconURL::T
ype iconType) |
| 81 { | 81 { |
| 82 Base::didChangeIcon(frame, iconType); | 82 Base::didChangeIcon(frame, iconType); |
| 83 } | 83 } |
| 84 virtual void didFinishDocumentLoad(blink::WebFrame* frame) | 84 virtual void didFinishDocumentLoad(blink::WebLocalFrame* frame) |
| 85 { | 85 { |
| 86 Base::didFinishDocumentLoad(frame); | 86 Base::didFinishDocumentLoad(frame); |
| 87 } | 87 } |
| 88 virtual void didHandleOnloadEvents(blink::WebFrame* frame) | 88 virtual void didHandleOnloadEvents(blink::WebLocalFrame* frame) |
| 89 { | 89 { |
| 90 Base::didHandleOnloadEvents(frame); | 90 Base::didHandleOnloadEvents(frame); |
| 91 } | 91 } |
| 92 virtual void didFailLoad(blink::WebFrame* frame, const blink::WebURLError& e
rror) | 92 virtual void didFailLoad(blink::WebLocalFrame* frame, const blink::WebURLErr
or& error) |
| 93 { | 93 { |
| 94 Base::didFailLoad(frame, error); | 94 Base::didFailLoad(frame, error); |
| 95 } | 95 } |
| 96 virtual void didFinishLoad(blink::WebFrame* frame) | 96 virtual void didFinishLoad(blink::WebLocalFrame* frame) |
| 97 { | 97 { |
| 98 Base::didFinishLoad(frame); | 98 Base::didFinishLoad(frame); |
| 99 } | 99 } |
| 100 virtual void didChangeSelection(bool is_selection_empty) { | 100 virtual void didChangeSelection(bool is_selection_empty) { |
| 101 m_baseProxy->didChangeSelection(is_selection_empty); | 101 m_baseProxy->didChangeSelection(is_selection_empty); |
| 102 Base::didChangeSelection(is_selection_empty); | 102 Base::didChangeSelection(is_selection_empty); |
| 103 } | 103 } |
| 104 virtual void showContextMenu(const blink::WebContextMenuData& contextMenuDat
a) { | 104 virtual void showContextMenu(const blink::WebContextMenuData& contextMenuDat
a) { |
| 105 m_baseProxy->showContextMenu(Base::GetWebFrame(), contextMenuData); | 105 m_baseProxy->showContextMenu(Base::GetWebFrame()->toWebLocalFrame(), con
textMenuData); |
| 106 Base::showContextMenu(contextMenuData); | 106 Base::showContextMenu(contextMenuData); |
| 107 } | 107 } |
| 108 virtual void didDetectXSS(blink::WebFrame* frame, const blink::WebURL& insec
ureURL, bool didBlockEntirePage) | 108 virtual void didDetectXSS(blink::WebLocalFrame* frame, const blink::WebURL&
insecureURL, bool didBlockEntirePage) |
| 109 { | 109 { |
| 110 // This is not implemented in RenderFrameImpl, so need to explicitly cal
l | 110 // This is not implemented in RenderFrameImpl, so need to explicitly cal
l |
| 111 // into the base proxy. | 111 // into the base proxy. |
| 112 m_baseProxy->didDetectXSS(frame, insecureURL, didBlockEntirePage); | 112 m_baseProxy->didDetectXSS(frame, insecureURL, didBlockEntirePage); |
| 113 Base::didDetectXSS(frame, insecureURL, didBlockEntirePage); | 113 Base::didDetectXSS(frame, insecureURL, didBlockEntirePage); |
| 114 } | 114 } |
| 115 virtual void didDispatchPingLoader(blink::WebFrame* frame, const blink::WebU
RL& url) | 115 virtual void didDispatchPingLoader(blink::WebLocalFrame* frame, const blink:
:WebURL& url) |
| 116 { | 116 { |
| 117 // This is not implemented in RenderFrameImpl, so need to explicitly cal
l | 117 // This is not implemented in RenderFrameImpl, so need to explicitly cal
l |
| 118 // into the base proxy. | 118 // into the base proxy. |
| 119 m_baseProxy->didDispatchPingLoader(frame, url); | 119 m_baseProxy->didDispatchPingLoader(frame, url); |
| 120 Base::didDispatchPingLoader(frame, url); | 120 Base::didDispatchPingLoader(frame, url); |
| 121 } | 121 } |
| 122 virtual void willRequestResource(blink::WebFrame* frame, const blink::WebCac
hedURLRequest& request) | 122 virtual void willRequestResource(blink::WebLocalFrame* frame, const blink::W
ebCachedURLRequest& request) |
| 123 { | 123 { |
| 124 // This is not implemented in RenderFrameImpl, so need to explicitly cal
l | 124 // This is not implemented in RenderFrameImpl, so need to explicitly cal
l |
| 125 // into the base proxy. | 125 // into the base proxy. |
| 126 m_baseProxy->willRequestResource(frame, request); | 126 m_baseProxy->willRequestResource(frame, request); |
| 127 Base::willRequestResource(frame, request); | 127 Base::willRequestResource(frame, request); |
| 128 } | 128 } |
| 129 virtual void didCreateDataSource(blink::WebFrame* frame, blink::WebDataSourc
e* ds) | 129 virtual void didCreateDataSource(blink::WebLocalFrame* frame, blink::WebData
Source* ds) |
| 130 { | 130 { |
| 131 Base::didCreateDataSource(frame, ds); | 131 Base::didCreateDataSource(frame, ds); |
| 132 } | 132 } |
| 133 virtual void willSendRequest(blink::WebFrame* frame, unsigned identifier, bl
ink::WebURLRequest& request, const blink::WebURLResponse& redirectResponse) | 133 virtual void willSendRequest(blink::WebLocalFrame* frame, unsigned identifie
r, blink::WebURLRequest& request, const blink::WebURLResponse& redirectResponse) |
| 134 { | 134 { |
| 135 m_baseProxy->willSendRequest(frame, identifier, request, redirectRespons
e); | 135 m_baseProxy->willSendRequest(frame, identifier, request, redirectRespons
e); |
| 136 Base::willSendRequest(frame, identifier, request, redirectResponse); | 136 Base::willSendRequest(frame, identifier, request, redirectResponse); |
| 137 } | 137 } |
| 138 virtual void didReceiveResponse(blink::WebFrame* frame, unsigned identifier,
const blink::WebURLResponse& response) | 138 virtual void didReceiveResponse(blink::WebLocalFrame* frame, unsigned identi
fier, const blink::WebURLResponse& response) |
| 139 { | 139 { |
| 140 m_baseProxy->didReceiveResponse(frame, identifier, response); | 140 m_baseProxy->didReceiveResponse(frame, identifier, response); |
| 141 Base::didReceiveResponse(frame, identifier, response); | 141 Base::didReceiveResponse(frame, identifier, response); |
| 142 } | 142 } |
| 143 virtual void didChangeResourcePriority(blink::WebFrame* frame, unsigned iden
tifier, const blink::WebURLRequest::Priority& priority) | 143 virtual void didChangeResourcePriority(blink::WebLocalFrame* frame, unsigned
identifier, const blink::WebURLRequest::Priority& priority) |
| 144 { | 144 { |
| 145 // This is not implemented in RenderFrameImpl, so need to explicitly cal
l | 145 // This is not implemented in RenderFrameImpl, so need to explicitly cal
l |
| 146 // into the base proxy. | 146 // into the base proxy. |
| 147 m_baseProxy->didChangeResourcePriority(frame, identifier, priority); | 147 m_baseProxy->didChangeResourcePriority(frame, identifier, priority); |
| 148 Base::didChangeResourcePriority(frame, identifier, priority); | 148 Base::didChangeResourcePriority(frame, identifier, priority); |
| 149 } | 149 } |
| 150 virtual void didFinishResourceLoad(blink::WebFrame* frame, unsigned identifi
er) | 150 virtual void didFinishResourceLoad(blink::WebLocalFrame* frame, unsigned ide
ntifier) |
| 151 { | 151 { |
| 152 Base::didFinishResourceLoad(frame, identifier); | 152 Base::didFinishResourceLoad(frame, identifier); |
| 153 } | 153 } |
| 154 virtual blink::WebNavigationPolicy decidePolicyForNavigation(blink::WebFrame
* frame, blink::WebDataSource::ExtraData* extraData, const blink::WebURLRequest&
request, blink::WebNavigationType type, blink::WebNavigationPolicy defaultPolic
y, bool isRedirect) | 154 virtual blink::WebNavigationPolicy decidePolicyForNavigation(blink::WebLocal
Frame* frame, blink::WebDataSource::ExtraData* extraData, const blink::WebURLReq
uest& request, blink::WebNavigationType type, blink::WebNavigationPolicy default
Policy, bool isRedirect) |
| 155 { | 155 { |
| 156 blink::WebNavigationPolicy policy = m_baseProxy->decidePolicyForNavigati
on(frame, extraData, request, type, defaultPolicy, isRedirect); | 156 blink::WebNavigationPolicy policy = m_baseProxy->decidePolicyForNavigati
on(frame, extraData, request, type, defaultPolicy, isRedirect); |
| 157 if (policy == blink::WebNavigationPolicyIgnore) | 157 if (policy == blink::WebNavigationPolicyIgnore) |
| 158 return policy; | 158 return policy; |
| 159 | 159 |
| 160 return Base::decidePolicyForNavigation(frame, extraData, request, type,
defaultPolicy, isRedirect); | 160 return Base::decidePolicyForNavigation(frame, extraData, request, type,
defaultPolicy, isRedirect); |
| 161 } | 161 } |
| 162 virtual bool willCheckAndDispatchMessageEvent(blink::WebFrame* sourceFrame,
blink::WebFrame* targetFrame, blink::WebSecurityOrigin target, blink::WebDOMMess
ageEvent event) | 162 virtual bool willCheckAndDispatchMessageEvent(blink::WebLocalFrame* sourceFr
ame, blink::WebFrame* targetFrame, blink::WebSecurityOrigin target, blink::WebDO
MMessageEvent event) |
| 163 { | 163 { |
| 164 if (m_baseProxy->willCheckAndDispatchMessageEvent(sourceFrame, targetFra
me, target, event)) | 164 if (m_baseProxy->willCheckAndDispatchMessageEvent(sourceFrame, targetFra
me, target, event)) |
| 165 return true; | 165 return true; |
| 166 return Base::willCheckAndDispatchMessageEvent(sourceFrame, targetFrame,
target, event); | 166 return Base::willCheckAndDispatchMessageEvent(sourceFrame, targetFrame,
target, event); |
| 167 } | 167 } |
| 168 virtual void didStopLoading() | 168 virtual void didStopLoading() |
| 169 { | 169 { |
| 170 m_baseProxy->didStopLoading(); | 170 m_baseProxy->didStopLoading(); |
| 171 Base::didStopLoading(); | 171 Base::didStopLoading(); |
| 172 } | 172 } |
| 173 | 173 |
| 174 private: | 174 private: |
| 175 WebTestProxyBase* m_baseProxy; | 175 WebTestProxyBase* m_baseProxy; |
| 176 | 176 |
| 177 // This is used to incrementally change code between Blink and Chromium. | 177 // This is used to incrementally change code between Blink and Chromium. |
| 178 // It is used instead of a #define and is set by layouttest_support when | 178 // It is used instead of a #define and is set by layouttest_support when |
| 179 // creating this object. | 179 // creating this object. |
| 180 int m_version; | 180 int m_version; |
| 181 | 181 |
| 182 DISALLOW_COPY_AND_ASSIGN(WebFrameTestProxy); | 182 DISALLOW_COPY_AND_ASSIGN(WebFrameTestProxy); |
| 183 }; | 183 }; |
| 184 | 184 |
| 185 } | 185 } |
| 186 | 186 |
| 187 #endif // WebTestProxy_h | 187 #endif // WebTestProxy_h |
| OLD | NEW |