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 #include "webkit/plugins/npapi/plugin_instance.h" |
| 6 |
5 #include "build/build_config.h" | 7 #include "build/build_config.h" |
6 | |
7 #include "webkit/glue/plugins/plugin_instance.h" | |
8 | |
9 #include "base/file_util.h" | 8 #include "base/file_util.h" |
10 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
11 #include "base/string_number_conversions.h" | 10 #include "base/string_number_conversions.h" |
12 #include "base/utf_string_conversions.h" | 11 #include "base/utf_string_conversions.h" |
13 #include "webkit/glue/webkit_glue.h" | 12 #include "webkit/glue/webkit_glue.h" |
14 #include "webkit/glue/plugins/plugin_host.h" | 13 #include "webkit/plugins/npapi/plugin_host.h" |
15 #include "webkit/glue/plugins/plugin_lib.h" | 14 #include "webkit/plugins/npapi/plugin_lib.h" |
16 #include "webkit/glue/plugins/plugin_stream_url.h" | 15 #include "webkit/plugins/npapi/plugin_stream_url.h" |
17 #include "webkit/glue/plugins/plugin_string_stream.h" | 16 #include "webkit/plugins/npapi/plugin_string_stream.h" |
18 #include "webkit/glue/plugins/webplugin.h" | 17 #include "webkit/plugins/npapi/webplugin.h" |
19 #include "webkit/glue/plugins/webplugin_delegate.h" | 18 #include "webkit/plugins/npapi/webplugin_delegate.h" |
20 #include "net/base/escape.h" | 19 #include "net/base/escape.h" |
21 | 20 |
22 #if defined(OS_MACOSX) | 21 #if defined(OS_MACOSX) |
23 #include <ApplicationServices/ApplicationServices.h> | 22 #include <ApplicationServices/ApplicationServices.h> |
24 #endif | 23 #endif |
25 | 24 |
26 namespace NPAPI { | 25 namespace webkit { |
| 26 namespace npapi { |
27 | 27 |
28 PluginInstance::PluginInstance(PluginLib *plugin, const std::string &mime_type) | 28 PluginInstance::PluginInstance(PluginLib *plugin, const std::string &mime_type) |
29 : plugin_(plugin), | 29 : plugin_(plugin), |
30 npp_(0), | 30 npp_(0), |
31 host_(PluginHost::Singleton()), | 31 host_(PluginHost::Singleton()), |
32 npp_functions_(plugin->functions()), | 32 npp_functions_(plugin->functions()), |
33 window_handle_(0), | 33 window_handle_(0), |
34 windowless_(false), | 34 windowless_(false), |
35 transparent_(true), | 35 transparent_(true), |
36 webplugin_(0), | 36 webplugin_(0), |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 void PluginInstance::CloseStreams() { | 123 void PluginInstance::CloseStreams() { |
124 in_close_streams_ = true; | 124 in_close_streams_ = true; |
125 for (unsigned int index = 0; index < open_streams_.size(); ++index) { | 125 for (unsigned int index = 0; index < open_streams_.size(); ++index) { |
126 // Close all streams on the way down. | 126 // Close all streams on the way down. |
127 open_streams_[index]->Close(NPRES_USER_BREAK); | 127 open_streams_[index]->Close(NPRES_USER_BREAK); |
128 } | 128 } |
129 open_streams_.clear(); | 129 open_streams_.clear(); |
130 in_close_streams_ = false; | 130 in_close_streams_ = false; |
131 } | 131 } |
132 | 132 |
133 webkit_glue::WebPluginResourceClient* PluginInstance::GetRangeRequest( | 133 WebPluginResourceClient* PluginInstance::GetRangeRequest( |
134 int id) { | 134 int id) { |
135 PendingRangeRequestMap::iterator iter = pending_range_requests_.find(id); | 135 PendingRangeRequestMap::iterator iter = pending_range_requests_.find(id); |
136 if (iter == pending_range_requests_.end()) { | 136 if (iter == pending_range_requests_.end()) { |
137 NOTREACHED(); | 137 NOTREACHED(); |
138 return NULL; | 138 return NULL; |
139 } | 139 } |
140 | 140 |
141 webkit_glue::WebPluginResourceClient* rv = iter->second->AsResourceClient(); | 141 WebPluginResourceClient* rv = iter->second->AsResourceClient(); |
142 pending_range_requests_.erase(iter); | 142 pending_range_requests_.erase(iter); |
143 return rv; | 143 return rv; |
144 } | 144 } |
145 | 145 |
146 bool PluginInstance::Start(const GURL& url, | 146 bool PluginInstance::Start(const GURL& url, |
147 char** const param_names, | 147 char** const param_names, |
148 char** const param_values, | 148 char** const param_values, |
149 int param_count, | 149 int param_count, |
150 bool load_manually) { | 150 bool load_manually) { |
151 load_manually_ = load_manually; | 151 load_manually_ = load_manually; |
(...skipping 506 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
658 } | 658 } |
659 } | 659 } |
660 | 660 |
661 void PluginInstance::URLRedirectResponse(bool allow, void* notify_data) { | 661 void PluginInstance::URLRedirectResponse(bool allow, void* notify_data) { |
662 // The notify_data passed in allows us to identify the matching stream. | 662 // The notify_data passed in allows us to identify the matching stream. |
663 std::vector<scoped_refptr<PluginStream> >::iterator stream_index; | 663 std::vector<scoped_refptr<PluginStream> >::iterator stream_index; |
664 for (stream_index = open_streams_.begin(); | 664 for (stream_index = open_streams_.begin(); |
665 stream_index != open_streams_.end(); ++stream_index) { | 665 stream_index != open_streams_.end(); ++stream_index) { |
666 PluginStream* plugin_stream = *stream_index; | 666 PluginStream* plugin_stream = *stream_index; |
667 if (plugin_stream->notify_data() == notify_data) { | 667 if (plugin_stream->notify_data() == notify_data) { |
668 webkit_glue::WebPluginResourceClient* resource_client = | 668 WebPluginResourceClient* resource_client = |
669 plugin_stream->AsResourceClient(); | 669 plugin_stream->AsResourceClient(); |
670 webplugin_->URLRedirectResponse(allow, resource_client->ResourceId()); | 670 webplugin_->URLRedirectResponse(allow, resource_client->ResourceId()); |
671 if (allow) { | 671 if (allow) { |
672 plugin_stream->UpdateUrl( | 672 plugin_stream->UpdateUrl( |
673 plugin_stream->pending_redirect_url().c_str()); | 673 plugin_stream->pending_redirect_url().c_str()); |
674 } | 674 } |
675 break; | 675 break; |
676 } | 676 } |
677 } | 677 } |
678 } | 678 } |
679 | 679 |
680 } // namespace NPAPI | 680 } // namespace npapi |
| 681 } // namespace webkit |
OLD | NEW |