OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/glue/plugins/pepper_file_chooser.h" | 5 #include "webkit/glue/plugins/pepper_file_chooser.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 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 } | 112 } |
113 | 113 |
114 FileChooser::~FileChooser() { | 114 FileChooser::~FileChooser() { |
115 } | 115 } |
116 | 116 |
117 // static | 117 // static |
118 const PPB_FileChooser_Dev* FileChooser::GetInterface() { | 118 const PPB_FileChooser_Dev* FileChooser::GetInterface() { |
119 return &ppb_filechooser; | 119 return &ppb_filechooser; |
120 } | 120 } |
121 | 121 |
| 122 FileChooser* FileChooser::AsFileChooser() { |
| 123 return this; |
| 124 } |
| 125 |
122 void FileChooser::StoreChosenFiles(const std::vector<std::string>& files) { | 126 void FileChooser::StoreChosenFiles(const std::vector<std::string>& files) { |
123 next_chosen_file_index_ = 0; | 127 next_chosen_file_index_ = 0; |
124 std::vector<std::string>::const_iterator end_it = files.end(); | 128 std::vector<std::string>::const_iterator end_it = files.end(); |
125 for (std::vector<std::string>::const_iterator it = files.begin(); | 129 for (std::vector<std::string>::const_iterator it = files.begin(); |
126 it != end_it; it++) { | 130 it != end_it; it++) { |
127 chosen_files_.push_back(make_scoped_refptr( | 131 chosen_files_.push_back(make_scoped_refptr( |
128 new FileRef(module(), FilePath().AppendASCII(*it)))); | 132 new FileRef(module(), FilePath().AppendASCII(*it)))); |
129 } | 133 } |
130 | 134 |
131 if (!completion_callback_.func) | 135 if (!completion_callback_.func) |
(...skipping 20 matching lines...) Expand all Loading... |
152 } | 156 } |
153 | 157 |
154 scoped_refptr<FileRef> FileChooser::GetNextChosenFile() { | 158 scoped_refptr<FileRef> FileChooser::GetNextChosenFile() { |
155 if (next_chosen_file_index_ >= chosen_files_.size()) | 159 if (next_chosen_file_index_ >= chosen_files_.size()) |
156 return NULL; | 160 return NULL; |
157 | 161 |
158 return chosen_files_[next_chosen_file_index_++]; | 162 return chosen_files_[next_chosen_file_index_++]; |
159 } | 163 } |
160 | 164 |
161 } // namespace pepper | 165 } // namespace pepper |
OLD | NEW |