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 574 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
585 return host->GetScreenInfo(); | 585 return host->GetScreenInfo(); |
586 | 586 |
587 return WebScreenInfo(); | 587 return WebScreenInfo(); |
588 } | 588 } |
589 | 589 |
590 // WebFrameClient ------------------------------------------------------------ | 590 // WebFrameClient ------------------------------------------------------------ |
591 | 591 |
592 WebPlugin* TestWebViewDelegate::createPlugin(WebFrame* frame, | 592 WebPlugin* TestWebViewDelegate::createPlugin(WebFrame* frame, |
593 const WebPluginParams& params) { | 593 const WebPluginParams& params) { |
594 bool allow_wildcard = true; | 594 bool allow_wildcard = true; |
595 webkit::npapi::WebPluginInfo info; | 595 std::vector<webkit::npapi::WebPluginInfo> plugins; |
596 std::string actual_mime_type; | 596 std::vector<std::string> mime_types; |
597 if (!webkit::npapi::PluginList::Singleton()->GetPluginInfo( | 597 webkit::npapi::PluginList::Singleton()->GetPluginInfoArray( |
598 params.url, params.mimeType.utf8(), allow_wildcard, &info, | 598 params.url, params.mimeType.utf8(), allow_wildcard, |
599 &actual_mime_type) || !webkit::npapi::IsPluginEnabled(info)) | 599 NULL, &plugins, &mime_types); |
| 600 if (plugins.empty()) |
600 return NULL; | 601 return NULL; |
601 | 602 |
602 return new webkit::npapi::WebPluginImpl( | 603 return new webkit::npapi::WebPluginImpl( |
603 frame, params, info.path, actual_mime_type, AsWeakPtr()); | 604 frame, params, plugins.front().path, mime_types.front(), AsWeakPtr()); |
604 } | 605 } |
605 | 606 |
606 WebWorker* TestWebViewDelegate::createWorker(WebFrame* frame, | 607 WebWorker* TestWebViewDelegate::createWorker(WebFrame* frame, |
607 WebWorkerClient* client) { | 608 WebWorkerClient* client) { |
608 return new TestWebWorker(); | 609 return new TestWebWorker(); |
609 } | 610 } |
610 | 611 |
611 WebMediaPlayer* TestWebViewDelegate::createMediaPlayer( | 612 WebMediaPlayer* TestWebViewDelegate::createMediaPlayer( |
612 WebFrame* frame, WebMediaPlayerClient* client) { | 613 WebFrame* frame, WebMediaPlayerClient* client) { |
613 scoped_ptr<media::MessageLoopFactory> message_loop_factory( | 614 scoped_ptr<media::MessageLoopFactory> message_loop_factory( |
(...skipping 508 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1122 } | 1123 } |
1123 | 1124 |
1124 void TestWebViewDelegate::set_fake_window_rect(const WebRect& rect) { | 1125 void TestWebViewDelegate::set_fake_window_rect(const WebRect& rect) { |
1125 fake_rect_ = rect; | 1126 fake_rect_ = rect; |
1126 using_fake_rect_ = true; | 1127 using_fake_rect_ = true; |
1127 } | 1128 } |
1128 | 1129 |
1129 WebRect TestWebViewDelegate::fake_window_rect() { | 1130 WebRect TestWebViewDelegate::fake_window_rect() { |
1130 return fake_rect_; | 1131 return fake_rect_; |
1131 } | 1132 } |
OLD | NEW |