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

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

Issue 1257543004: Add oom tab killing and the about:discards page on linux (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@memoryPressureOnLinux
Patch Set: Created 5 years, 4 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
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 <algorithm> 7 #include <algorithm>
8 #include <string> 8 #include <string>
9 #include <utility> 9 #include <utility>
10 #include <vector> 10 #include <vector>
(...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after
450 "<p>The following pages are for debugging purposes only. Because they " 450 "<p>The following pages are for debugging purposes only. Because they "
451 "crash or hang the renderer, they're not linked directly; you can type " 451 "crash or hang the renderer, they're not linked directly; you can type "
452 "them into the address bar if you need them.</p>\n<ul>"; 452 "them into the address bar if you need them.</p>\n<ul>";
453 for (int i = 0; i < chrome::kNumberOfChromeDebugURLs; i++) 453 for (int i = 0; i < chrome::kNumberOfChromeDebugURLs; i++)
454 html += "<li>" + std::string(chrome::kChromeDebugURLs[i]) + "</li>\n"; 454 html += "<li>" + std::string(chrome::kChromeDebugURLs[i]) + "</li>\n";
455 html += "</ul>\n"; 455 html += "</ul>\n";
456 AppendFooter(&html); 456 AppendFooter(&html);
457 return html; 457 return html;
458 } 458 }
459 459
460 #if defined(OS_WIN) || defined(OS_CHROMEOS) 460 #if defined(OS_WIN) || defined(OS_CHROMEOS) || defined(OS_LINUX)
461 461
462 const char kAboutDiscardsRunCommand[] = "run"; 462 const char kAboutDiscardsRunCommand[] = "run";
463 463
464 // Html output helper functions 464 // Html output helper functions
465 465
466 // Helper function to wrap HTML with a tag. 466 // Helper function to wrap HTML with a tag.
467 std::string WrapWithTag(const std::string& tag, const std::string& text) { 467 std::string WrapWithTag(const std::string& tag, const std::string& text) {
468 return "<" + tag + ">" + text + "</" + tag + ">"; 468 return "<" + tag + ">" + text + "</" + tag + ">";
469 } 469 }
470 470
471 #if defined(OS_CHROMEOS)
471 // Helper function to wrap Html with <td> tag. 472 // Helper function to wrap Html with <td> tag.
472 std::string WrapWithTD(const std::string& text) { 473 std::string WrapWithTD(const std::string& text) {
473 return "<td>" + text + "</td>"; 474 return "<td>" + text + "</td>";
474 } 475 }
475 476
476 // Helper function to wrap Html with <tr> tag. 477 // Helper function to wrap Html with <tr> tag.
477 std::string WrapWithTR(const std::string& text) { 478 std::string WrapWithTR(const std::string& text) {
478 return "<tr>" + text + "</tr>"; 479 return "<tr>" + text + "</tr>";
479 } 480 }
480 481
481 std::string AddStringRow(const std::string& name, const std::string& value) { 482 std::string AddStringRow(const std::string& name, const std::string& value) {
482 std::string row; 483 std::string row;
483 row.append(WrapWithTD(name)); 484 row.append(WrapWithTD(name));
484 row.append(WrapWithTD(value)); 485 row.append(WrapWithTD(value));
485 return WrapWithTR(row); 486 return WrapWithTR(row);
486 } 487 }
488 #endif
487 489
488 void AddContentSecurityPolicy(std::string* output) { 490 void AddContentSecurityPolicy(std::string* output) {
489 output->append("<meta http-equiv='Content-Security-Policy' " 491 output->append("<meta http-equiv='Content-Security-Policy' "
490 "content='default-src 'none';'>"); 492 "content='default-src 'none';'>");
491 } 493 }
492 494
493 // TODO(stevenjb): L10N AboutDiscards. 495 // TODO(stevenjb): L10N AboutDiscards.
494 496
495 std::string BuildAboutDiscardsRunPage() { 497 std::string BuildAboutDiscardsRunPage() {
496 std::string output; 498 std::string output;
(...skipping 441 matching lines...) Expand 10 before | Expand all | Expand 10 after
938 int idr = IDR_CREDITS_HTML; 940 int idr = IDR_CREDITS_HTML;
939 if (path == kCreditsJsPath) 941 if (path == kCreditsJsPath)
940 idr = IDR_CREDITS_JS; 942 idr = IDR_CREDITS_JS;
941 #if defined(OS_CHROMEOS) 943 #if defined(OS_CHROMEOS)
942 else if (path == kKeyboardUtilsPath) 944 else if (path == kKeyboardUtilsPath)
943 idr = IDR_KEYBOARD_UTILS_JS; 945 idr = IDR_KEYBOARD_UTILS_JS;
944 #endif 946 #endif
945 947
946 response = ResourceBundle::GetSharedInstance().GetRawDataResource( 948 response = ResourceBundle::GetSharedInstance().GetRawDataResource(
947 idr).as_string(); 949 idr).as_string();
948 #if defined(OS_WIN) || defined(OS_CHROMEOS) 950 #if defined(OS_WIN) || defined(OS_CHROMEOS) || defined(OS_LINUX)
949 } else if (source_name_ == chrome::kChromeUIDiscardsHost) { 951 } else if (source_name_ == chrome::kChromeUIDiscardsHost) {
950 response = AboutDiscards(path); 952 response = AboutDiscards(path);
951 #endif 953 #endif
952 } else if (source_name_ == chrome::kChromeUIDNSHost) { 954 } else if (source_name_ == chrome::kChromeUIDNSHost) {
953 AboutDnsHandler::Start(profile(), callback); 955 AboutDnsHandler::Start(profile(), callback);
954 return; 956 return;
955 #if defined(OS_LINUX) || defined(OS_OPENBSD) 957 #if defined(OS_LINUX) || defined(OS_OPENBSD)
956 } else if (source_name_ == chrome::kChromeUILinuxProxyConfigHost) { 958 } else if (source_name_ == chrome::kChromeUILinuxProxyConfigHost) {
957 response = AboutLinuxProxyConfig(); 959 response = AboutLinuxProxyConfig();
958 #endif 960 #endif
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
1027 Profile* profile = Profile::FromWebUI(web_ui); 1029 Profile* profile = Profile::FromWebUI(web_ui);
1028 1030
1029 #if defined(ENABLE_THEMES) 1031 #if defined(ENABLE_THEMES)
1030 // Set up the chrome://theme/ source. 1032 // Set up the chrome://theme/ source.
1031 ThemeSource* theme = new ThemeSource(profile); 1033 ThemeSource* theme = new ThemeSource(profile);
1032 content::URLDataSource::Add(profile, theme); 1034 content::URLDataSource::Add(profile, theme);
1033 #endif 1035 #endif
1034 1036
1035 content::URLDataSource::Add(profile, new AboutUIHTMLSource(name, profile)); 1037 content::URLDataSource::Add(profile, new AboutUIHTMLSource(name, profile));
1036 } 1038 }
OLDNEW
« no previous file with comments | « chrome/browser/memory/oom_priority_manager_browsertest.cc ('k') | 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