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

Side by Side Diff: webkit/glue/plugins/pepper_file_chooser.cc

Issue 4310002: Make PPAPI headers compile with C compilers (gcc on Linux & Mac and MSVS on W... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 years, 1 month 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 | « webkit/glue/plugins/pepper_event_conversion.cc ('k') | webkit/glue/plugins/pepper_file_io.cc » ('j') | 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) 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"
11 #include "ppapi/c/pp_completion_callback.h" 11 #include "ppapi/c/pp_completion_callback.h"
12 #include "ppapi/c/pp_errors.h" 12 #include "ppapi/c/pp_errors.h"
13 #include "third_party/WebKit/WebKit/chromium/public/WebCString.h" 13 #include "third_party/WebKit/WebKit/chromium/public/WebCString.h"
14 #include "third_party/WebKit/WebKit/chromium/public/WebFileChooserCompletion.h" 14 #include "third_party/WebKit/WebKit/chromium/public/WebFileChooserCompletion.h"
15 #include "third_party/WebKit/WebKit/chromium/public/WebFileChooserParams.h" 15 #include "third_party/WebKit/WebKit/chromium/public/WebFileChooserParams.h"
16 #include "third_party/WebKit/WebKit/chromium/public/WebString.h" 16 #include "third_party/WebKit/WebKit/chromium/public/WebString.h"
17 #include "third_party/WebKit/WebKit/chromium/public/WebVector.h" 17 #include "third_party/WebKit/WebKit/chromium/public/WebVector.h"
18 #include "webkit/glue/plugins/pepper_common.h"
18 #include "webkit/glue/plugins/pepper_file_ref.h" 19 #include "webkit/glue/plugins/pepper_file_ref.h"
19 #include "webkit/glue/plugins/pepper_plugin_delegate.h" 20 #include "webkit/glue/plugins/pepper_plugin_delegate.h"
20 #include "webkit/glue/plugins/pepper_plugin_instance.h" 21 #include "webkit/glue/plugins/pepper_plugin_instance.h"
21 #include "webkit/glue/plugins/pepper_resource_tracker.h" 22 #include "webkit/glue/plugins/pepper_resource_tracker.h"
22 #include "webkit/glue/webkit_glue.h" 23 #include "webkit/glue/webkit_glue.h"
23 24
24 using WebKit::WebCString; 25 using WebKit::WebCString;
25 using WebKit::WebFileChooserCompletion; 26 using WebKit::WebFileChooserCompletion;
26 using WebKit::WebFileChooserParams; 27 using WebKit::WebFileChooserParams;
27 using WebKit::WebString; 28 using WebKit::WebString;
28 using WebKit::WebVector; 29 using WebKit::WebVector;
29 30
30 namespace pepper { 31 namespace pepper {
31 32
32 namespace { 33 namespace {
33 34
34 PP_Resource Create(PP_Instance instance_id, 35 PP_Resource Create(PP_Instance instance_id,
35 const PP_FileChooserOptions_Dev* options) { 36 const PP_FileChooserOptions_Dev* options) {
36 PluginInstance* instance = ResourceTracker::Get()->GetInstance(instance_id); 37 PluginInstance* instance = ResourceTracker::Get()->GetInstance(instance_id);
37 if (!instance) 38 if (!instance)
38 return 0; 39 return 0;
39 40
40 FileChooser* chooser = new FileChooser(instance, options); 41 FileChooser* chooser = new FileChooser(instance, options);
41 return chooser->GetReference(); 42 return chooser->GetReference();
42 } 43 }
43 44
44 bool IsFileChooser(PP_Resource resource) { 45 PP_Bool IsFileChooser(PP_Resource resource) {
45 return !!Resource::GetAs<FileChooser>(resource); 46 return BoolToPPBool(!!Resource::GetAs<FileChooser>(resource));
46 } 47 }
47 48
48 int32_t Show(PP_Resource chooser_id, PP_CompletionCallback callback) { 49 int32_t Show(PP_Resource chooser_id, PP_CompletionCallback callback) {
49 scoped_refptr<FileChooser> chooser( 50 scoped_refptr<FileChooser> chooser(
50 Resource::GetAs<FileChooser>(chooser_id)); 51 Resource::GetAs<FileChooser>(chooser_id));
51 if (!chooser) 52 if (!chooser)
52 return PP_ERROR_BADRESOURCE; 53 return PP_ERROR_BADRESOURCE;
53 54
54 return chooser->Show(callback); 55 return chooser->Show(callback);
55 } 56 }
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 } 148 }
148 149
149 scoped_refptr<FileRef> FileChooser::GetNextChosenFile() { 150 scoped_refptr<FileRef> FileChooser::GetNextChosenFile() {
150 if (next_chosen_file_index_ >= chosen_files_.size()) 151 if (next_chosen_file_index_ >= chosen_files_.size())
151 return NULL; 152 return NULL;
152 153
153 return chosen_files_[next_chosen_file_index_++]; 154 return chosen_files_[next_chosen_file_index_++];
154 } 155 }
155 156
156 } // namespace pepper 157 } // namespace pepper
OLDNEW
« no previous file with comments | « webkit/glue/plugins/pepper_event_conversion.cc ('k') | webkit/glue/plugins/pepper_file_io.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698