| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 // This file contains the implementation of TestWebViewDelegate, which serves | 5 // This file contains the implementation of TestWebViewDelegate, which serves |
| 6 // as the WebViewDelegate for the TestShellWebHost. The host is expected to | 6 // as the WebViewDelegate for the TestShellWebHost. The host is expected to |
| 7 // have initialized a MessageLoop before these methods are called. | 7 // have initialized a MessageLoop before these methods are called. |
| 8 | 8 |
| 9 #include "webkit/tools/test_shell/test_webview_delegate.h" | 9 #include "webkit/tools/test_shell/test_webview_delegate.h" |
| 10 | 10 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 #include "third_party/WebKit/WebKit/chromium/public/WebPopupMenu.h" | 34 #include "third_party/WebKit/WebKit/chromium/public/WebPopupMenu.h" |
| 35 #include "third_party/WebKit/WebKit/chromium/public/WebRange.h" | 35 #include "third_party/WebKit/WebKit/chromium/public/WebRange.h" |
| 36 #include "third_party/WebKit/WebKit/chromium/public/WebScreenInfo.h" | 36 #include "third_party/WebKit/WebKit/chromium/public/WebScreenInfo.h" |
| 37 #include "third_party/WebKit/WebKit/chromium/public/WebStorageNamespace.h" | 37 #include "third_party/WebKit/WebKit/chromium/public/WebStorageNamespace.h" |
| 38 #include "third_party/WebKit/WebKit/chromium/public/WebString.h" | 38 #include "third_party/WebKit/WebKit/chromium/public/WebString.h" |
| 39 #include "third_party/WebKit/WebKit/chromium/public/WebURL.h" | 39 #include "third_party/WebKit/WebKit/chromium/public/WebURL.h" |
| 40 #include "third_party/WebKit/WebKit/chromium/public/WebURLError.h" | 40 #include "third_party/WebKit/WebKit/chromium/public/WebURLError.h" |
| 41 #include "third_party/WebKit/WebKit/chromium/public/WebURLRequest.h" | 41 #include "third_party/WebKit/WebKit/chromium/public/WebURLRequest.h" |
| 42 #include "third_party/WebKit/WebKit/chromium/public/WebURLResponse.h" | 42 #include "third_party/WebKit/WebKit/chromium/public/WebURLResponse.h" |
| 43 #include "third_party/WebKit/WebKit/chromium/public/WebView.h" | 43 #include "third_party/WebKit/WebKit/chromium/public/WebView.h" |
| 44 #include "third_party/WebKit/WebKit/chromium/public/WebWindowFeatures.h" |
| 44 #include "webkit/appcache/web_application_cache_host_impl.h" | 45 #include "webkit/appcache/web_application_cache_host_impl.h" |
| 45 #include "webkit/glue/glue_serialize.h" | 46 #include "webkit/glue/glue_serialize.h" |
| 46 #include "webkit/glue/plugins/webplugin_impl.h" | 47 #include "webkit/glue/plugins/webplugin_impl.h" |
| 47 #include "webkit/glue/plugins/plugin_list.h" | 48 #include "webkit/glue/plugins/plugin_list.h" |
| 48 #include "webkit/glue/plugins/webplugin_delegate_impl.h" | 49 #include "webkit/glue/plugins/webplugin_delegate_impl.h" |
| 49 #include "webkit/glue/webdropdata.h" | 50 #include "webkit/glue/webdropdata.h" |
| 50 #include "webkit/glue/webpreferences.h" | 51 #include "webkit/glue/webpreferences.h" |
| 51 #include "webkit/glue/webkit_glue.h" | 52 #include "webkit/glue/webkit_glue.h" |
| 52 #include "webkit/glue/window_open_disposition.h" | 53 #include "webkit/glue/window_open_disposition.h" |
| 53 #include "webkit/support/webkit_support.h" | 54 #include "webkit/support/webkit_support.h" |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 using WebKit::WebSize; | 100 using WebKit::WebSize; |
| 100 using WebKit::WebStorageNamespace; | 101 using WebKit::WebStorageNamespace; |
| 101 using WebKit::WebString; | 102 using WebKit::WebString; |
| 102 using WebKit::WebTextAffinity; | 103 using WebKit::WebTextAffinity; |
| 103 using WebKit::WebTextDirection; | 104 using WebKit::WebTextDirection; |
| 104 using WebKit::WebURL; | 105 using WebKit::WebURL; |
| 105 using WebKit::WebURLError; | 106 using WebKit::WebURLError; |
| 106 using WebKit::WebURLRequest; | 107 using WebKit::WebURLRequest; |
| 107 using WebKit::WebURLResponse; | 108 using WebKit::WebURLResponse; |
| 108 using WebKit::WebWidget; | 109 using WebKit::WebWidget; |
| 110 using WebKit::WebWindowFeatures; |
| 109 using WebKit::WebWorker; | 111 using WebKit::WebWorker; |
| 110 using WebKit::WebWorkerClient; | 112 using WebKit::WebWorkerClient; |
| 111 using WebKit::WebView; | 113 using WebKit::WebView; |
| 112 | 114 |
| 113 namespace { | 115 namespace { |
| 114 | 116 |
| 115 // WebNavigationType debugging strings taken from PolicyDelegate.mm. | 117 // WebNavigationType debugging strings taken from PolicyDelegate.mm. |
| 116 const char* kLinkClickedString = "link clicked"; | 118 const char* kLinkClickedString = "link clicked"; |
| 117 const char* kFormSubmittedString = "form submitted"; | 119 const char* kFormSubmittedString = "form submitted"; |
| 118 const char* kBackForwardString = "back/forward"; | 120 const char* kBackForwardString = "back/forward"; |
| (...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 302 } | 304 } |
| 303 | 305 |
| 304 void TestWebViewDelegate::SetAuthorAndUserStylesEnabled(bool is_enabled) { | 306 void TestWebViewDelegate::SetAuthorAndUserStylesEnabled(bool is_enabled) { |
| 305 WebPreferences* prefs = shell_->GetWebPreferences(); | 307 WebPreferences* prefs = shell_->GetWebPreferences(); |
| 306 prefs->author_and_user_styles_enabled = is_enabled; | 308 prefs->author_and_user_styles_enabled = is_enabled; |
| 307 prefs->Apply(shell_->webView()); | 309 prefs->Apply(shell_->webView()); |
| 308 } | 310 } |
| 309 | 311 |
| 310 // WebViewClient ------------------------------------------------------------- | 312 // WebViewClient ------------------------------------------------------------- |
| 311 | 313 |
| 314 // TODO(rafaelw): remove when |
| 315 // WebViewClient::createView(WebFrame,WebWindowFeatures) lands. |
| 312 WebView* TestWebViewDelegate::createView(WebFrame* creator) { | 316 WebView* TestWebViewDelegate::createView(WebFrame* creator) { |
| 317 return createView(creator, WebWindowFeatures()); |
| 318 } |
| 319 |
| 320 WebView* TestWebViewDelegate::createView( |
| 321 WebFrame* creator, |
| 322 const WebWindowFeatures& window_features) { |
| 313 return shell_->CreateWebView(); | 323 return shell_->CreateWebView(); |
| 314 } | 324 } |
| 315 | 325 |
| 316 WebWidget* TestWebViewDelegate::createPopupMenu(WebPopupType popup_type) { | 326 WebWidget* TestWebViewDelegate::createPopupMenu(WebPopupType popup_type) { |
| 317 // TODO(darin): Should we take into account |popup_type| (for activation | 327 // TODO(darin): Should we take into account |popup_type| (for activation |
| 318 // purpose)? | 328 // purpose)? |
| 319 return shell_->CreatePopupWidget(); | 329 return shell_->CreatePopupWidget(); |
| 320 } | 330 } |
| 321 | 331 |
| 322 WebStorageNamespace* TestWebViewDelegate::createSessionStorageNamespace() { | 332 WebStorageNamespace* TestWebViewDelegate::createSessionStorageNamespace() { |
| (...skipping 903 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1226 } | 1236 } |
| 1227 | 1237 |
| 1228 void TestWebViewDelegate::set_fake_window_rect(const WebRect& rect) { | 1238 void TestWebViewDelegate::set_fake_window_rect(const WebRect& rect) { |
| 1229 fake_rect_ = rect; | 1239 fake_rect_ = rect; |
| 1230 using_fake_rect_ = true; | 1240 using_fake_rect_ = true; |
| 1231 } | 1241 } |
| 1232 | 1242 |
| 1233 WebRect TestWebViewDelegate::fake_window_rect() { | 1243 WebRect TestWebViewDelegate::fake_window_rect() { |
| 1234 return fake_rect_; | 1244 return fake_rect_; |
| 1235 } | 1245 } |
| OLD | NEW |