| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 | 66 |
| 67 // All files returned by the current show callback that haven't yet been | 67 // All files returned by the current show callback that haven't yet been |
| 68 // given to the plugin. The plugin will repeatedly call us to get the next | 68 // given to the plugin. The plugin will repeatedly call us to get the next |
| 69 // file, and we'll vend those out of this queue, removing them when ownership | 69 // file, and we'll vend those out of this queue, removing them when ownership |
| 70 // has transferred to the plugin. | 70 // has transferred to the plugin. |
| 71 std::queue<PP_Resource> file_queue_; | 71 std::queue<PP_Resource> file_queue_; |
| 72 | 72 |
| 73 DISALLOW_COPY_AND_ASSIGN(FileChooser); | 73 DISALLOW_COPY_AND_ASSIGN(FileChooser); |
| 74 }; | 74 }; |
| 75 | 75 |
| 76 FileChooser::FileChooser(const HostResource& resource) : Resource(resource) { | 76 FileChooser::FileChooser(const HostResource& resource) |
| 77 : Resource(OBJECT_IS_PROXY, resource) { |
| 77 } | 78 } |
| 78 | 79 |
| 79 FileChooser::~FileChooser() { | 80 FileChooser::~FileChooser() { |
| 80 // Any existing files we haven't transferred ownership to the plugin need | 81 // Any existing files we haven't transferred ownership to the plugin need |
| 81 // to be freed. | 82 // to be freed. |
| 82 ResourceTracker* tracker = PpapiGlobals::Get()->GetResourceTracker(); | 83 ResourceTracker* tracker = PpapiGlobals::Get()->GetResourceTracker(); |
| 83 while (!file_queue_.empty()) { | 84 while (!file_queue_.empty()) { |
| 84 tracker->ReleaseResource(file_queue_.front()); | 85 tracker->ReleaseResource(file_queue_.front()); |
| 85 file_queue_.pop(); | 86 file_queue_.pop(); |
| 86 } | 87 } |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 268 files.push_back(cur_create_info); | 269 files.push_back(cur_create_info); |
| 269 } | 270 } |
| 270 } | 271 } |
| 271 | 272 |
| 272 dispatcher()->Send(new PpapiMsg_PPBFileChooser_ChooseComplete( | 273 dispatcher()->Send(new PpapiMsg_PPBFileChooser_ChooseComplete( |
| 273 API_ID_PPB_FILE_CHOOSER, chooser, result, files)); | 274 API_ID_PPB_FILE_CHOOSER, chooser, result, files)); |
| 274 } | 275 } |
| 275 | 276 |
| 276 } // namespace proxy | 277 } // namespace proxy |
| 277 } // namespace ppapi | 278 } // namespace ppapi |
| OLD | NEW |