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 "webkit/plugins/ppapi/ppb_file_chooser_impl.h" | 5 #include "webkit/plugins/ppapi/ppb_file_chooser_impl.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 #if defined(OS_WIN) | 137 #if defined(OS_WIN) |
138 FilePath file_path(base::SysUTF8ToWide(*it)); | 138 FilePath file_path(base::SysUTF8ToWide(*it)); |
139 #else | 139 #else |
140 FilePath file_path(*it); | 140 FilePath file_path(*it); |
141 #endif | 141 #endif |
142 | 142 |
143 chosen_files_.push_back(make_scoped_refptr( | 143 chosen_files_.push_back(make_scoped_refptr( |
144 new PPB_FileRef_Impl(instance(), file_path))); | 144 new PPB_FileRef_Impl(instance(), file_path))); |
145 } | 145 } |
146 | 146 |
147 RunCallback(PP_OK); | 147 RunCallback((chosen_files_.size() > 0) ? PP_OK : PP_ERROR_USERCANCEL); |
148 } | 148 } |
149 | 149 |
150 int32_t PPB_FileChooser_Impl::ValidateCallback( | 150 int32_t PPB_FileChooser_Impl::ValidateCallback( |
151 const PP_CompletionCallback& callback) { | 151 const PP_CompletionCallback& callback) { |
152 // We only support non-blocking calls. | 152 // We only support non-blocking calls. |
153 if (!callback.func) | 153 if (!callback.func) |
154 return PP_ERROR_BADARGUMENT; | 154 return PP_ERROR_BADARGUMENT; |
155 | 155 |
156 if (callback_.get() && !callback_->completed()) | 156 if (callback_.get() && !callback_->completed()) |
157 return PP_ERROR_INPROGRESS; | 157 return PP_ERROR_INPROGRESS; |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
199 | 199 |
200 scoped_refptr<PPB_FileRef_Impl> PPB_FileChooser_Impl::GetNextChosenFile() { | 200 scoped_refptr<PPB_FileRef_Impl> PPB_FileChooser_Impl::GetNextChosenFile() { |
201 if (next_chosen_file_index_ >= chosen_files_.size()) | 201 if (next_chosen_file_index_ >= chosen_files_.size()) |
202 return NULL; | 202 return NULL; |
203 | 203 |
204 return chosen_files_[next_chosen_file_index_++]; | 204 return chosen_files_[next_chosen_file_index_++]; |
205 } | 205 } |
206 | 206 |
207 } // namespace ppapi | 207 } // namespace ppapi |
208 } // namespace webkit | 208 } // namespace webkit |
OLD | NEW |