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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
64 return URLDataSource::GetContentSecurityPolicyObjectSrc(); | 64 return URLDataSource::GetContentSecurityPolicyObjectSrc(); |
65 } | 65 } |
66 std::string GetContentSecurityPolicyFrameSrc() const override { | 66 std::string GetContentSecurityPolicyFrameSrc() const override { |
67 if (parent_->frame_src_set_) | 67 if (parent_->frame_src_set_) |
68 return parent_->frame_src_; | 68 return parent_->frame_src_; |
69 return URLDataSource::GetContentSecurityPolicyFrameSrc(); | 69 return URLDataSource::GetContentSecurityPolicyFrameSrc(); |
70 } | 70 } |
71 bool ShouldDenyXFrameOptions() const override { | 71 bool ShouldDenyXFrameOptions() const override { |
72 return parent_->deny_xframe_options_; | 72 return parent_->deny_xframe_options_; |
73 } | 73 } |
74 void WillServiceRequest(const net::URLRequest* request, | |
75 std::string* path) const override { | |
76 // We want to remove any query strings from the path. | |
77 *path = path->substr(0, path->find_last_of('?')); | |
Evan Stade
2015/12/18 23:15:10
I'm sure someone more knowledgeable than me has al
raymes
2016/01/04 01:56:18
Oops good catch. Thank you and I added a test to c
| |
78 } | |
74 | 79 |
75 private: | 80 private: |
76 WebUIDataSourceImpl* parent_; | 81 WebUIDataSourceImpl* parent_; |
77 }; | 82 }; |
78 | 83 |
79 WebUIDataSourceImpl::WebUIDataSourceImpl(const std::string& source_name) | 84 WebUIDataSourceImpl::WebUIDataSourceImpl(const std::string& source_name) |
80 : URLDataSourceImpl( | 85 : URLDataSourceImpl( |
81 source_name, | 86 source_name, |
82 new InternalDataSource(this)), | 87 new InternalDataSource(this)), |
83 source_name_(source_name), | 88 source_name_(source_name), |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
238 } | 243 } |
239 | 244 |
240 void WebUIDataSourceImpl::SendFromResourceBundle( | 245 void WebUIDataSourceImpl::SendFromResourceBundle( |
241 const URLDataSource::GotDataCallback& callback, int idr) { | 246 const URLDataSource::GotDataCallback& callback, int idr) { |
242 scoped_refptr<base::RefCountedStaticMemory> response( | 247 scoped_refptr<base::RefCountedStaticMemory> response( |
243 GetContentClient()->GetDataResourceBytes(idr)); | 248 GetContentClient()->GetDataResourceBytes(idr)); |
244 callback.Run(response.get()); | 249 callback.Run(response.get()); |
245 } | 250 } |
246 | 251 |
247 } // namespace content | 252 } // namespace content |
OLD | NEW |