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 13 matching lines...) Expand all Loading... |
24 URLDataManager::AddWebUIDataSource(browser_context, source); | 24 URLDataManager::AddWebUIDataSource(browser_context, source); |
25 } | 25 } |
26 | 26 |
27 // Internal class to hide the fact that WebUIDataSourceImpl implements | 27 // Internal class to hide the fact that WebUIDataSourceImpl implements |
28 // URLDataSource. | 28 // URLDataSource. |
29 class WebUIDataSourceImpl::InternalDataSource : public URLDataSource { | 29 class WebUIDataSourceImpl::InternalDataSource : public URLDataSource { |
30 public: | 30 public: |
31 InternalDataSource(WebUIDataSourceImpl* parent) : parent_(parent) { | 31 InternalDataSource(WebUIDataSourceImpl* parent) : parent_(parent) { |
32 } | 32 } |
33 | 33 |
34 ~InternalDataSource() { | 34 virtual ~InternalDataSource() { |
35 } | 35 } |
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( |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
207 } | 207 } |
208 | 208 |
209 void WebUIDataSourceImpl::SendFromResourceBundle( | 209 void WebUIDataSourceImpl::SendFromResourceBundle( |
210 const URLDataSource::GotDataCallback& callback, int idr) { | 210 const URLDataSource::GotDataCallback& callback, int idr) { |
211 scoped_refptr<base::RefCountedStaticMemory> response( | 211 scoped_refptr<base::RefCountedStaticMemory> response( |
212 GetContentClient()->GetDataResourceBytes(idr)); | 212 GetContentClient()->GetDataResourceBytes(idr)); |
213 callback.Run(response); | 213 callback.Run(response); |
214 } | 214 } |
215 | 215 |
216 } // namespace content | 216 } // namespace content |
OLD | NEW |