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