OLD | NEW |
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" |
11 #include "ppapi/c/pp_errors.h" | 11 #include "ppapi/c/pp_errors.h" |
12 #include "ppapi/c/private/ppb_proxy_private.h" | 12 #include "ppapi/c/private/ppb_proxy_private.h" |
13 #include "ppapi/c/trusted/ppb_file_chooser_trusted.h" | 13 #include "ppapi/c/trusted/ppb_file_chooser_trusted.h" |
14 #include "ppapi/proxy/enter_proxy.h" | 14 #include "ppapi/proxy/enter_proxy.h" |
15 #include "ppapi/proxy/host_dispatcher.h" | 15 #include "ppapi/proxy/host_dispatcher.h" |
16 #include "ppapi/proxy/plugin_dispatcher.h" | 16 #include "ppapi/proxy/plugin_dispatcher.h" |
17 #include "ppapi/proxy/ppapi_messages.h" | 17 #include "ppapi/proxy/ppapi_messages.h" |
18 #include "ppapi/proxy/ppb_file_ref_proxy.h" | 18 #include "ppapi/proxy/ppb_file_ref_proxy.h" |
19 #include "ppapi/proxy/serialized_var.h" | 19 #include "ppapi/proxy/serialized_var.h" |
20 #include "ppapi/shared_impl/ppapi_globals.h" | |
21 #include "ppapi/shared_impl/resource_tracker.h" | |
22 #include "ppapi/shared_impl/var.h" | 20 #include "ppapi/shared_impl/var.h" |
23 #include "ppapi/thunk/resource_creation_api.h" | 21 #include "ppapi/thunk/resource_creation_api.h" |
24 #include "ppapi/thunk/thunk.h" | 22 #include "ppapi/thunk/thunk.h" |
25 | 23 |
26 using ppapi::thunk::PPB_FileChooser_API; | 24 using ppapi::thunk::PPB_FileChooser_API; |
27 | 25 |
28 namespace ppapi { | 26 namespace ppapi { |
29 namespace proxy { | 27 namespace proxy { |
30 | 28 |
31 namespace { | 29 namespace { |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 if (current_show_callback_.func) { | 80 if (current_show_callback_.func) { |
83 // TODO(brettw) the callbacks at this level should be refactored with a | 81 // TODO(brettw) the callbacks at this level should be refactored with a |
84 // more automatic tracking system like we have in the renderer. | 82 // more automatic tracking system like we have in the renderer. |
85 MessageLoop::current()->PostTask(FROM_HERE, base::Bind( | 83 MessageLoop::current()->PostTask(FROM_HERE, base::Bind( |
86 current_show_callback_.func, current_show_callback_.user_data, | 84 current_show_callback_.func, current_show_callback_.user_data, |
87 static_cast<int32_t>(PP_ERROR_ABORTED))); | 85 static_cast<int32_t>(PP_ERROR_ABORTED))); |
88 } | 86 } |
89 | 87 |
90 // Any existing files we haven't transferred ownership to the plugin need | 88 // Any existing files we haven't transferred ownership to the plugin need |
91 // to be freed. | 89 // to be freed. |
92 ResourceTracker* tracker = PpapiGlobals::Get()->GetResourceTracker(); | 90 PluginResourceTracker* tracker = PluginResourceTracker::GetInstance(); |
93 while (!file_queue_.empty()) { | 91 while (!file_queue_.empty()) { |
94 tracker->ReleaseResource(file_queue_.front()); | 92 tracker->ReleaseResource(file_queue_.front()); |
95 file_queue_.pop(); | 93 file_queue_.pop(); |
96 } | 94 } |
97 } | 95 } |
98 | 96 |
99 PPB_FileChooser_API* FileChooser::AsPPB_FileChooser_API() { | 97 PPB_FileChooser_API* FileChooser::AsPPB_FileChooser_API() { |
100 return this; | 98 return this; |
101 } | 99 } |
102 | 100 |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
278 files.push_back(cur_create_info); | 276 files.push_back(cur_create_info); |
279 } | 277 } |
280 } | 278 } |
281 | 279 |
282 dispatcher()->Send(new PpapiMsg_PPBFileChooser_ChooseComplete( | 280 dispatcher()->Send(new PpapiMsg_PPBFileChooser_ChooseComplete( |
283 INTERFACE_ID_PPB_FILE_CHOOSER, chooser, result, files)); | 281 INTERFACE_ID_PPB_FILE_CHOOSER, chooser, result, files)); |
284 } | 282 } |
285 | 283 |
286 } // namespace proxy | 284 } // namespace proxy |
287 } // namespace ppapi | 285 } // namespace ppapi |
OLD | NEW |