Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(130)

Side by Side Diff: webkit/plugins/ppapi/ppb_file_chooser_impl.cc

Issue 6286128: Pepper: Make PPB_FileChooser_Dev::Show "return" PP_ERROR_USERCANCEL if no file is selected. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ppapi/c/dev/ppb_file_chooser_dev.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « ppapi/c/dev/ppb_file_chooser_dev.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698