| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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_path.h" | 8 #include "base/file_path.h" |
| 9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
| 10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
| (...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 355 } | 355 } |
| 356 | 356 |
| 357 CPError STDCALL CPB_AllowFileDrop( | 357 CPError STDCALL CPB_AllowFileDrop( |
| 358 CPID id, CPBrowsingContext context, const char* file_drag_data) { | 358 CPID id, CPBrowsingContext context, const char* file_drag_data) { |
| 359 CHECK(ChromePluginLib::IsPluginThread()); | 359 CHECK(ChromePluginLib::IsPluginThread()); |
| 360 | 360 |
| 361 WebPluginProxy* webplugin = WebPluginProxy::FromCPBrowsingContext(context); | 361 WebPluginProxy* webplugin = WebPluginProxy::FromCPBrowsingContext(context); |
| 362 if (!webplugin || !file_drag_data) | 362 if (!webplugin || !file_drag_data) |
| 363 return CPERR_INVALID_PARAMETER; | 363 return CPERR_INVALID_PARAMETER; |
| 364 | 364 |
| 365 const int pid = webplugin->GetRendererProcessId(); | 365 const int renderer = webplugin->GetRendererId(); |
| 366 if (!pid) | 366 if (renderer == -1) |
| 367 return CPERR_FAILURE; | 367 return CPERR_FAILURE; |
| 368 | 368 |
| 369 static const char kDelimiter('\b'); | 369 static const char kDelimiter('\b'); |
| 370 std::vector<std::string> files; | 370 std::vector<std::string> files; |
| 371 SplitStringDontTrim(file_drag_data, kDelimiter, &files); | 371 SplitStringDontTrim(file_drag_data, kDelimiter, &files); |
| 372 | 372 |
| 373 bool allowed = false; | 373 bool allowed = false; |
| 374 if (!PluginThread::current()->Send( | 374 if (!PluginThread::current()->Send( |
| 375 new PluginProcessHostMsg_AccessFiles(pid, files, &allowed))) { | 375 new PluginProcessHostMsg_AccessFiles(renderer, files, &allowed))) { |
| 376 return CPERR_FAILURE; | 376 return CPERR_FAILURE; |
| 377 } | 377 } |
| 378 | 378 |
| 379 if (allowed) | 379 if (allowed) |
| 380 return CPERR_SUCCESS; | 380 return CPERR_SUCCESS; |
| 381 return CPERR_FAILURE; | 381 return CPERR_FAILURE; |
| 382 } | 382 } |
| 383 | 383 |
| 384 CPError STDCALL CPB_GetCommandLineArguments( | 384 CPError STDCALL CPB_GetCommandLineArguments( |
| 385 CPID id, CPBrowsingContext context, const char* url, char** arguments) { | 385 CPID id, CPBrowsingContext context, const char* url, char** arguments) { |
| (...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 683 | 683 |
| 684 response_funcs.size = sizeof(response_funcs); | 684 response_funcs.size = sizeof(response_funcs); |
| 685 response_funcs.received_redirect = CPRR_ReceivedRedirect; | 685 response_funcs.received_redirect = CPRR_ReceivedRedirect; |
| 686 response_funcs.start_completed = CPRR_StartCompleted; | 686 response_funcs.start_completed = CPRR_StartCompleted; |
| 687 response_funcs.read_completed = CPRR_ReadCompleted; | 687 response_funcs.read_completed = CPRR_ReadCompleted; |
| 688 response_funcs.upload_progress = CPRR_UploadProgress; | 688 response_funcs.upload_progress = CPRR_UploadProgress; |
| 689 } | 689 } |
| 690 | 690 |
| 691 return &browser_funcs; | 691 return &browser_funcs; |
| 692 } | 692 } |
| OLD | NEW |