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

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

Issue 2453453002: Enable chrome://discards on Linux. (Closed)
Patch Set: Enable chrome://discards on Linux. Created 4 years, 1 month 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
« no previous file with comments | « no previous file | chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc » ('j') | 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/about_ui.h" 5 #include "chrome/browser/ui/webui/about_ui.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after
417 "<p>The following pages are for debugging purposes only. Because they " 417 "<p>The following pages are for debugging purposes only. Because they "
418 "crash or hang the renderer, they're not linked directly; you can type " 418 "crash or hang the renderer, they're not linked directly; you can type "
419 "them into the address bar if you need them.</p>\n<ul>"; 419 "them into the address bar if you need them.</p>\n<ul>";
420 for (int i = 0; i < chrome::kNumberOfChromeDebugURLs; i++) 420 for (int i = 0; i < chrome::kNumberOfChromeDebugURLs; i++)
421 html += "<li>" + std::string(chrome::kChromeDebugURLs[i]) + "</li>\n"; 421 html += "<li>" + std::string(chrome::kChromeDebugURLs[i]) + "</li>\n";
422 html += "</ul>\n"; 422 html += "</ul>\n";
423 AppendFooter(&html); 423 AppendFooter(&html);
424 return html; 424 return html;
425 } 425 }
426 426
427 #if defined(OS_WIN) || defined(OS_MACOSX) || defined(OS_CHROMEOS) 427 #if defined(OS_WIN) || defined(OS_MACOSX) || defined(OS_LINUX)
428 428
429 const char kAboutDiscardsRunCommand[] = "run"; 429 const char kAboutDiscardsRunCommand[] = "run";
430 430
431 // Html output helper functions 431 // Html output helper functions
432 432
433 // Helper function to wrap HTML with a tag. 433 // Helper function to wrap HTML with a tag.
434 std::string WrapWithTag(const std::string& tag, const std::string& text) { 434 std::string WrapWithTag(const std::string& tag, const std::string& text) {
435 return "<" + tag + ">" + text + "</" + tag + ">"; 435 return "<" + tag + ">" + text + "</" + tag + ">";
436 } 436 }
437 437
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
575 output.append(AddStringRow( 575 output.append(AddStringRow(
576 "Shared", base::IntToString(meminfo.shmem / 1024))); 576 "Shared", base::IntToString(meminfo.shmem / 1024)));
577 output.append(AddStringRow( 577 output.append(AddStringRow(
578 "Graphics", base::IntToString(meminfo.gem_size / 1024 / 1024))); 578 "Graphics", base::IntToString(meminfo.gem_size / 1024 / 1024)));
579 #endif // OS_CHROMEOS 579 #endif // OS_CHROMEOS
580 output.append("</table>"); 580 output.append("</table>");
581 AppendFooter(&output); 581 AppendFooter(&output);
582 return output; 582 return output;
583 } 583 }
584 584
585 #endif // OS_WIN || OS_CHROMEOS 585 #endif // OS_WIN || OS_MACOSX || OS_LINUX
586 586
587 // AboutDnsHandler bounces the request back to the IO thread to collect 587 // AboutDnsHandler bounces the request back to the IO thread to collect
588 // the DNS information. 588 // the DNS information.
589 class AboutDnsHandler : public base::RefCountedThreadSafe<AboutDnsHandler> { 589 class AboutDnsHandler : public base::RefCountedThreadSafe<AboutDnsHandler> {
590 public: 590 public:
591 static void Start(Profile* profile, 591 static void Start(Profile* profile,
592 const content::URLDataSource::GotDataCallback& callback) { 592 const content::URLDataSource::GotDataCallback& callback) {
593 scoped_refptr<AboutDnsHandler> handler( 593 scoped_refptr<AboutDnsHandler> handler(
594 new AboutDnsHandler(profile, callback)); 594 new AboutDnsHandler(profile, callback));
595 handler->StartOnUIThread(); 595 handler->StartOnUIThread();
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
773 // Resizing the response and using it as the buffer Brotli decompresses 773 // Resizing the response and using it as the buffer Brotli decompresses
774 // into. 774 // into.
775 response.resize(decoded_size); 775 response.resize(decoded_size);
776 CHECK(BrotliDecompressBuffer(raw_response.size(), encoded_response_buffer, 776 CHECK(BrotliDecompressBuffer(raw_response.size(), encoded_response_buffer,
777 &decoded_size, 777 &decoded_size,
778 reinterpret_cast<uint8_t*>(&response[0])) == 778 reinterpret_cast<uint8_t*>(&response[0])) ==
779 BROTLI_RESULT_SUCCESS); 779 BROTLI_RESULT_SUCCESS);
780 } else { 780 } else {
781 response = raw_response.as_string(); 781 response = raw_response.as_string();
782 } 782 }
783 #if defined(OS_WIN) || defined(OS_MACOSX) || defined(OS_CHROMEOS) 783 #if defined(OS_WIN) || defined(OS_MACOSX) || defined(OS_LINUX)
784 } else if (source_name_ == chrome::kChromeUIDiscardsHost) { 784 } else if (source_name_ == chrome::kChromeUIDiscardsHost) {
785 response = AboutDiscards(path); 785 response = AboutDiscards(path);
786 #endif 786 #endif
787 } else if (source_name_ == chrome::kChromeUIDNSHost) { 787 } else if (source_name_ == chrome::kChromeUIDNSHost) {
788 AboutDnsHandler::Start(profile(), callback); 788 AboutDnsHandler::Start(profile(), callback);
789 return; 789 return;
790 #if defined(OS_LINUX) || defined(OS_OPENBSD) 790 #if defined(OS_LINUX) || defined(OS_OPENBSD)
791 } else if (source_name_ == chrome::kChromeUILinuxProxyConfigHost) { 791 } else if (source_name_ == chrome::kChromeUILinuxProxyConfigHost) {
792 response = AboutLinuxProxyConfig(); 792 response = AboutLinuxProxyConfig();
793 #endif 793 #endif
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
856 Profile* profile = Profile::FromWebUI(web_ui); 856 Profile* profile = Profile::FromWebUI(web_ui);
857 857
858 #if defined(ENABLE_THEMES) 858 #if defined(ENABLE_THEMES)
859 // Set up the chrome://theme/ source. 859 // Set up the chrome://theme/ source.
860 ThemeSource* theme = new ThemeSource(profile); 860 ThemeSource* theme = new ThemeSource(profile);
861 content::URLDataSource::Add(profile, theme); 861 content::URLDataSource::Add(profile, theme);
862 #endif 862 #endif
863 863
864 content::URLDataSource::Add(profile, new AboutUIHTMLSource(name, profile)); 864 content::URLDataSource::Add(profile, new AboutUIHTMLSource(name, profile));
865 } 865 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698