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 "chrome/browser/ui/webui/chrome_web_ui_data_source.h" | 5 #include "chrome/browser/ui/webui/chrome_web_ui_data_source.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" |
11 #include "base/string_util.h" | 11 #include "base/string_util.h" |
12 #include "chrome/browser/ui/webui/web_ui_util.h" | 12 #include "chrome/browser/ui/webui/web_ui_util.h" |
13 #include "chrome/common/jstemplate_builder.h" | |
14 #include "ui/base/l10n/l10n_util.h" | 13 #include "ui/base/l10n/l10n_util.h" |
15 #include "ui/base/resource/resource_bundle.h" | 14 #include "ui/base/resource/resource_bundle.h" |
| 15 #include "ui/webui/jstemplate_builder.h" |
16 | 16 |
17 // Internal class to hide the fact that ChromeWebUIDataSource implements | 17 // Internal class to hide the fact that ChromeWebUIDataSource implements |
18 // content::URLDataSource. | 18 // content::URLDataSource. |
19 class ChromeWebUIDataSource::InternalDataSource | 19 class ChromeWebUIDataSource::InternalDataSource |
20 : public content::URLDataSource { | 20 : public content::URLDataSource { |
21 public: | 21 public: |
22 InternalDataSource(ChromeWebUIDataSource* parent) : parent_(parent) { | 22 InternalDataSource(ChromeWebUIDataSource* parent) : parent_(parent) { |
23 } | 23 } |
24 | 24 |
25 ~InternalDataSource() { | 25 ~InternalDataSource() { |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 callback.Run(base::RefCountedString::TakeString(&template_data)); | 133 callback.Run(base::RefCountedString::TakeString(&template_data)); |
134 } | 134 } |
135 | 135 |
136 void ChromeWebUIDataSource::SendFromResourceBundle( | 136 void ChromeWebUIDataSource::SendFromResourceBundle( |
137 const content::URLDataSource::GotDataCallback& callback, int idr) { | 137 const content::URLDataSource::GotDataCallback& callback, int idr) { |
138 scoped_refptr<base::RefCountedStaticMemory> response( | 138 scoped_refptr<base::RefCountedStaticMemory> response( |
139 ResourceBundle::GetSharedInstance().LoadDataResourceBytes( | 139 ResourceBundle::GetSharedInstance().LoadDataResourceBytes( |
140 idr)); | 140 idr)); |
141 callback.Run(response); | 141 callback.Run(response); |
142 } | 142 } |
OLD | NEW |