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

Side by Side Diff: content/renderer/pepper/pepper_file_chooser_host.cc

Issue 16256018: Update content/ to use WeakPtr<T>::get() instead of implicit "operator T*" (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix incorrectly modified code Created 7 years, 6 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "content/renderer/pepper/pepper_file_chooser_host.h" 5 #include "content/renderer/pepper/pepper_file_chooser_host.h"
6 6
7 #include "base/files/file_path.h" 7 #include "base/files/file_path.h"
8 #include "base/utf_string_conversions.h" 8 #include "base/utf_string_conversions.h"
9 #include "content/public/renderer/renderer_ppapi_host.h" 9 #include "content/public/renderer/renderer_ppapi_host.h"
10 #include "content/renderer/render_view_impl.h" 10 #include "content/renderer/render_view_impl.h"
(...skipping 15 matching lines...) Expand all
26 : public WebKit::WebFileChooserCompletion { 26 : public WebKit::WebFileChooserCompletion {
27 public: 27 public:
28 CompletionHandler(const base::WeakPtr<PepperFileChooserHost>& host) 28 CompletionHandler(const base::WeakPtr<PepperFileChooserHost>& host)
29 : host_(host) { 29 : host_(host) {
30 } 30 }
31 31
32 virtual ~CompletionHandler() {} 32 virtual ~CompletionHandler() {}
33 33
34 virtual void didChooseFile( 34 virtual void didChooseFile(
35 const WebKit::WebVector<WebKit::WebString>& file_names) { 35 const WebKit::WebVector<WebKit::WebString>& file_names) {
36 if (host_) { 36 if (host_.get()) {
37 std::vector<PepperFileChooserHost::ChosenFileInfo> files; 37 std::vector<PepperFileChooserHost::ChosenFileInfo> files;
38 for (size_t i = 0; i < file_names.size(); i++) { 38 for (size_t i = 0; i < file_names.size(); i++) {
39 files.push_back(PepperFileChooserHost::ChosenFileInfo( 39 files.push_back(PepperFileChooserHost::ChosenFileInfo(
40 file_names[i].utf8(), std::string())); 40 file_names[i].utf8(), std::string()));
41 } 41 }
42 host_->StoreChosenFiles(files); 42 host_->StoreChosenFiles(files);
43 } 43 }
44 44
45 // It is the responsibility of this method to delete the instance. 45 // It is the responsibility of this method to delete the instance.
46 delete this; 46 delete this;
47 } 47 }
48 virtual void didChooseFile( 48 virtual void didChooseFile(
49 const WebKit::WebVector<SelectedFileInfo>& file_names) { 49 const WebKit::WebVector<SelectedFileInfo>& file_names) {
50 if (host_) { 50 if (host_.get()) {
51 std::vector<PepperFileChooserHost::ChosenFileInfo> files; 51 std::vector<PepperFileChooserHost::ChosenFileInfo> files;
52 for (size_t i = 0; i < file_names.size(); i++) { 52 for (size_t i = 0; i < file_names.size(); i++) {
53 files.push_back(PepperFileChooserHost::ChosenFileInfo( 53 files.push_back(PepperFileChooserHost::ChosenFileInfo(
54 file_names[i].path.utf8(), 54 file_names[i].path.utf8(),
55 file_names[i].displayName.utf8())); 55 file_names[i].displayName.utf8()));
56 } 56 }
57 host_->StoreChosenFiles(files); 57 host_->StoreChosenFiles(files);
58 } 58 }
59 59
60 // It is the responsibility of this method to delete the instance. 60 // It is the responsibility of this method to delete the instance.
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 handler_ = NULL; 163 handler_ = NULL;
164 return PP_ERROR_NOACCESS; 164 return PP_ERROR_NOACCESS;
165 } 165 }
166 166
167 reply_context_ = context->MakeReplyMessageContext(); 167 reply_context_ = context->MakeReplyMessageContext();
168 return PP_OK_COMPLETIONPENDING; 168 return PP_OK_COMPLETIONPENDING;
169 } 169 }
170 170
171 } // namespace content 171 } // namespace content
172 172
OLDNEW
« no previous file with comments | « content/renderer/pepper/pepper_broker_impl.cc ('k') | content/renderer/pepper/pepper_platform_audio_input_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698