| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/gpu_internals_ui.h" | 5 #include "chrome/browser/ui/webui/gpu_internals_ui.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <utility> | 9 #include <utility> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 base::StringPiece gpu_html( | 168 base::StringPiece gpu_html( |
| 169 ResourceBundle::GetSharedInstance().GetRawDataResource( | 169 ResourceBundle::GetSharedInstance().GetRawDataResource( |
| 170 IDR_GPU_INTERNALS_HTML)); | 170 IDR_GPU_INTERNALS_HTML)); |
| 171 std::string full_html(gpu_html.data(), gpu_html.size()); | 171 std::string full_html(gpu_html.data(), gpu_html.size()); |
| 172 jstemplate_builder::AppendJsonHtml(&localized_strings, &full_html); | 172 jstemplate_builder::AppendJsonHtml(&localized_strings, &full_html); |
| 173 jstemplate_builder::AppendI18nTemplateSourceHtml(&full_html); | 173 jstemplate_builder::AppendI18nTemplateSourceHtml(&full_html); |
| 174 jstemplate_builder::AppendI18nTemplateProcessHtml(&full_html); | 174 jstemplate_builder::AppendI18nTemplateProcessHtml(&full_html); |
| 175 jstemplate_builder::AppendJsTemplateSourceHtml(&full_html); | 175 jstemplate_builder::AppendJsTemplateSourceHtml(&full_html); |
| 176 | 176 |
| 177 | 177 |
| 178 scoped_refptr<RefCountedBytes> html_bytes(new RefCountedBytes); | 178 SendResponse(request_id, base::RefCountedString::TakeString(&full_html)); |
| 179 html_bytes->data.resize(full_html.size()); | |
| 180 std::copy(full_html.begin(), full_html.end(), html_bytes->data.begin()); | |
| 181 | |
| 182 SendResponse(request_id, html_bytes); | |
| 183 } | 179 } |
| 184 | 180 |
| 185 std::string GpuHTMLSource::GetMimeType(const std::string&) const { | 181 std::string GpuHTMLSource::GetMimeType(const std::string&) const { |
| 186 return "text/html"; | 182 return "text/html"; |
| 187 } | 183 } |
| 188 | 184 |
| 189 //////////////////////////////////////////////////////////////////////////////// | 185 //////////////////////////////////////////////////////////////////////////////// |
| 190 // | 186 // |
| 191 // GpuMessageHandler | 187 // GpuMessageHandler |
| 192 // | 188 // |
| (...skipping 448 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 641 //////////////////////////////////////////////////////////////////////////////// | 637 //////////////////////////////////////////////////////////////////////////////// |
| 642 | 638 |
| 643 GpuInternalsUI::GpuInternalsUI(TabContents* contents) : ChromeWebUI(contents) { | 639 GpuInternalsUI::GpuInternalsUI(TabContents* contents) : ChromeWebUI(contents) { |
| 644 AddMessageHandler((new GpuMessageHandler())->Attach(this)); | 640 AddMessageHandler((new GpuMessageHandler())->Attach(this)); |
| 645 | 641 |
| 646 GpuHTMLSource* html_source = new GpuHTMLSource(); | 642 GpuHTMLSource* html_source = new GpuHTMLSource(); |
| 647 | 643 |
| 648 // Set up the chrome://gpu/ source. | 644 // Set up the chrome://gpu/ source. |
| 649 contents->profile()->GetChromeURLDataManager()->AddDataSource(html_source); | 645 contents->profile()->GetChromeURLDataManager()->AddDataSource(html_source); |
| 650 } | 646 } |
| OLD | NEW |