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

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

Issue 7706021: Convert FileRefImpl and URLRequestInfo to shared_impl. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Tests fixed Created 9 years, 3 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) 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_url_response_info_impl.h" 5 #include "webkit/plugins/ppapi/ppb_url_response_info_impl.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "ppapi/c/pp_var.h" 8 #include "ppapi/c/pp_var.h"
9 #include "ppapi/shared_impl/var.h" 9 #include "ppapi/shared_impl/var.h"
10 #include "third_party/WebKit/Source/WebKit/chromium/public/WebHTTPHeaderVisitor. h" 10 #include "third_party/WebKit/Source/WebKit/chromium/public/WebHTTPHeaderVisitor. h"
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 redirect_url_ = response.httpHeaderField( 67 redirect_url_ = response.httpHeaderField(
68 WebString::fromUTF8("Location")).utf8(); 68 WebString::fromUTF8("Location")).utf8();
69 } 69 }
70 70
71 HeaderFlattener flattener; 71 HeaderFlattener flattener;
72 response.visitHTTPHeaderFields(&flattener); 72 response.visitHTTPHeaderFields(&flattener);
73 headers_ = flattener.buffer(); 73 headers_ = flattener.buffer();
74 74
75 WebString file_path = response.downloadFilePath(); 75 WebString file_path = response.downloadFilePath();
76 if (!file_path.isEmpty()) { 76 if (!file_path.isEmpty()) {
77 body_ = new PPB_FileRef_Impl(pp_instance(), 77 body_ = PPB_FileRef_Impl::CreateExternal(
78 webkit_glue::WebStringToFilePath(file_path)); 78 pp_instance(), webkit_glue::WebStringToFilePath(file_path));
79 } 79 }
80 return true; 80 return true;
81 } 81 }
82 82
83 PPB_URLResponseInfo_API* PPB_URLResponseInfo_Impl::AsPPB_URLResponseInfo_API() { 83 PPB_URLResponseInfo_API* PPB_URLResponseInfo_Impl::AsPPB_URLResponseInfo_API() {
84 return this; 84 return this;
85 } 85 }
86 86
87 PP_Var PPB_URLResponseInfo_Impl::GetProperty(PP_URLResponseProperty property) { 87 PP_Var PPB_URLResponseInfo_Impl::GetProperty(PP_URLResponseProperty property) {
88 PluginModule* plugin_module = ResourceHelper::GetPluginModule(this); 88 PluginModule* plugin_module = ResourceHelper::GetPluginModule(this);
(...skipping 18 matching lines...) Expand all
107 case PP_URLRESPONSEPROPERTY_HEADERS: 107 case PP_URLRESPONSEPROPERTY_HEADERS:
108 return StringVar::StringToPPVar(pp_module, headers_); 108 return StringVar::StringToPPVar(pp_module, headers_);
109 } 109 }
110 // The default is to return an undefined PP_Var. 110 // The default is to return an undefined PP_Var.
111 return PP_MakeUndefined(); 111 return PP_MakeUndefined();
112 } 112 }
113 113
114 PP_Resource PPB_URLResponseInfo_Impl::GetBodyAsFileRef() { 114 PP_Resource PPB_URLResponseInfo_Impl::GetBodyAsFileRef() {
115 if (!body_.get()) 115 if (!body_.get())
116 return 0; 116 return 0;
117 body_->AddRef(); // AddRef for the caller.
118 return body_->GetReference(); 117 return body_->GetReference();
119 } 118 }
120 119
121 } // namespace ppapi 120 } // namespace ppapi
122 } // namespace webkit 121 } // namespace webkit
123 122
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698