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/chromeos/system_info_ui.h" | 5 #include "chrome/browser/ui/webui/chromeos/system_info_ui.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/memory/ref_counted_memory.h" | 9 #include "base/memory/ref_counted_memory.h" |
10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
(...skipping 16 matching lines...) Expand all Loading... |
27 #include "content/public/browser/web_contents.h" | 27 #include "content/public/browser/web_contents.h" |
28 #include "content/public/browser/web_ui.h" | 28 #include "content/public/browser/web_ui.h" |
29 #include "content/public/browser/web_ui_message_handler.h" | 29 #include "content/public/browser/web_ui_message_handler.h" |
30 #include "grit/browser_resources.h" | 30 #include "grit/browser_resources.h" |
31 #include "grit/chromium_strings.h" | 31 #include "grit/chromium_strings.h" |
32 #include "grit/generated_resources.h" | 32 #include "grit/generated_resources.h" |
33 #include "grit/locale_settings.h" | 33 #include "grit/locale_settings.h" |
34 #include "net/base/directory_lister.h" | 34 #include "net/base/directory_lister.h" |
35 #include "net/base/escape.h" | 35 #include "net/base/escape.h" |
36 #include "ui/base/l10n/l10n_util.h" | 36 #include "ui/base/l10n/l10n_util.h" |
| 37 #include "ui/base/layout.h" |
37 #include "ui/base/resource/resource_bundle.h" | 38 #include "ui/base/resource/resource_bundle.h" |
38 | 39 |
39 using content::WebContents; | 40 using content::WebContents; |
40 using content::WebUIMessageHandler; | 41 using content::WebUIMessageHandler; |
41 | 42 |
42 class SystemInfoUIHTMLSource : public ChromeURLDataManager::DataSource { | 43 class SystemInfoUIHTMLSource : public ChromeURLDataManager::DataSource { |
43 public: | 44 public: |
44 SystemInfoUIHTMLSource(); | 45 SystemInfoUIHTMLSource(); |
45 | 46 |
46 // Called when the network layer has requested a resource underneath | 47 // Called when the network layer has requested a resource underneath |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 DictionaryValue* val = new DictionaryValue; | 140 DictionaryValue* val = new DictionaryValue; |
140 val->SetString("stat_name", it->first); | 141 val->SetString("stat_name", it->first); |
141 val->SetString("stat_value", it->second); | 142 val->SetString("stat_value", it->second); |
142 details->Append(val); | 143 details->Append(val); |
143 } | 144 } |
144 strings.SetString("anchor", path_); | 145 strings.SetString("anchor", path_); |
145 delete sys_info; | 146 delete sys_info; |
146 } | 147 } |
147 static const base::StringPiece systeminfo_html( | 148 static const base::StringPiece systeminfo_html( |
148 ResourceBundle::GetSharedInstance().GetRawDataResource( | 149 ResourceBundle::GetSharedInstance().GetRawDataResource( |
149 IDR_ABOUT_SYS_HTML)); | 150 IDR_ABOUT_SYS_HTML, ui::SCALE_FACTOR_NONE)); |
150 std::string full_html = jstemplate_builder::GetTemplatesHtml( | 151 std::string full_html = jstemplate_builder::GetTemplatesHtml( |
151 systeminfo_html, &strings, "t" /* template root node id */); | 152 systeminfo_html, &strings, "t" /* template root node id */); |
152 | 153 |
153 SendResponse(request_id_, base::RefCountedString::TakeString(&full_html)); | 154 SendResponse(request_id_, base::RefCountedString::TakeString(&full_html)); |
154 } | 155 } |
155 | 156 |
156 //////////////////////////////////////////////////////////////////////////////// | 157 //////////////////////////////////////////////////////////////////////////////// |
157 // | 158 // |
158 // SystemInfoHandler | 159 // SystemInfoHandler |
159 // | 160 // |
(...skipping 16 matching lines...) Expand all Loading... |
176 | 177 |
177 SystemInfoUI::SystemInfoUI(content::WebUI* web_ui) : WebUIController(web_ui) { | 178 SystemInfoUI::SystemInfoUI(content::WebUI* web_ui) : WebUIController(web_ui) { |
178 SystemInfoHandler* handler = new SystemInfoHandler(); | 179 SystemInfoHandler* handler = new SystemInfoHandler(); |
179 web_ui->AddMessageHandler(handler); | 180 web_ui->AddMessageHandler(handler); |
180 SystemInfoUIHTMLSource* html_source = new SystemInfoUIHTMLSource(); | 181 SystemInfoUIHTMLSource* html_source = new SystemInfoUIHTMLSource(); |
181 | 182 |
182 // Set up the chrome://system/ source. | 183 // Set up the chrome://system/ source. |
183 Profile* profile = Profile::FromWebUI(web_ui); | 184 Profile* profile = Profile::FromWebUI(web_ui); |
184 ChromeURLDataManager::AddDataSource(profile, html_source); | 185 ChromeURLDataManager::AddDataSource(profile, html_source); |
185 } | 186 } |
OLD | NEW |