| 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/gpu_internals_ui.h" | 5 #include "chrome/browser/ui/webui/gpu_internals_ui.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 return dict; | 77 return dict; |
| 78 } | 78 } |
| 79 | 79 |
| 80 Value* NewStatusValue(const char* name, const char* status) { | 80 Value* NewStatusValue(const char* name, const char* status) { |
| 81 DictionaryValue* value = new DictionaryValue(); | 81 DictionaryValue* value = new DictionaryValue(); |
| 82 value->SetString("name", name); | 82 value->SetString("name", name); |
| 83 value->SetString("status", status); | 83 value->SetString("status", status); |
| 84 return value; | 84 return value; |
| 85 } | 85 } |
| 86 | 86 |
| 87 #if defined(OS_WIN) |
| 87 // Output DxDiagNode tree as nested array of {description,value} pairs | 88 // Output DxDiagNode tree as nested array of {description,value} pairs |
| 88 ListValue* DxDiagNodeToList(const content::DxDiagNode& node) { | 89 ListValue* DxDiagNodeToList(const content::DxDiagNode& node) { |
| 89 ListValue* list = new ListValue(); | 90 ListValue* list = new ListValue(); |
| 90 for (std::map<std::string, std::string>::const_iterator it = | 91 for (std::map<std::string, std::string>::const_iterator it = |
| 91 node.values.begin(); | 92 node.values.begin(); |
| 92 it != node.values.end(); | 93 it != node.values.end(); |
| 93 ++it) { | 94 ++it) { |
| 94 list->Append(NewDescriptionValuePair(it->first, it->second)); | 95 list->Append(NewDescriptionValuePair(it->first, it->second)); |
| 95 } | 96 } |
| 96 | 97 |
| 97 for (std::map<std::string, content::DxDiagNode>::const_iterator it = | 98 for (std::map<std::string, content::DxDiagNode>::const_iterator it = |
| 98 node.children.begin(); | 99 node.children.begin(); |
| 99 it != node.children.end(); | 100 it != node.children.end(); |
| 100 ++it) { | 101 ++it) { |
| 101 ListValue* sublist = DxDiagNodeToList(it->second); | 102 ListValue* sublist = DxDiagNodeToList(it->second); |
| 102 list->Append(NewDescriptionValuePair(it->first, sublist)); | 103 list->Append(NewDescriptionValuePair(it->first, sublist)); |
| 103 } | 104 } |
| 104 return list; | 105 return list; |
| 105 } | 106 } |
| 107 #endif |
| 106 | 108 |
| 107 std::string GPUDeviceToString(const content::GPUInfo::GPUDevice& gpu) { | 109 std::string GPUDeviceToString(const content::GPUInfo::GPUDevice& gpu) { |
| 108 std::string vendor = base::StringPrintf("0x%04x", gpu.vendor_id); | 110 std::string vendor = base::StringPrintf("0x%04x", gpu.vendor_id); |
| 109 if (!gpu.vendor_string.empty()) | 111 if (!gpu.vendor_string.empty()) |
| 110 vendor += " [" + gpu.vendor_string + "]"; | 112 vendor += " [" + gpu.vendor_string + "]"; |
| 111 std::string device = base::StringPrintf("0x%04x", gpu.device_id); | 113 std::string device = base::StringPrintf("0x%04x", gpu.device_id); |
| 112 if (!gpu.device_string.empty()) | 114 if (!gpu.device_string.empty()) |
| 113 device += " [" + gpu.device_string + "]"; | 115 device += " [" + gpu.device_string + "]"; |
| 114 return base::StringPrintf( | 116 return base::StringPrintf( |
| 115 "VENDOR = %s, DEVICE= %s", vendor.c_str(), device.c_str()); | 117 "VENDOR = %s, DEVICE= %s", vendor.c_str(), device.c_str()); |
| (...skipping 526 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 642 //////////////////////////////////////////////////////////////////////////////// | 644 //////////////////////////////////////////////////////////////////////////////// |
| 643 | 645 |
| 644 GpuInternalsUI::GpuInternalsUI(content::WebUI* web_ui) | 646 GpuInternalsUI::GpuInternalsUI(content::WebUI* web_ui) |
| 645 : WebUIController(web_ui) { | 647 : WebUIController(web_ui) { |
| 646 web_ui->AddMessageHandler(new GpuMessageHandler()); | 648 web_ui->AddMessageHandler(new GpuMessageHandler()); |
| 647 | 649 |
| 648 // Set up the chrome://gpu-internals/ source. | 650 // Set up the chrome://gpu-internals/ source. |
| 649 Profile* profile = Profile::FromWebUI(web_ui); | 651 Profile* profile = Profile::FromWebUI(web_ui); |
| 650 ChromeURLDataManager::AddDataSource(profile, CreateGpuHTMLSource()); | 652 ChromeURLDataManager::AddDataSource(profile, CreateGpuHTMLSource()); |
| 651 } | 653 } |
| OLD | NEW |