| 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/flash_ui.h" | 5 #include "chrome/browser/ui/webui/flash_ui.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/bind.h" | 11 #include "base/bind.h" |
| 12 #include "base/bind_helpers.h" | 12 #include "base/bind_helpers.h" |
| 13 #include "base/i18n/time_formatting.h" | 13 #include "base/i18n/time_formatting.h" |
| 14 #include "base/memory/weak_ptr.h" | 14 #include "base/memory/weak_ptr.h" |
| 15 #include "base/string16.h" |
| 15 #include "base/string_number_conversions.h" | 16 #include "base/string_number_conversions.h" |
| 16 #include "base/stringprintf.h" | 17 #include "base/stringprintf.h" |
| 17 #include "base/threading/thread_restrictions.h" | 18 #include "base/threading/thread_restrictions.h" |
| 18 #include "base/timer.h" | 19 #include "base/timer.h" |
| 19 #include "base/utf_string_conversions.h" | 20 #include "base/utf_string_conversions.h" |
| 20 #include "base/values.h" | 21 #include "base/values.h" |
| 21 #include "chrome/browser/crash_upload_list.h" | 22 #include "chrome/browser/crash_upload_list.h" |
| 22 #include "chrome/browser/plugin_prefs.h" | 23 #include "chrome/browser/plugin_prefs.h" |
| 23 #include "chrome/browser/profiles/profile.h" | 24 #include "chrome/browser/profiles/profile.h" |
| 24 #include "chrome/browser/ui/webui/chrome_web_ui_data_source.h" | 25 #include "chrome/browser/ui/webui/chrome_web_ui_data_source.h" |
| (...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 269 flash_version = info_array[i].version + ASCIIToUTF16(" ") + | 270 flash_version = info_array[i].version + ASCIIToUTF16(" ") + |
| 270 info_array[i].path.LossyDisplayName(); | 271 info_array[i].path.LossyDisplayName(); |
| 271 if (i != 0) | 272 if (i != 0) |
| 272 flash_version += ASCIIToUTF16(" (not used)"); | 273 flash_version += ASCIIToUTF16(" (not used)"); |
| 273 AddPair(list, ASCIIToUTF16("Flash plugin"), flash_version); | 274 AddPair(list, ASCIIToUTF16("Flash plugin"), flash_version); |
| 274 } | 275 } |
| 275 } | 276 } |
| 276 } | 277 } |
| 277 | 278 |
| 278 // Crash information. | 279 // Crash information. |
| 279 AddPair(list, ASCIIToUTF16(""), "--- Crash data ---"); | 280 AddPair(list, string16(), "--- Crash data ---"); |
| 280 bool crash_reporting_enabled = CrashesUI::CrashReportingEnabled(); | 281 bool crash_reporting_enabled = CrashesUI::CrashReportingEnabled(); |
| 281 if (crash_reporting_enabled) { | 282 if (crash_reporting_enabled) { |
| 282 std::vector<CrashUploadList::CrashInfo> crashes; | 283 std::vector<CrashUploadList::CrashInfo> crashes; |
| 283 upload_list_->GetUploadedCrashes(10, &crashes); | 284 upload_list_->GetUploadedCrashes(10, &crashes); |
| 284 | 285 |
| 285 for (std::vector<CrashUploadList::CrashInfo>::iterator i = crashes.begin(); | 286 for (std::vector<CrashUploadList::CrashInfo>::iterator i = crashes.begin(); |
| 286 i != crashes.end(); ++i) { | 287 i != crashes.end(); ++i) { |
| 287 string16 crash_string(ASCIIToUTF16(i->crash_id)); | 288 string16 crash_string(ASCIIToUTF16(i->crash_id)); |
| 288 crash_string += ASCIIToUTF16(" "); | 289 crash_string += ASCIIToUTF16(" "); |
| 289 crash_string += base::TimeFormatFriendlyDateAndTime(i->crash_time); | 290 crash_string += base::TimeFormatFriendlyDateAndTime(i->crash_time); |
| 290 AddPair(list, ASCIIToUTF16("crash id"), crash_string); | 291 AddPair(list, ASCIIToUTF16("crash id"), crash_string); |
| 291 } | 292 } |
| 292 } else { | 293 } else { |
| 293 AddPair(list, ASCIIToUTF16("Crash Reporting"), | 294 AddPair(list, ASCIIToUTF16("Crash Reporting"), |
| 294 "Enable crash reporting to see crash IDs"); | 295 "Enable crash reporting to see crash IDs"); |
| 295 AddPair(list, ASCIIToUTF16("For more details"), | 296 AddPair(list, ASCIIToUTF16("For more details"), |
| 296 chrome::kLearnMoreReportingURL); | 297 chrome::kLearnMoreReportingURL); |
| 297 } | 298 } |
| 298 | 299 |
| 299 // GPU information. | 300 // GPU information. |
| 300 AddPair(list, ASCIIToUTF16(""), "--- GPU information ---"); | 301 AddPair(list, string16(), "--- GPU information ---"); |
| 301 const content::GPUInfo& gpu_info = gpu_data_manager_->gpu_info(); | 302 const content::GPUInfo& gpu_info = gpu_data_manager_->gpu_info(); |
| 302 | 303 |
| 303 if (!gpu_data_manager_->GpuAccessAllowed()) | 304 if (!gpu_data_manager_->GpuAccessAllowed()) |
| 304 AddPair(list, ASCIIToUTF16("WARNING:"), "GPU access is not allowed"); | 305 AddPair(list, ASCIIToUTF16("WARNING:"), "GPU access is not allowed"); |
| 305 #if defined(OS_WIN) | 306 #if defined(OS_WIN) |
| 306 const content::DxDiagNode& node = gpu_info.dx_diagnostics; | 307 const content::DxDiagNode& node = gpu_info.dx_diagnostics; |
| 307 for (std::map<std::string, content::DxDiagNode>::const_iterator it = | 308 for (std::map<std::string, content::DxDiagNode>::const_iterator it = |
| 308 node.children.begin(); | 309 node.children.begin(); |
| 309 it != node.children.end(); | 310 it != node.children.end(); |
| 310 ++it) { | 311 ++it) { |
| 311 for (std::map<std::string, std::string>::const_iterator it2 = | 312 for (std::map<std::string, std::string>::const_iterator it2 = |
| 312 it->second.values.begin(); | 313 it->second.values.begin(); |
| 313 it2 != it->second.values.end(); | 314 it2 != it->second.values.end(); |
| 314 ++it2) { | 315 ++it2) { |
| 315 if (!it2->second.empty()) { | 316 if (!it2->second.empty()) { |
| 316 if (it2->first == "szDescription") { | 317 if (it2->first == "szDescription") { |
| 317 AddPair(list, ASCIIToUTF16("Graphics card"), it2->second); | 318 AddPair(list, ASCIIToUTF16("Graphics card"), it2->second); |
| 318 } else if (it2->first == "szDriverNodeStrongName") { | 319 } else if (it2->first == "szDriverNodeStrongName") { |
| 319 AddPair(list, ASCIIToUTF16("Driver name (strong)"), it2->second); | 320 AddPair(list, ASCIIToUTF16("Driver name (strong)"), it2->second); |
| 320 } else if (it2->first == "szDriverName") { | 321 } else if (it2->first == "szDriverName") { |
| 321 AddPair(list, ASCIIToUTF16("Driver display name"), it2->second); | 322 AddPair(list, ASCIIToUTF16("Driver display name"), it2->second); |
| 322 } | 323 } |
| 323 } | 324 } |
| 324 } | 325 } |
| 325 } | 326 } |
| 326 #endif | 327 #endif |
| 327 | 328 |
| 328 AddPair(list, ASCIIToUTF16(""), "--- GPU driver, more information ---"); | 329 AddPair(list, string16(), "--- GPU driver, more information ---"); |
| 329 AddPair(list, | 330 AddPair(list, |
| 330 ASCIIToUTF16("Vendor Id"), | 331 ASCIIToUTF16("Vendor Id"), |
| 331 base::StringPrintf("0x%04x", gpu_info.vendor_id)); | 332 base::StringPrintf("0x%04x", gpu_info.vendor_id)); |
| 332 AddPair(list, | 333 AddPair(list, |
| 333 ASCIIToUTF16("Device Id"), | 334 ASCIIToUTF16("Device Id"), |
| 334 base::StringPrintf("0x%04x", gpu_info.device_id)); | 335 base::StringPrintf("0x%04x", gpu_info.device_id)); |
| 335 AddPair(list, ASCIIToUTF16("Driver vendor"), gpu_info.driver_vendor); | 336 AddPair(list, ASCIIToUTF16("Driver vendor"), gpu_info.driver_vendor); |
| 336 AddPair(list, ASCIIToUTF16("Driver version"), gpu_info.driver_version); | 337 AddPair(list, ASCIIToUTF16("Driver version"), gpu_info.driver_version); |
| 337 AddPair(list, ASCIIToUTF16("Driver date"), gpu_info.driver_date); | 338 AddPair(list, ASCIIToUTF16("Driver date"), gpu_info.driver_date); |
| 338 AddPair(list, | 339 AddPair(list, |
| (...skipping 30 matching lines...) Expand all Loading... |
| 369 // Set up the about:flash source. | 370 // Set up the about:flash source. |
| 370 Profile* profile = Profile::FromBrowserContext(contents->browser_context()); | 371 Profile* profile = Profile::FromBrowserContext(contents->browser_context()); |
| 371 profile->GetChromeURLDataManager()->AddDataSource(CreateFlashUIHTMLSource()); | 372 profile->GetChromeURLDataManager()->AddDataSource(CreateFlashUIHTMLSource()); |
| 372 } | 373 } |
| 373 | 374 |
| 374 // static | 375 // static |
| 375 RefCountedMemory* FlashUI::GetFaviconResourceBytes() { | 376 RefCountedMemory* FlashUI::GetFaviconResourceBytes() { |
| 376 // Use the default icon for now. | 377 // Use the default icon for now. |
| 377 return NULL; | 378 return NULL; |
| 378 } | 379 } |
| OLD | NEW |