OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 #include "third_party/WebKit/Source/WebKit/chromium/public/WebScreenInfo.h" | 46 #include "third_party/WebKit/Source/WebKit/chromium/public/WebScreenInfo.h" |
47 #include "third_party/WebKit/Source/WebKit/chromium/public/WebSpeechInputControl
ler.h" | 47 #include "third_party/WebKit/Source/WebKit/chromium/public/WebSpeechInputControl
ler.h" |
48 #include "third_party/WebKit/Source/WebKit/chromium/public/WebSpeechInputControl
lerMock.h" | 48 #include "third_party/WebKit/Source/WebKit/chromium/public/WebSpeechInputControl
lerMock.h" |
49 #include "third_party/WebKit/Source/WebKit/chromium/public/WebSpeechInputListene
r.h" | 49 #include "third_party/WebKit/Source/WebKit/chromium/public/WebSpeechInputListene
r.h" |
50 #include "third_party/WebKit/Source/WebKit/chromium/public/WebStorageNamespace.h
" | 50 #include "third_party/WebKit/Source/WebKit/chromium/public/WebStorageNamespace.h
" |
51 #include "third_party/WebKit/Source/WebKit/chromium/public/WebString.h" | 51 #include "third_party/WebKit/Source/WebKit/chromium/public/WebString.h" |
52 #include "third_party/WebKit/Source/WebKit/chromium/public/WebURL.h" | 52 #include "third_party/WebKit/Source/WebKit/chromium/public/WebURL.h" |
53 #include "third_party/WebKit/Source/WebKit/chromium/public/WebURLError.h" | 53 #include "third_party/WebKit/Source/WebKit/chromium/public/WebURLError.h" |
54 #include "third_party/WebKit/Source/WebKit/chromium/public/WebURLRequest.h" | 54 #include "third_party/WebKit/Source/WebKit/chromium/public/WebURLRequest.h" |
55 #include "third_party/WebKit/Source/WebKit/chromium/public/WebURLResponse.h" | 55 #include "third_party/WebKit/Source/WebKit/chromium/public/WebURLResponse.h" |
| 56 #include "third_party/WebKit/Source/WebKit/chromium/public/WebVector.h" |
56 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" | 57 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" |
57 #include "third_party/WebKit/Source/WebKit/chromium/public/WebWindowFeatures.h" | 58 #include "third_party/WebKit/Source/WebKit/chromium/public/WebWindowFeatures.h" |
58 #include "ui/gfx/native_widget_types.h" | 59 #include "ui/gfx/native_widget_types.h" |
59 #include "ui/gfx/point.h" | 60 #include "ui/gfx/point.h" |
60 #include "webkit/appcache/web_application_cache_host_impl.h" | 61 #include "webkit/appcache/web_application_cache_host_impl.h" |
61 #include "webkit/glue/glue_serialize.h" | 62 #include "webkit/glue/glue_serialize.h" |
62 #include "webkit/glue/media/video_renderer_impl.h" | 63 #include "webkit/glue/media/video_renderer_impl.h" |
63 #include "webkit/glue/webdropdata.h" | 64 #include "webkit/glue/webdropdata.h" |
64 #include "webkit/glue/webkit_glue.h" | 65 #include "webkit/glue/webkit_glue.h" |
65 #include "webkit/glue/webmediaplayer_impl.h" | 66 #include "webkit/glue/webmediaplayer_impl.h" |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 using WebKit::WebTextAffinity; | 121 using WebKit::WebTextAffinity; |
121 using WebKit::WebTextDirection; | 122 using WebKit::WebTextDirection; |
122 using WebKit::WebURL; | 123 using WebKit::WebURL; |
123 using WebKit::WebURLError; | 124 using WebKit::WebURLError; |
124 using WebKit::WebURLRequest; | 125 using WebKit::WebURLRequest; |
125 using WebKit::WebURLResponse; | 126 using WebKit::WebURLResponse; |
126 using WebKit::WebWidget; | 127 using WebKit::WebWidget; |
127 using WebKit::WebWindowFeatures; | 128 using WebKit::WebWindowFeatures; |
128 using WebKit::WebWorker; | 129 using WebKit::WebWorker; |
129 using WebKit::WebWorkerClient; | 130 using WebKit::WebWorkerClient; |
| 131 using WebKit::WebVector; |
130 using WebKit::WebView; | 132 using WebKit::WebView; |
131 | 133 |
132 namespace { | 134 namespace { |
133 | 135 |
134 // WebNavigationType debugging strings taken from PolicyDelegate.mm. | 136 // WebNavigationType debugging strings taken from PolicyDelegate.mm. |
135 const char* kLinkClickedString = "link clicked"; | 137 const char* kLinkClickedString = "link clicked"; |
136 const char* kFormSubmittedString = "form submitted"; | 138 const char* kFormSubmittedString = "form submitted"; |
137 const char* kBackForwardString = "back/forward"; | 139 const char* kBackForwardString = "back/forward"; |
138 const char* kReloadString = "reload"; | 140 const char* kReloadString = "reload"; |
139 const char* kFormResubmittedString = "form resubmitted"; | 141 const char* kFormResubmittedString = "form resubmitted"; |
(...skipping 454 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
594 const WebPluginParams& params) { | 596 const WebPluginParams& params) { |
595 bool allow_wildcard = true; | 597 bool allow_wildcard = true; |
596 std::vector<webkit::WebPluginInfo> plugins; | 598 std::vector<webkit::WebPluginInfo> plugins; |
597 std::vector<std::string> mime_types; | 599 std::vector<std::string> mime_types; |
598 webkit::npapi::PluginList::Singleton()->GetPluginInfoArray( | 600 webkit::npapi::PluginList::Singleton()->GetPluginInfoArray( |
599 params.url, params.mimeType.utf8(), allow_wildcard, | 601 params.url, params.mimeType.utf8(), allow_wildcard, |
600 NULL, &plugins, &mime_types); | 602 NULL, &plugins, &mime_types); |
601 if (plugins.empty()) | 603 if (plugins.empty()) |
602 return NULL; | 604 return NULL; |
603 | 605 |
| 606 #if defined(OS_MACOSX) |
| 607 if (!shell_->layout_test_mode()) { |
| 608 bool flash = LowerCaseEqualsASCII(params.mimeType.utf8(), |
| 609 "application/x-shockwave-flash"); |
| 610 if (flash) { |
| 611 // Mac does not support windowed plugins. Force Flash plugins to use |
| 612 // windowless mode by setting the wmode="opaque" attribute. |
| 613 DCHECK(params.attributeNames.size() == params.attributeValues.size()); |
| 614 size_t size = params.attributeNames.size(); |
| 615 |
| 616 WebVector<WebString> new_names(size+1), new_values(size+1); |
| 617 |
| 618 for (size_t i = 0; i < size; ++i) { |
| 619 new_names[i] = params.attributeNames[i]; |
| 620 new_values[i] = params.attributeValues[i]; |
| 621 } |
| 622 |
| 623 new_names[size] = "wmode"; |
| 624 new_values[size] = "opaque"; |
| 625 |
| 626 WebPluginParams new_params = params; |
| 627 new_params.attributeNames.swap(new_names); |
| 628 new_params.attributeValues.swap(new_values); |
| 629 |
| 630 return new webkit::npapi::WebPluginImpl( |
| 631 frame, new_params, plugins.front().path, mime_types.front(), |
| 632 AsWeakPtr()); |
| 633 } |
| 634 } |
| 635 #endif // defined (OS_MACOSX) |
| 636 |
604 return new webkit::npapi::WebPluginImpl( | 637 return new webkit::npapi::WebPluginImpl( |
605 frame, params, plugins.front().path, mime_types.front(), AsWeakPtr()); | 638 frame, params, plugins.front().path, mime_types.front(), AsWeakPtr()); |
606 } | 639 } |
607 | 640 |
608 WebWorker* TestWebViewDelegate::createWorker(WebFrame* frame, | 641 WebWorker* TestWebViewDelegate::createWorker(WebFrame* frame, |
609 WebWorkerClient* client) { | 642 WebWorkerClient* client) { |
610 return new TestWebWorker(); | 643 return new TestWebWorker(); |
611 } | 644 } |
612 | 645 |
613 WebMediaPlayer* TestWebViewDelegate::createMediaPlayer( | 646 WebMediaPlayer* TestWebViewDelegate::createMediaPlayer( |
(...skipping 511 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1125 } | 1158 } |
1126 | 1159 |
1127 void TestWebViewDelegate::set_fake_window_rect(const WebRect& rect) { | 1160 void TestWebViewDelegate::set_fake_window_rect(const WebRect& rect) { |
1128 fake_rect_ = rect; | 1161 fake_rect_ = rect; |
1129 using_fake_rect_ = true; | 1162 using_fake_rect_ = true; |
1130 } | 1163 } |
1131 | 1164 |
1132 WebRect TestWebViewDelegate::fake_window_rect() { | 1165 WebRect TestWebViewDelegate::fake_window_rect() { |
1133 return fake_rect_; | 1166 return fake_rect_; |
1134 } | 1167 } |
OLD | NEW |