OLD | NEW |
1 // Copyright (c) 2009 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 "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" |
11 #include "base/process_util.h" | 11 #include "base/process_util.h" |
| 12 #include "base/string_split.h" |
12 #include "chrome/common/child_process.h" | 13 #include "chrome/common/child_process.h" |
13 #include "chrome/common/chrome_constants.h" | 14 #include "chrome/common/chrome_constants.h" |
14 #include "chrome/common/chrome_plugin_lib.h" | 15 #include "chrome/common/chrome_plugin_lib.h" |
15 #include "chrome/common/chrome_plugin_util.h" | 16 #include "chrome/common/chrome_plugin_util.h" |
16 #include "chrome/common/chrome_switches.h" | 17 #include "chrome/common/chrome_switches.h" |
17 #include "chrome/common/plugin_messages.h" | 18 #include "chrome/common/plugin_messages.h" |
18 #include "chrome/common/resource_dispatcher.h" | 19 #include "chrome/common/resource_dispatcher.h" |
19 #include "chrome/plugin/plugin_thread.h" | 20 #include "chrome/plugin/plugin_thread.h" |
20 #include "chrome/plugin/webplugin_proxy.h" | 21 #include "chrome/plugin/webplugin_proxy.h" |
21 #include "net/base/data_url.h" | 22 #include "net/base/data_url.h" |
(...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
376 WebPluginProxy* webplugin = WebPluginProxy::FromCPBrowsingContext(context); | 377 WebPluginProxy* webplugin = WebPluginProxy::FromCPBrowsingContext(context); |
377 if (!webplugin || !file_drag_data) | 378 if (!webplugin || !file_drag_data) |
378 return CPERR_INVALID_PARAMETER; | 379 return CPERR_INVALID_PARAMETER; |
379 | 380 |
380 const int renderer = webplugin->GetRendererId(); | 381 const int renderer = webplugin->GetRendererId(); |
381 if (renderer == -1) | 382 if (renderer == -1) |
382 return CPERR_FAILURE; | 383 return CPERR_FAILURE; |
383 | 384 |
384 static const char kDelimiter('\b'); | 385 static const char kDelimiter('\b'); |
385 std::vector<std::string> files; | 386 std::vector<std::string> files; |
386 SplitStringDontTrim(file_drag_data, kDelimiter, &files); | 387 base::SplitStringDontTrim(file_drag_data, kDelimiter, &files); |
387 | 388 |
388 bool allowed = false; | 389 bool allowed = false; |
389 if (!PluginThread::current()->Send( | 390 if (!PluginThread::current()->Send( |
390 new PluginProcessHostMsg_AccessFiles(renderer, files, &allowed))) { | 391 new PluginProcessHostMsg_AccessFiles(renderer, files, &allowed))) { |
391 return CPERR_FAILURE; | 392 return CPERR_FAILURE; |
392 } | 393 } |
393 | 394 |
394 if (allowed) | 395 if (allowed) |
395 return CPERR_SUCCESS; | 396 return CPERR_SUCCESS; |
396 return CPERR_FAILURE; | 397 return CPERR_FAILURE; |
(...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
716 | 717 |
717 response_funcs.size = sizeof(response_funcs); | 718 response_funcs.size = sizeof(response_funcs); |
718 response_funcs.received_redirect = CPRR_ReceivedRedirect; | 719 response_funcs.received_redirect = CPRR_ReceivedRedirect; |
719 response_funcs.start_completed = CPRR_StartCompleted; | 720 response_funcs.start_completed = CPRR_StartCompleted; |
720 response_funcs.read_completed = CPRR_ReadCompleted; | 721 response_funcs.read_completed = CPRR_ReadCompleted; |
721 response_funcs.upload_progress = CPRR_UploadProgress; | 722 response_funcs.upload_progress = CPRR_UploadProgress; |
722 } | 723 } |
723 | 724 |
724 return &browser_funcs; | 725 return &browser_funcs; |
725 } | 726 } |
OLD | NEW |