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

Side by Side Diff: ppapi/proxy/ppb_file_chooser_proxy.cc

Issue 8298017: Fix crash in PPB_FileChooser_Dev proxy. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 2 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 | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "ppapi/proxy/ppb_file_chooser_proxy.h" 5 #include "ppapi/proxy/ppb_file_chooser_proxy.h"
6 6
7 #include <queue> 7 #include <queue>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "ppapi/c/dev/ppb_file_chooser_dev.h" 10 #include "ppapi/c/dev/ppb_file_chooser_dev.h"
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 118
119 if (current_show_callback_.func) 119 if (current_show_callback_.func)
120 return PP_ERROR_INPROGRESS; // Can't show more than once. 120 return PP_ERROR_INPROGRESS; // Can't show more than once.
121 121
122 current_show_callback_ = callback; 122 current_show_callback_ = callback;
123 PluginDispatcher::GetForResource(this)->Send( 123 PluginDispatcher::GetForResource(this)->Send(
124 new PpapiHostMsg_PPBFileChooser_Show( 124 new PpapiHostMsg_PPBFileChooser_Show(
125 INTERFACE_ID_PPB_FILE_CHOOSER, 125 INTERFACE_ID_PPB_FILE_CHOOSER,
126 host_resource(), 126 host_resource(),
127 save_as, 127 save_as,
128 suggested_file_name, 128 suggested_file_name ? suggested_file_name : "",
129 require_user_gesture)); 129 require_user_gesture));
130 return PP_OK_COMPLETIONPENDING; 130 return PP_OK_COMPLETIONPENDING;
131 } 131 }
132 132
133 PP_Resource FileChooser::GetNextChosenFile() { 133 PP_Resource FileChooser::GetNextChosenFile() {
134 if (file_queue_.empty()) 134 if (file_queue_.empty())
135 return 0; 135 return 0;
136 136
137 // Return the next resource in the queue. These resource have already been 137 // Return the next resource in the queue. These resource have already been
138 // addrefed (they're currently owned by the FileChooser) and returning them 138 // addrefed (they're currently owned by the FileChooser) and returning them
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 PP_FileChooserMode_Dev mode, 184 PP_FileChooserMode_Dev mode,
185 const char* accept_mime_types) { 185 const char* accept_mime_types) {
186 Dispatcher* dispatcher = PluginDispatcher::GetForInstance(instance); 186 Dispatcher* dispatcher = PluginDispatcher::GetForInstance(instance);
187 if (!dispatcher) 187 if (!dispatcher)
188 return 0; 188 return 0;
189 189
190 HostResource result; 190 HostResource result;
191 dispatcher->Send(new PpapiHostMsg_PPBFileChooser_Create( 191 dispatcher->Send(new PpapiHostMsg_PPBFileChooser_Create(
192 INTERFACE_ID_PPB_FILE_CHOOSER, instance, 192 INTERFACE_ID_PPB_FILE_CHOOSER, instance,
193 mode, 193 mode,
194 accept_mime_types, 194 accept_mime_types ? accept_mime_types : "",
195 &result)); 195 &result));
196 196
197 if (result.is_null()) 197 if (result.is_null())
198 return 0; 198 return 0;
199 return (new FileChooser(result))->GetReference(); 199 return (new FileChooser(result))->GetReference();
200 } 200 }
201 201
202 bool PPB_FileChooser_Proxy::OnMessageReceived(const IPC::Message& msg) { 202 bool PPB_FileChooser_Proxy::OnMessageReceived(const IPC::Message& msg) {
203 bool handled = true; 203 bool handled = true;
204 IPC_BEGIN_MESSAGE_MAP(PPB_FileChooser_Proxy, msg) 204 IPC_BEGIN_MESSAGE_MAP(PPB_FileChooser_Proxy, msg)
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
276 files.push_back(cur_create_info); 276 files.push_back(cur_create_info);
277 } 277 }
278 } 278 }
279 279
280 dispatcher()->Send(new PpapiMsg_PPBFileChooser_ChooseComplete( 280 dispatcher()->Send(new PpapiMsg_PPBFileChooser_ChooseComplete(
281 INTERFACE_ID_PPB_FILE_CHOOSER, chooser, result, files)); 281 INTERFACE_ID_PPB_FILE_CHOOSER, chooser, result, files));
282 } 282 }
283 283
284 } // namespace proxy 284 } // namespace proxy
285 } // namespace ppapi 285 } // namespace ppapi
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698