Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(50)

Side by Side Diff: chrome/plugin/chrome_plugin_host.cc

Issue 160211: Merge 21437 - CPAPI (0.11) for gears drag drop.... (Closed) Base URL: svn://chrome-svn/chrome/branches/195/src/
Patch Set: Created 11 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/common/plugin_messages_internal.h ('k') | chrome/plugin/webplugin_proxy.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Property Changes:
Added: svn:mergeinfo
Merged /trunk/src/chrome/plugin/chrome_plugin_host.cc:r21437
Merged /branches/chrome_webkit_merge_branch/chrome/plugin/chrome_plugin_host.cc:r69-2775
OLDNEW
1 // Copyright (c) 2006-2008 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"
11 #include "base/process_util.h" 11 #include "base/process_util.h"
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after
344 344
345 WebPluginProxy* webplugin = WebPluginProxy::FromCPBrowsingContext(context); 345 WebPluginProxy* webplugin = WebPluginProxy::FromCPBrowsingContext(context);
346 if (!event || !webplugin) 346 if (!event || !webplugin)
347 return CPERR_INVALID_PARAMETER; 347 return CPERR_INVALID_PARAMETER;
348 348
349 if (webplugin->SetDropEffect(event, effect)) 349 if (webplugin->SetDropEffect(event, effect))
350 return CPERR_SUCCESS; 350 return CPERR_SUCCESS;
351 return CPERR_FAILURE; 351 return CPERR_FAILURE;
352 } 352 }
353 353
354 CPError STDCALL CPB_AllowFileDrop(
355 CPID id, CPBrowsingContext context, const char* file_drag_data) {
356 CHECK(ChromePluginLib::IsPluginThread());
357
358 WebPluginProxy* webplugin = WebPluginProxy::FromCPBrowsingContext(context);
359 if (!webplugin || !file_drag_data)
360 return CPERR_INVALID_PARAMETER;
361
362 const int pid = webplugin->GetRendererProcessId();
363 if (!pid)
364 return CPERR_FAILURE;
365
366 static const char kDelimiter('\b');
367 std::vector<std::string> files;
368 SplitStringDontTrim(file_drag_data, kDelimiter, &files);
369
370 bool allowed = false;
371 if (!PluginThread::current()->Send(
372 new PluginProcessHostMsg_AccessFiles(pid, files, &allowed))) {
373 return CPERR_FAILURE;
374 }
375
376 if (allowed)
377 return CPERR_SUCCESS;
378 return CPERR_FAILURE;
379 }
380
354 CPError STDCALL CPB_GetCommandLineArguments( 381 CPError STDCALL CPB_GetCommandLineArguments(
355 CPID id, CPBrowsingContext context, const char* url, char** arguments) { 382 CPID id, CPBrowsingContext context, const char* url, char** arguments) {
356 CHECK(ChromePluginLib::IsPluginThread()); 383 CHECK(ChromePluginLib::IsPluginThread());
357 std::string arguments_str; 384 std::string arguments_str;
358 CPError rv = CPB_GetCommandLineArgumentsCommon(url, &arguments_str); 385 CPError rv = CPB_GetCommandLineArgumentsCommon(url, &arguments_str);
359 if (rv == CPERR_SUCCESS) 386 if (rv == CPERR_SUCCESS)
360 *arguments = CPB_StringDup(CPB_Alloc, arguments_str); 387 *arguments = CPB_StringDup(CPB_Alloc, arguments_str);
361 return rv; 388 return rv;
362 } 389 }
363 390
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after
629 browser_funcs.get_browsing_context_from_npp = CPB_GetBrowsingContextFromNPP; 656 browser_funcs.get_browsing_context_from_npp = CPB_GetBrowsingContextFromNPP;
630 browser_funcs.get_browsing_context_info = CPB_GetBrowsingContextInfo; 657 browser_funcs.get_browsing_context_info = CPB_GetBrowsingContextInfo;
631 browser_funcs.get_command_line_arguments = CPB_GetCommandLineArguments; 658 browser_funcs.get_command_line_arguments = CPB_GetCommandLineArguments;
632 browser_funcs.add_ui_command = CPB_AddUICommand; 659 browser_funcs.add_ui_command = CPB_AddUICommand;
633 browser_funcs.handle_command = CPB_HandleCommand; 660 browser_funcs.handle_command = CPB_HandleCommand;
634 browser_funcs.send_sync_message = CPB_SendSyncMessage; 661 browser_funcs.send_sync_message = CPB_SendSyncMessage;
635 browser_funcs.plugin_thread_async_call = CPB_PluginThreadAsyncCall; 662 browser_funcs.plugin_thread_async_call = CPB_PluginThreadAsyncCall;
636 browser_funcs.open_file_dialog = CPB_OpenFileDialog; 663 browser_funcs.open_file_dialog = CPB_OpenFileDialog;
637 browser_funcs.get_drag_data = CPB_GetDragData; 664 browser_funcs.get_drag_data = CPB_GetDragData;
638 browser_funcs.set_drop_effect = CPB_SetDropEffect; 665 browser_funcs.set_drop_effect = CPB_SetDropEffect;
666 browser_funcs.allow_file_drop = CPB_AllowFileDrop;
639 667
640 browser_funcs.request_funcs = &request_funcs; 668 browser_funcs.request_funcs = &request_funcs;
641 browser_funcs.response_funcs = &response_funcs; 669 browser_funcs.response_funcs = &response_funcs;
642 670
643 request_funcs.size = sizeof(request_funcs); 671 request_funcs.size = sizeof(request_funcs);
644 request_funcs.start_request = CPR_StartRequest; 672 request_funcs.start_request = CPR_StartRequest;
645 request_funcs.end_request = CPR_EndRequest; 673 request_funcs.end_request = CPR_EndRequest;
646 request_funcs.set_extra_request_headers = CPR_SetExtraRequestHeaders; 674 request_funcs.set_extra_request_headers = CPR_SetExtraRequestHeaders;
647 request_funcs.set_request_load_flags = CPR_SetRequestLoadFlags; 675 request_funcs.set_request_load_flags = CPR_SetRequestLoadFlags;
648 request_funcs.append_data_to_upload = CPR_AppendDataToUpload; 676 request_funcs.append_data_to_upload = CPR_AppendDataToUpload;
649 request_funcs.get_response_info = CPR_GetResponseInfo; 677 request_funcs.get_response_info = CPR_GetResponseInfo;
650 request_funcs.read = CPR_Read; 678 request_funcs.read = CPR_Read;
651 request_funcs.append_file_to_upload = CPR_AppendFileToUpload; 679 request_funcs.append_file_to_upload = CPR_AppendFileToUpload;
652 680
653 response_funcs.size = sizeof(response_funcs); 681 response_funcs.size = sizeof(response_funcs);
654 response_funcs.received_redirect = CPRR_ReceivedRedirect; 682 response_funcs.received_redirect = CPRR_ReceivedRedirect;
655 response_funcs.start_completed = CPRR_StartCompleted; 683 response_funcs.start_completed = CPRR_StartCompleted;
656 response_funcs.read_completed = CPRR_ReadCompleted; 684 response_funcs.read_completed = CPRR_ReadCompleted;
657 response_funcs.upload_progress = CPRR_UploadProgress; 685 response_funcs.upload_progress = CPRR_UploadProgress;
658 } 686 }
659 687
660 return &browser_funcs; 688 return &browser_funcs;
661 } 689 }
OLDNEW
« no previous file with comments | « chrome/common/plugin_messages_internal.h ('k') | chrome/plugin/webplugin_proxy.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698