| OLD | NEW | 
|    1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. |    1 // Copyright (c) 2006-2008 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 "chrome/plugin/chrome_plugin_host.h" |    5 #include "chrome/plugin/chrome_plugin_host.h" | 
|    6  |    6  | 
|    7 #include "base/command_line.h" |    7 #include "base/command_line.h" | 
|    8 #include "base/file_util.h" |    8 #include "base/file_util.h" | 
|    9 #include "base/message_loop.h" |    9 #include "base/message_loop.h" | 
|   10 #include "chrome/common/child_process.h" |   10 #include "chrome/common/child_process.h" | 
|   11 #include "chrome/common/chrome_constants.h" |   11 #include "chrome/common/chrome_constants.h" | 
|   12 #include "chrome/common/chrome_plugin_lib.h" |   12 #include "chrome/common/chrome_plugin_lib.h" | 
|   13 #include "chrome/common/chrome_plugin_util.h" |   13 #include "chrome/common/chrome_plugin_util.h" | 
|   14 #include "chrome/common/chrome_switches.h" |   14 #include "chrome/common/chrome_switches.h" | 
|   15 #include "chrome/common/plugin_messages.h" |   15 #include "chrome/common/plugin_messages.h" | 
|   16 #include "chrome/plugin/plugin_thread.h" |   16 #include "chrome/plugin/plugin_thread.h" | 
|   17 #include "chrome/plugin/webplugin_proxy.h" |   17 #include "chrome/plugin/webplugin_proxy.h" | 
|   18 #include "net/base/data_url.h" |   18 #include "net/base/data_url.h" | 
|   19 #include "net/base/upload_data.h" |   19 #include "net/base/upload_data.h" | 
|   20 #include "net/http/http_response_headers.h" |   20 #include "net/http/http_response_headers.h" | 
|   21 #include "webkit/glue/plugins/plugin_instance.h" |   21 #include "webkit/glue/plugins/plugin_instance.h" | 
|   22 #include "webkit/glue/resource_loader_bridge.h" |   22 #include "webkit/glue/resource_loader_bridge.h" | 
|   23 #include "webkit/glue/resource_type.h" |   23 #include "webkit/glue/resource_type.h" | 
 |   24 #include "webkit/glue/webappcachecontext.h" | 
|   24 #include "webkit/glue/webkit_glue.h" |   25 #include "webkit/glue/webkit_glue.h" | 
|   25  |   26  | 
|   26 namespace { |   27 namespace { | 
|   27  |   28  | 
|   28 using webkit_glue::ResourceLoaderBridge; |   29 using webkit_glue::ResourceLoaderBridge; | 
|   29  |   30  | 
|   30 // This class manages a network request made by the plugin, handling the |   31 // This class manages a network request made by the plugin, handling the | 
|   31 // data as it comes in from the ResourceLoaderBridge and is requested by the |   32 // data as it comes in from the ResourceLoaderBridge and is requested by the | 
|   32 // plugin. |   33 // plugin. | 
|   33 // NOTE: All methods must be called on the Plugin thread. |   34 // NOTE: All methods must be called on the Plugin thread. | 
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  145             GURL(cprequest_->url),  // TODO(jackson): policy url? |  146             GURL(cprequest_->url),  // TODO(jackson): policy url? | 
|  146             GURL(),  // TODO(mpcomplete): referrer? |  147             GURL(),  // TODO(mpcomplete): referrer? | 
|  147             "null",  // frame_origin |  148             "null",  // frame_origin | 
|  148             "null",  // main_frame_origin |  149             "null",  // main_frame_origin | 
|  149             extra_headers_, |  150             extra_headers_, | 
|  150             "", // default_mime_type |  151             "", // default_mime_type | 
|  151             load_flags_, |  152             load_flags_, | 
|  152             GetCurrentProcessId(), |  153             GetCurrentProcessId(), | 
|  153             ResourceType::OBJECT, |  154             ResourceType::OBJECT, | 
|  154             cprequest_->context, |  155             cprequest_->context, | 
 |  156             WebAppCacheContext::kNoAppCacheContextId, | 
|  155             MSG_ROUTING_CONTROL)); |  157             MSG_ROUTING_CONTROL)); | 
|  156     if (!bridge_.get()) |  158     if (!bridge_.get()) | 
|  157       return CPERR_FAILURE; |  159       return CPERR_FAILURE; | 
|  158  |  160  | 
|  159     for (size_t i = 0; i < upload_content_.size(); ++i) { |  161     for (size_t i = 0; i < upload_content_.size(); ++i) { | 
|  160       switch (upload_content_[i].type()) { |  162       switch (upload_content_[i].type()) { | 
|  161         case net::UploadData::TYPE_BYTES: { |  163         case net::UploadData::TYPE_BYTES: { | 
|  162           const std::vector<char>& bytes = upload_content_[i].bytes(); |  164           const std::vector<char>& bytes = upload_content_[i].bytes(); | 
|  163           bridge_->AppendDataToUpload(&bytes[0], |  165           bridge_->AppendDataToUpload(&bytes[0], | 
|  164                                       static_cast<int>(bytes.size())); |  166                                       static_cast<int>(bytes.size())); | 
| (...skipping 446 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  611  |  613  | 
|  612     response_funcs.size = sizeof(response_funcs); |  614     response_funcs.size = sizeof(response_funcs); | 
|  613     response_funcs.received_redirect = CPRR_ReceivedRedirect; |  615     response_funcs.received_redirect = CPRR_ReceivedRedirect; | 
|  614     response_funcs.start_completed = CPRR_StartCompleted; |  616     response_funcs.start_completed = CPRR_StartCompleted; | 
|  615     response_funcs.read_completed = CPRR_ReadCompleted; |  617     response_funcs.read_completed = CPRR_ReadCompleted; | 
|  616     response_funcs.upload_progress = CPRR_UploadProgress; |  618     response_funcs.upload_progress = CPRR_UploadProgress; | 
|  617   } |  619   } | 
|  618  |  620  | 
|  619   return &browser_funcs; |  621   return &browser_funcs; | 
|  620 } |  622 } | 
| OLD | NEW |