OLD | NEW |
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/browser/webui/web_ui_data_source_impl.h" | 5 #include "content/browser/webui/web_ui_data_source_impl.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/memory/ref_counted_memory.h" | 10 #include "base/memory/ref_counted_memory.h" |
(...skipping 25 matching lines...) Expand all Loading... |
36 | 36 |
37 // URLDataSource implementation. | 37 // URLDataSource implementation. |
38 virtual std::string GetSource() OVERRIDE { | 38 virtual std::string GetSource() OVERRIDE { |
39 return parent_->GetSource(); | 39 return parent_->GetSource(); |
40 } | 40 } |
41 virtual std::string GetMimeType(const std::string& path) const OVERRIDE { | 41 virtual std::string GetMimeType(const std::string& path) const OVERRIDE { |
42 return parent_->GetMimeType(path); | 42 return parent_->GetMimeType(path); |
43 } | 43 } |
44 virtual void StartDataRequest( | 44 virtual void StartDataRequest( |
45 const std::string& path, | 45 const std::string& path, |
46 bool is_incognito, | 46 int render_process_id, |
| 47 int render_view_id, |
47 const URLDataSource::GotDataCallback& callback) OVERRIDE { | 48 const URLDataSource::GotDataCallback& callback) OVERRIDE { |
48 return parent_->StartDataRequest(path, is_incognito, callback); | 49 return parent_->StartDataRequest(path, render_process_id, render_view_id, |
| 50 callback); |
49 } | 51 } |
50 virtual bool ShouldAddContentSecurityPolicy() const OVERRIDE { | 52 virtual bool ShouldAddContentSecurityPolicy() const OVERRIDE { |
51 return parent_->add_csp_; | 53 return parent_->add_csp_; |
52 } | 54 } |
53 virtual std::string GetContentSecurityPolicyObjectSrc() const OVERRIDE { | 55 virtual std::string GetContentSecurityPolicyObjectSrc() const OVERRIDE { |
54 if (parent_->object_src_set_) | 56 if (parent_->object_src_set_) |
55 return parent_->object_src_; | 57 return parent_->object_src_; |
56 return URLDataSource::GetContentSecurityPolicyObjectSrc(); | 58 return URLDataSource::GetContentSecurityPolicyObjectSrc(); |
57 } | 59 } |
58 virtual std::string GetContentSecurityPolicyFrameSrc() const OVERRIDE { | 60 virtual std::string GetContentSecurityPolicyFrameSrc() const OVERRIDE { |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 return "application/json"; | 166 return "application/json"; |
165 | 167 |
166 if (EndsWith(path, ".pdf", false)) | 168 if (EndsWith(path, ".pdf", false)) |
167 return "application/pdf"; | 169 return "application/pdf"; |
168 | 170 |
169 return "text/html"; | 171 return "text/html"; |
170 } | 172 } |
171 | 173 |
172 void WebUIDataSourceImpl::StartDataRequest( | 174 void WebUIDataSourceImpl::StartDataRequest( |
173 const std::string& path, | 175 const std::string& path, |
174 bool is_incognito, | 176 int render_process_id, |
| 177 int render_view_id, |
175 const URLDataSource::GotDataCallback& callback) { | 178 const URLDataSource::GotDataCallback& callback) { |
176 if (!filter_callback_.is_null() && | 179 if (!filter_callback_.is_null() && |
177 filter_callback_.Run(path, callback)) { | 180 filter_callback_.Run(path, callback)) { |
178 return; | 181 return; |
179 } | 182 } |
180 | 183 |
181 if (!json_path_.empty() && path == json_path_) { | 184 if (!json_path_.empty() && path == json_path_) { |
182 SendLocalizedStringsAsJSON(callback); | 185 SendLocalizedStringsAsJSON(callback); |
183 return; | 186 return; |
184 } | 187 } |
(...skipping 22 matching lines...) Expand all Loading... |
207 } | 210 } |
208 | 211 |
209 void WebUIDataSourceImpl::SendFromResourceBundle( | 212 void WebUIDataSourceImpl::SendFromResourceBundle( |
210 const URLDataSource::GotDataCallback& callback, int idr) { | 213 const URLDataSource::GotDataCallback& callback, int idr) { |
211 scoped_refptr<base::RefCountedStaticMemory> response( | 214 scoped_refptr<base::RefCountedStaticMemory> response( |
212 GetContentClient()->GetDataResourceBytes(idr)); | 215 GetContentClient()->GetDataResourceBytes(idr)); |
213 callback.Run(response); | 216 callback.Run(response); |
214 } | 217 } |
215 | 218 |
216 } // namespace content | 219 } // namespace content |
OLD | NEW |