Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4)

Side by Side Diff: chrome/browser/ui/webui/gpu_internals_ui.cc

Issue 10919200: Revert 155078 - Show about:sandbox status in the about:gpu page. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/resources/gpu_internals/info_view.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 17 matching lines...) Expand all
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 "content/public/common/compositor_util.h" 30 #include "content/public/common/compositor_util.h"
31 #include "content/public/common/content_switches.h" 31 #include "content/public/common/content_switches.h"
32 #include "content/public/common/gpu_info.h" 32 #include "content/public/common/gpu_info.h"
33 #include "grit/browser_resources.h" 33 #include "grit/browser_resources.h"
34 #include "grit/generated_resources.h" 34 #include "grit/generated_resources.h"
35 #include "third_party/angle/src/common/version.h" 35 #include "third_party/angle/src/common/version.h"
36 #include "ui/base/l10n/l10n_util.h" 36 #include "ui/base/l10n/l10n_util.h"
37 37
38 #if defined(OS_LINUX) || defined(OS_OPENBSD)
39 #include "content/public/browser/zygote_host_linux.h"
40 #include "content/public/common/sandbox_linux.h"
41 #endif
42
43 using content::BrowserThread; 38 using content::BrowserThread;
44 using content::GpuDataManager; 39 using content::GpuDataManager;
45 using content::GpuFeatureType; 40 using content::GpuFeatureType;
46 using content::WebContents; 41 using content::WebContents;
47 using content::WebUIMessageHandler; 42 using content::WebUIMessageHandler;
48 43
49 namespace { 44 namespace {
50 45
51 struct GpuFeatureInfo { 46 struct GpuFeatureInfo {
52 std::string name; 47 std::string name;
(...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after
400 395
401 // CrashUploadList::Delegate implemenation. 396 // CrashUploadList::Delegate implemenation.
402 virtual void OnCrashListAvailable() OVERRIDE; 397 virtual void OnCrashListAvailable() OVERRIDE;
403 398
404 // Messages 399 // Messages
405 void OnBrowserBridgeInitialized(const ListValue* list); 400 void OnBrowserBridgeInitialized(const ListValue* list);
406 void OnCallAsync(const ListValue* list); 401 void OnCallAsync(const ListValue* list);
407 402
408 // Submessages dispatched from OnCallAsync 403 // Submessages dispatched from OnCallAsync
409 Value* OnRequestClientInfo(const ListValue* list); 404 Value* OnRequestClientInfo(const ListValue* list);
410 Value* OnRequestSandboxInfo(const ListValue* list);
411 Value* OnRequestLogMessages(const ListValue* list); 405 Value* OnRequestLogMessages(const ListValue* list);
412 Value* OnRequestCrashList(const ListValue* list); 406 Value* OnRequestCrashList(const ListValue* list);
413 407
414 // Executes the javascript function |function_name| in the renderer, passing 408 // Executes the javascript function |function_name| in the renderer, passing
415 // it the argument |value|. 409 // it the argument |value|.
416 void CallJavascriptFunction(const std::wstring& function_name, 410 void CallJavascriptFunction(const std::wstring& function_name,
417 const Value* value); 411 const Value* value);
418 412
419 private: 413 private:
420 scoped_refptr<CrashUploadList> crash_list_; 414 scoped_refptr<CrashUploadList> crash_list_;
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
477 DCHECK(ok); 471 DCHECK(ok);
478 472
479 Value* argCopy = arg->DeepCopy(); 473 Value* argCopy = arg->DeepCopy();
480 submessageArgs->Append(argCopy); 474 submessageArgs->Append(argCopy);
481 } 475 }
482 476
483 // call the submessage handler 477 // call the submessage handler
484 Value* ret = NULL; 478 Value* ret = NULL;
485 if (submessage == "requestClientInfo") { 479 if (submessage == "requestClientInfo") {
486 ret = OnRequestClientInfo(submessageArgs); 480 ret = OnRequestClientInfo(submessageArgs);
487 } else if (submessage == "requestSandboxInfo") {
488 ret = OnRequestSandboxInfo(submessageArgs);
489 } else if (submessage == "requestLogMessages") { 481 } else if (submessage == "requestLogMessages") {
490 ret = OnRequestLogMessages(submessageArgs); 482 ret = OnRequestLogMessages(submessageArgs);
491 } else if (submessage == "requestCrashList") { 483 } else if (submessage == "requestCrashList") {
492 ret = OnRequestCrashList(submessageArgs); 484 ret = OnRequestCrashList(submessageArgs);
493 } else { // unrecognized submessage 485 } else { // unrecognized submessage
494 NOTREACHED(); 486 NOTREACHED();
495 delete submessageArgs; 487 delete submessageArgs;
496 return; 488 return;
497 } 489 }
498 delete submessageArgs; 490 delete submessageArgs;
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
559 dict->SetString("graphics_backend", "Skia"); 551 dict->SetString("graphics_backend", "Skia");
560 #else 552 #else
561 dict->SetString("graphics_backend", "Core Graphics"); 553 dict->SetString("graphics_backend", "Core Graphics");
562 #endif 554 #endif
563 dict->SetString("blacklist_version", 555 dict->SetString("blacklist_version",
564 GpuDataManager::GetInstance()->GetBlacklistVersion()); 556 GpuDataManager::GetInstance()->GetBlacklistVersion());
565 557
566 return dict; 558 return dict;
567 } 559 }
568 560
569 Value* GpuMessageHandler::OnRequestSandboxInfo(const ListValue*) {
570 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
571
572 DictionaryValue* dict = new DictionaryValue();
573
574 #if defined(OS_LINUX) || defined(OS_OPENBSD)
575 const int status = content::ZygoteHost::GetInstance()->GetSandboxStatus();
576 dict->SetBoolean("suid_sanbox", status & content::kSandboxLinuxSUID);
577 dict->SetBoolean("pid_namespaces", status & content::kSandboxLinuxPIDNS);
578 dict->SetBoolean("net_namespaces", status & content::kSandboxLinuxNetNS);
579 dict->SetBoolean("seccomp_legacy",
580 status & content::kSandboxLinuxSeccompLegacy);
581 dict->SetBoolean("seccomp_bpf", status & content::kSandboxLinuxSeccompBpf);
582 bool good = ((status & content::kSandboxLinuxSUID) &&
583 (status & content::kSandboxLinuxPIDNS)) ||
584 (status & content::kSandboxLinuxSeccompLegacy);
585 dict->SetBoolean("sandbox_ok", good);
586 #else
587 dict->SetBoolean("suid_sanbox", false);
588 dict->SetBoolean("pid_namespaces", false);
589 dict->SetBoolean("net_namespaces", false);
590 dict->SetBoolean("seccomp_legacy", false);
591 dict->SetBoolean("seccomp_bpf", false);
592 dict->SetBoolean("sandbox_ok", true);
593 #endif
594
595 return dict;
596 }
597
598 Value* GpuMessageHandler::OnRequestLogMessages(const ListValue*) { 561 Value* GpuMessageHandler::OnRequestLogMessages(const ListValue*) {
599 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 562 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
600 563
601 return GpuDataManager::GetInstance()->GetLogMessages(); 564 return GpuDataManager::GetInstance()->GetLogMessages();
602 } 565 }
603 566
604 Value* GpuMessageHandler::OnRequestCrashList(const ListValue*) { 567 Value* GpuMessageHandler::OnRequestCrashList(const ListValue*) {
605 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 568 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
606 569
607 if (!CrashesUI::CrashReportingEnabled()) { 570 if (!CrashesUI::CrashReportingEnabled()) {
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
657 //////////////////////////////////////////////////////////////////////////////// 620 ////////////////////////////////////////////////////////////////////////////////
658 621
659 GpuInternalsUI::GpuInternalsUI(content::WebUI* web_ui) 622 GpuInternalsUI::GpuInternalsUI(content::WebUI* web_ui)
660 : WebUIController(web_ui) { 623 : WebUIController(web_ui) {
661 web_ui->AddMessageHandler(new GpuMessageHandler()); 624 web_ui->AddMessageHandler(new GpuMessageHandler());
662 625
663 // Set up the chrome://gpu-internals/ source. 626 // Set up the chrome://gpu-internals/ source.
664 Profile* profile = Profile::FromWebUI(web_ui); 627 Profile* profile = Profile::FromWebUI(web_ui);
665 ChromeURLDataManager::AddDataSource(profile, CreateGpuHTMLSource()); 628 ChromeURLDataManager::AddDataSource(profile, CreateGpuHTMLSource());
666 } 629 }
OLDNEW
« no previous file with comments | « chrome/browser/resources/gpu_internals/info_view.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698