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 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 next_chosen_file_index_ = 0; | 103 next_chosen_file_index_ = 0; |
104 for (std::vector<std::string>::const_iterator it = files.begin(); | 104 for (std::vector<std::string>::const_iterator it = files.begin(); |
105 it != files.end(); ++it) { | 105 it != files.end(); ++it) { |
106 #if defined(OS_WIN) | 106 #if defined(OS_WIN) |
107 FilePath file_path(base::SysUTF8ToWide(*it)); | 107 FilePath file_path(base::SysUTF8ToWide(*it)); |
108 #else | 108 #else |
109 FilePath file_path(*it); | 109 FilePath file_path(*it); |
110 #endif | 110 #endif |
111 | 111 |
112 chosen_files_.push_back(make_scoped_refptr( | 112 chosen_files_.push_back(make_scoped_refptr( |
113 new PPB_FileRef_Impl(pp_instance(), file_path))); | 113 PPB_FileRef_Impl::CreateExternal(pp_instance(), file_path))); |
114 } | 114 } |
115 | 115 |
116 RunCallback((chosen_files_.size() > 0) ? PP_OK : PP_ERROR_USERCANCEL); | 116 RunCallback((chosen_files_.size() > 0) ? PP_OK : PP_ERROR_USERCANCEL); |
117 } | 117 } |
118 | 118 |
119 int32_t PPB_FileChooser_Impl::ValidateCallback( | 119 int32_t PPB_FileChooser_Impl::ValidateCallback( |
120 const PP_CompletionCallback& callback) { | 120 const PP_CompletionCallback& callback) { |
121 // We only support non-blocking calls. | 121 // We only support non-blocking calls. |
122 if (!callback.func) | 122 if (!callback.func) |
123 return PP_ERROR_BADARGUMENT; | 123 return PP_ERROR_BADARGUMENT; |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 | 167 |
168 PP_Resource PPB_FileChooser_Impl::GetNextChosenFile() { | 168 PP_Resource PPB_FileChooser_Impl::GetNextChosenFile() { |
169 if (next_chosen_file_index_ >= chosen_files_.size()) | 169 if (next_chosen_file_index_ >= chosen_files_.size()) |
170 return 0; | 170 return 0; |
171 | 171 |
172 return chosen_files_[next_chosen_file_index_++]->GetReference(); | 172 return chosen_files_[next_chosen_file_index_++]->GetReference(); |
173 } | 173 } |
174 | 174 |
175 } // namespace ppapi | 175 } // namespace ppapi |
176 } // namespace webkit | 176 } // namespace webkit |
OLD | NEW |