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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 // URLDataSource. | 56 // URLDataSource. |
57 class WebUIDataSourceImpl::InternalDataSource : public URLDataSource { | 57 class WebUIDataSourceImpl::InternalDataSource : public URLDataSource { |
58 public: | 58 public: |
59 InternalDataSource(WebUIDataSourceImpl* parent) : parent_(parent) { | 59 InternalDataSource(WebUIDataSourceImpl* parent) : parent_(parent) { |
60 } | 60 } |
61 | 61 |
62 virtual ~InternalDataSource() { | 62 virtual ~InternalDataSource() { |
63 } | 63 } |
64 | 64 |
65 // URLDataSource implementation. | 65 // URLDataSource implementation. |
66 virtual std::string GetSource() const OVERRIDE { | 66 virtual std::string GetSource() const override { |
67 return parent_->GetSource(); | 67 return parent_->GetSource(); |
68 } | 68 } |
69 virtual std::string GetMimeType(const std::string& path) const OVERRIDE { | 69 virtual std::string GetMimeType(const std::string& path) const override { |
70 return parent_->GetMimeType(path); | 70 return parent_->GetMimeType(path); |
71 } | 71 } |
72 virtual void StartDataRequest( | 72 virtual void StartDataRequest( |
73 const std::string& path, | 73 const std::string& path, |
74 int render_process_id, | 74 int render_process_id, |
75 int render_frame_id, | 75 int render_frame_id, |
76 const URLDataSource::GotDataCallback& callback) OVERRIDE { | 76 const URLDataSource::GotDataCallback& callback) override { |
77 return parent_->StartDataRequest(path, render_process_id, render_frame_id, | 77 return parent_->StartDataRequest(path, render_process_id, render_frame_id, |
78 callback); | 78 callback); |
79 } | 79 } |
80 virtual bool ShouldReplaceExistingSource() const OVERRIDE { | 80 virtual bool ShouldReplaceExistingSource() const override { |
81 return parent_->replace_existing_source_; | 81 return parent_->replace_existing_source_; |
82 } | 82 } |
83 virtual bool AllowCaching() const OVERRIDE { | 83 virtual bool AllowCaching() const override { |
84 return false; | 84 return false; |
85 } | 85 } |
86 virtual bool ShouldAddContentSecurityPolicy() const OVERRIDE { | 86 virtual bool ShouldAddContentSecurityPolicy() const override { |
87 return parent_->add_csp_; | 87 return parent_->add_csp_; |
88 } | 88 } |
89 virtual std::string GetContentSecurityPolicyObjectSrc() const OVERRIDE { | 89 virtual std::string GetContentSecurityPolicyObjectSrc() const override { |
90 if (parent_->object_src_set_) | 90 if (parent_->object_src_set_) |
91 return parent_->object_src_; | 91 return parent_->object_src_; |
92 return URLDataSource::GetContentSecurityPolicyObjectSrc(); | 92 return URLDataSource::GetContentSecurityPolicyObjectSrc(); |
93 } | 93 } |
94 virtual std::string GetContentSecurityPolicyFrameSrc() const OVERRIDE { | 94 virtual std::string GetContentSecurityPolicyFrameSrc() const override { |
95 if (parent_->frame_src_set_) | 95 if (parent_->frame_src_set_) |
96 return parent_->frame_src_; | 96 return parent_->frame_src_; |
97 return URLDataSource::GetContentSecurityPolicyFrameSrc(); | 97 return URLDataSource::GetContentSecurityPolicyFrameSrc(); |
98 } | 98 } |
99 virtual bool ShouldDenyXFrameOptions() const OVERRIDE { | 99 virtual bool ShouldDenyXFrameOptions() const override { |
100 return parent_->deny_xframe_options_; | 100 return parent_->deny_xframe_options_; |
101 } | 101 } |
102 | 102 |
103 private: | 103 private: |
104 WebUIDataSourceImpl* parent_; | 104 WebUIDataSourceImpl* parent_; |
105 }; | 105 }; |
106 | 106 |
107 WebUIDataSourceImpl::WebUIDataSourceImpl(const std::string& source_name) | 107 WebUIDataSourceImpl::WebUIDataSourceImpl(const std::string& source_name) |
108 : URLDataSourceImpl( | 108 : URLDataSourceImpl( |
109 source_name, | 109 source_name, |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
243 } | 243 } |
244 | 244 |
245 void WebUIDataSourceImpl::SendFromResourceBundle( | 245 void WebUIDataSourceImpl::SendFromResourceBundle( |
246 const URLDataSource::GotDataCallback& callback, int idr) { | 246 const URLDataSource::GotDataCallback& callback, int idr) { |
247 scoped_refptr<base::RefCountedStaticMemory> response( | 247 scoped_refptr<base::RefCountedStaticMemory> response( |
248 GetContentClient()->GetDataResourceBytes(idr)); | 248 GetContentClient()->GetDataResourceBytes(idr)); |
249 callback.Run(response.get()); | 249 callback.Run(response.get()); |
250 } | 250 } |
251 | 251 |
252 } // namespace content | 252 } // namespace content |
OLD | NEW |