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

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

Issue 8333004: Rename InterfaceID to ApiID and move the file. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merged 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 | « ppapi/proxy/ppb_file_chooser_proxy.h ('k') | ppapi/proxy/ppb_file_ref_proxy.h » ('j') | 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 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 const PP_CompletionCallback& callback) { 117 const PP_CompletionCallback& callback) {
118 if (!callback.func) 118 if (!callback.func)
119 return PP_ERROR_BLOCKS_MAIN_THREAD; 119 return PP_ERROR_BLOCKS_MAIN_THREAD;
120 120
121 if (current_show_callback_.func) 121 if (current_show_callback_.func)
122 return PP_ERROR_INPROGRESS; // Can't show more than once. 122 return PP_ERROR_INPROGRESS; // Can't show more than once.
123 123
124 current_show_callback_ = callback; 124 current_show_callback_ = callback;
125 PluginDispatcher::GetForResource(this)->Send( 125 PluginDispatcher::GetForResource(this)->Send(
126 new PpapiHostMsg_PPBFileChooser_Show( 126 new PpapiHostMsg_PPBFileChooser_Show(
127 INTERFACE_ID_PPB_FILE_CHOOSER, 127 API_ID_PPB_FILE_CHOOSER,
128 host_resource(), 128 host_resource(),
129 save_as, 129 save_as,
130 suggested_file_name ? suggested_file_name : "", 130 suggested_file_name ? suggested_file_name : "",
131 require_user_gesture)); 131 require_user_gesture));
132 return PP_OK_COMPLETIONPENDING; 132 return PP_OK_COMPLETIONPENDING;
133 } 133 }
134 134
135 PP_Resource FileChooser::GetNextChosenFile() { 135 PP_Resource FileChooser::GetNextChosenFile() {
136 if (file_queue_.empty()) 136 if (file_queue_.empty())
137 return 0; 137 return 0;
(...skipping 28 matching lines...) Expand all
166 } 166 }
167 167
168 PPB_FileChooser_Proxy::~PPB_FileChooser_Proxy() { 168 PPB_FileChooser_Proxy::~PPB_FileChooser_Proxy() {
169 } 169 }
170 170
171 // static 171 // static
172 const InterfaceProxy::Info* PPB_FileChooser_Proxy::GetTrustedInfo() { 172 const InterfaceProxy::Info* PPB_FileChooser_Proxy::GetTrustedInfo() {
173 static const Info info = { 173 static const Info info = {
174 thunk::GetPPB_FileChooser_Trusted_Thunk(), 174 thunk::GetPPB_FileChooser_Trusted_Thunk(),
175 PPB_FILECHOOSER_TRUSTED_INTERFACE, 175 PPB_FILECHOOSER_TRUSTED_INTERFACE,
176 INTERFACE_ID_NONE, // FILE_CHOOSER is the canonical one. 176 API_ID_NONE, // FILE_CHOOSER is the canonical one.
177 false, 177 false,
178 &CreateFileChooserProxy 178 &CreateFileChooserProxy
179 }; 179 };
180 return &info; 180 return &info;
181 } 181 }
182 182
183 // static 183 // static
184 PP_Resource PPB_FileChooser_Proxy::CreateProxyResource( 184 PP_Resource PPB_FileChooser_Proxy::CreateProxyResource(
185 PP_Instance instance, 185 PP_Instance instance,
186 PP_FileChooserMode_Dev mode, 186 PP_FileChooserMode_Dev mode,
187 const char* accept_mime_types) { 187 const char* accept_mime_types) {
188 Dispatcher* dispatcher = PluginDispatcher::GetForInstance(instance); 188 Dispatcher* dispatcher = PluginDispatcher::GetForInstance(instance);
189 if (!dispatcher) 189 if (!dispatcher)
190 return 0; 190 return 0;
191 191
192 HostResource result; 192 HostResource result;
193 dispatcher->Send(new PpapiHostMsg_PPBFileChooser_Create( 193 dispatcher->Send(new PpapiHostMsg_PPBFileChooser_Create(
194 INTERFACE_ID_PPB_FILE_CHOOSER, instance, 194 API_ID_PPB_FILE_CHOOSER, instance,
195 mode, 195 mode,
196 accept_mime_types ? accept_mime_types : "", 196 accept_mime_types ? accept_mime_types : "",
197 &result)); 197 &result));
198 198
199 if (result.is_null()) 199 if (result.is_null())
200 return 0; 200 return 0;
201 return (new FileChooser(result))->GetReference(); 201 return (new FileChooser(result))->GetReference();
202 } 202 }
203 203
204 bool PPB_FileChooser_Proxy::OnMessageReceived(const IPC::Message& msg) { 204 bool PPB_FileChooser_Proxy::OnMessageReceived(const IPC::Message& msg) {
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
261 } 261 }
262 } 262 }
263 263
264 void PPB_FileChooser_Proxy::OnShowCallback(int32_t result, 264 void PPB_FileChooser_Proxy::OnShowCallback(int32_t result,
265 const HostResource& chooser) { 265 const HostResource& chooser) {
266 EnterHostFromHostResource<PPB_FileChooser_API> enter(chooser); 266 EnterHostFromHostResource<PPB_FileChooser_API> enter(chooser);
267 267
268 std::vector<PPB_FileRef_CreateInfo> files; 268 std::vector<PPB_FileRef_CreateInfo> files;
269 if (enter.succeeded() && result == PP_OK) { 269 if (enter.succeeded() && result == PP_OK) {
270 PPB_FileRef_Proxy* file_ref_proxy = static_cast<PPB_FileRef_Proxy*>( 270 PPB_FileRef_Proxy* file_ref_proxy = static_cast<PPB_FileRef_Proxy*>(
271 dispatcher()->GetInterfaceProxy(INTERFACE_ID_PPB_FILE_REF)); 271 dispatcher()->GetInterfaceProxy(API_ID_PPB_FILE_REF));
272 272
273 // Convert the returned files to the serialized info. 273 // Convert the returned files to the serialized info.
274 while (PP_Resource cur_file_resource = 274 while (PP_Resource cur_file_resource =
275 enter.object()->GetNextChosenFile()) { 275 enter.object()->GetNextChosenFile()) {
276 PPB_FileRef_CreateInfo cur_create_info; 276 PPB_FileRef_CreateInfo cur_create_info;
277 file_ref_proxy->SerializeFileRef(cur_file_resource, &cur_create_info); 277 file_ref_proxy->SerializeFileRef(cur_file_resource, &cur_create_info);
278 files.push_back(cur_create_info); 278 files.push_back(cur_create_info);
279 } 279 }
280 } 280 }
281 281
282 dispatcher()->Send(new PpapiMsg_PPBFileChooser_ChooseComplete( 282 dispatcher()->Send(new PpapiMsg_PPBFileChooser_ChooseComplete(
283 INTERFACE_ID_PPB_FILE_CHOOSER, chooser, result, files)); 283 API_ID_PPB_FILE_CHOOSER, chooser, result, files));
284 } 284 }
285 285
286 } // namespace proxy 286 } // namespace proxy
287 } // namespace ppapi 287 } // namespace ppapi
OLDNEW
« no previous file with comments | « ppapi/proxy/ppb_file_chooser_proxy.h ('k') | ppapi/proxy/ppb_file_ref_proxy.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698