Chromium Code Reviews| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 67 return URLDataSource::GetContentSecurityPolicyObjectSrc(); | 67 return URLDataSource::GetContentSecurityPolicyObjectSrc(); |
| 68 } | 68 } |
| 69 std::string GetContentSecurityPolicyFrameSrc() const override { | 69 std::string GetContentSecurityPolicyFrameSrc() const override { |
| 70 if (parent_->frame_src_set_) | 70 if (parent_->frame_src_set_) |
| 71 return parent_->frame_src_; | 71 return parent_->frame_src_; |
| 72 return URLDataSource::GetContentSecurityPolicyFrameSrc(); | 72 return URLDataSource::GetContentSecurityPolicyFrameSrc(); |
| 73 } | 73 } |
| 74 bool ShouldDenyXFrameOptions() const override { | 74 bool ShouldDenyXFrameOptions() const override { |
| 75 return parent_->deny_xframe_options_; | 75 return parent_->deny_xframe_options_; |
| 76 } | 76 } |
| 77 void WillServiceRequest(const net::URLRequest* request, | |
| 78 std::string* path) const override { | |
| 79 // We want to remove any query strings from the path. | |
|
Primiano Tucci (use gerrit)
2016/01/04 18:50:38
The funny thing is that [1] relies on the opposite
| |
| 80 *path = path->substr(0, path->find_first_of('?')); | |
| 81 } | |
| 77 | 82 |
| 78 private: | 83 private: |
| 79 WebUIDataSourceImpl* parent_; | 84 WebUIDataSourceImpl* parent_; |
| 80 }; | 85 }; |
| 81 | 86 |
| 82 WebUIDataSourceImpl::WebUIDataSourceImpl(const std::string& source_name) | 87 WebUIDataSourceImpl::WebUIDataSourceImpl(const std::string& source_name) |
| 83 : URLDataSourceImpl( | 88 : URLDataSourceImpl( |
| 84 source_name, | 89 source_name, |
| 85 new InternalDataSource(this)), | 90 new InternalDataSource(this)), |
| 86 source_name_(source_name), | 91 source_name_(source_name), |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 241 } | 246 } |
| 242 | 247 |
| 243 void WebUIDataSourceImpl::SendFromResourceBundle( | 248 void WebUIDataSourceImpl::SendFromResourceBundle( |
| 244 const URLDataSource::GotDataCallback& callback, int idr) { | 249 const URLDataSource::GotDataCallback& callback, int idr) { |
| 245 scoped_refptr<base::RefCountedStaticMemory> response( | 250 scoped_refptr<base::RefCountedStaticMemory> response( |
| 246 GetContentClient()->GetDataResourceBytes(idr)); | 251 GetContentClient()->GetDataResourceBytes(idr)); |
| 247 callback.Run(response.get()); | 252 callback.Run(response.get()); |
| 248 } | 253 } |
| 249 | 254 |
| 250 } // namespace content | 255 } // namespace content |
| OLD | NEW |