diff options
author | yoshiki@chromium.org <yoshiki@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-10-05 08:28:07 +0000 |
---|---|---|
committer | yoshiki@chromium.org <yoshiki@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-10-05 08:28:07 +0000 |
commit | 7b937360dc15b2746cc601620a33a7273a4eb86b (patch) | |
tree | 63a6ad4c67f0892a934fa95f1a4b3e2d879359b8 | |
parent | ab6641369e8bbb14d51548fc38848c5885ec0fd6 (diff) | |
download | chromium_src-7b937360dc15b2746cc601620a33a7273a4eb86b.zip chromium_src-7b937360dc15b2746cc601620a33a7273a4eb86b.tar.gz chromium_src-7b937360dc15b2746cc601620a33a7273a4eb86b.tar.bz2 |
WebUI TaskManager: Support on Mac & Linux
WebUI TaskManager is enabled when "--enable-task-manager" command-line option is set or when chrome is built with WEBUI_TASK_MANAGER.
The title and close button are shown only when task manager is a dialog and chrome runs on ChromeOS.
BUG=69222
TEST=manual
Review URL: http://codereview.chromium.org/8115005
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@104075 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/resources/task_manager/main.html | 6 | ||||
-rw-r--r-- | chrome/browser/resources/task_manager/main.js | 21 | ||||
-rw-r--r-- | chrome/browser/resources/task_manager/task_manager.css | 6 | ||||
-rw-r--r-- | chrome/browser/ui/cocoa/browser_window_cocoa.mm | 26 | ||||
-rw-r--r-- | chrome/browser/ui/gtk/browser_window_gtk.cc | 25 | ||||
-rw-r--r-- | chrome/browser/ui/panels/panel_browser_view.cc | 15 | ||||
-rw-r--r-- | chrome/browser/ui/webui/task_manager_dialog.cc | 6 |
7 files changed, 89 insertions, 16 deletions
diff --git a/chrome/browser/resources/task_manager/main.html b/chrome/browser/resources/task_manager/main.html index d0a15fc..e9bb32b 100644 --- a/chrome/browser/resources/task_manager/main.html +++ b/chrome/browser/resources/task_manager/main.html @@ -15,7 +15,8 @@ <link rel="stylesheet" href="task_manager.css"> </head> <body> - <div class="dialog-title" i18n-content="TITLE"></div> + <div class="dialog-title" i18n-content="TITLE" + visibleif='this.opt_.isShowTitle'></div> <div class="dialog-body"> <div class="list-container"> <div class="detail-table"></div> @@ -27,7 +28,8 @@ </div> <div class="footer-right-container"> <button id="kill-process" i18n-content="KILL_CHROMEOS"></button> - <button id="close-window" i18n-content="CLOSE_WINDOW"></button> + <button id="close-window" i18n-content="CLOSE_WINDOW" + visibleif='this.opt_.isShowCloseButton'></button> </div> </div> <script src="chrome://resources/js/i18n_template.js"></script> diff --git a/chrome/browser/resources/task_manager/main.js b/chrome/browser/resources/task_manager/main.js index 8d58f41..94c7a18 100644 --- a/chrome/browser/resources/task_manager/main.js +++ b/chrome/browser/resources/task_manager/main.js @@ -89,13 +89,13 @@ TaskManager.prototype = { * Initializes taskmanager. * @public */ - initialize: function (dialogDom, backgroundMode) { + initialize: function (dialogDom, opt) { if (!dialogDom) { console.log('ERROR: dialogDom is not defined.'); return; } - this.backgroundMode_ = backgroundMode; + this.opt_ = opt; this.initialized_ = true; this.enableTaskManager(); @@ -149,6 +149,13 @@ TaskManager.prototype = { dm.setCompareFunction(column_id, compare_func); } + var ary = this.dialogDom_.querySelectorAll('[visibleif]'); + for (var i = 0; i < ary.length; i++) { + var expr = ary[i].getAttribute('visibleif'); + if (!eval(expr)) + ary[i].hidden = true; + } + this.initTable_(); this.initColumnMenu_(); this.table_.redraw(); @@ -237,7 +244,7 @@ TaskManager.prototype = { var listItem = new cr.ui.ListItem({label: ''}); listItem.className = 'table-row'; - if (this.backgroundMode_ && dataItem.isBackgroundResource) + if (this.opt_.isBackgroundMode_ && dataItem.isBackgroundResource) listItem.className += ' table-background-row'; for (var i = 0; i < cm.size; i++) { @@ -369,8 +376,12 @@ TaskManager.prototype = { var taskmanager = TaskManager.getInstance(); function init() { - var backgroundMode = (location.hash == '#bg'); - taskmanager.initialize(document.body, backgroundMode); + var params = parseQueryParams(window.location); + var opt = {}; + opt['isShowTitle'] = params.showtitle; + opt['isBackgroundMode'] = params.background; + opt['isShowCloseButton'] = params.showclose; + taskmanager.initialize(document.body, opt); } function onClose() { diff --git a/chrome/browser/resources/task_manager/task_manager.css b/chrome/browser/resources/task_manager/task_manager.css index ffb77b1..8b39fec 100644 --- a/chrome/browser/resources/task_manager/task_manager.css +++ b/chrome/browser/resources/task_manager/task_manager.css @@ -31,7 +31,7 @@ body { font-size: 15px; font-weight: bold; margin-bottom: 4px; - padding: 0px 12px 6px 12px; + padding: 0px 12px 4px 12px; } /* Container for the detail list views. */ @@ -40,7 +40,7 @@ body { border: 1px #aaa solid; border-radius: 3px; display: -webkit-box; - margin: 4px 6px; + margin: 4px; } /* Column text containers. */ @@ -139,7 +139,7 @@ body { /* Container for footer area. */ .dialog-footer { display: -webkit-box; - margin: 4px 6px 10px 6px; + margin: 4px; } /* Container for the ok/cancel buttons. */ diff --git a/chrome/browser/ui/cocoa/browser_window_cocoa.mm b/chrome/browser/ui/cocoa/browser_window_cocoa.mm index 046e0aa..ded611c 100644 --- a/chrome/browser/ui/cocoa/browser_window_cocoa.mm +++ b/chrome/browser/ui/cocoa/browser_window_cocoa.mm @@ -36,7 +36,9 @@ #import "chrome/browser/ui/cocoa/theme_install_bubble_view.h" #import "chrome/browser/ui/cocoa/toolbar/toolbar_controller.h" #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" +#include "chrome/browser/ui/webui/task_manager_dialog.h" #include "chrome/common/chrome_notification_types.h" +#include "chrome/common/chrome_switches.h" #include "chrome/common/pref_names.h" #include "content/browser/tab_contents/tab_contents.h" #include "content/common/native_web_keyboard_event.h" @@ -358,11 +360,31 @@ void BrowserWindowCocoa::ShowUpdateChromeDialog() { } void BrowserWindowCocoa::ShowTaskManager() { - TaskManagerMac::Show(false); +#if defined(WEBUI_TASK_MANAGER) + TaskManagerDialog::Show(); +#else + // Uses WebUI TaskManager when swiches is set. It is beta feature. + if (CommandLine::ForCurrentProcess() + ->HasSwitch(switches::kEnableWebUITaskManager)) { + TaskManagerDialog::Show(); + } else { + TaskManagerMac::Show(false); + } +#endif // defined(WEBUI_TASK_MANAGER) } void BrowserWindowCocoa::ShowBackgroundPages() { - TaskManagerMac::Show(true); +#if defined(WEBUI_TASK_MANAGER) + TaskManagerDialog::ShowBackgroundPages(); +#else + // Uses WebUI TaskManager when swiches is set. It is beta feature. + if (CommandLine::ForCurrentProcess() + ->HasSwitch(switches::kEnableWebUITaskManager)) { + TaskManagerDialog::ShowBackgroundPages(); + } else { + TaskManagerMac::Show(true); + } +#endif // defined(WEBUI_TASK_MANAGER) } void BrowserWindowCocoa::ShowBookmarkBubble(const GURL& url, diff --git a/chrome/browser/ui/gtk/browser_window_gtk.cc b/chrome/browser/ui/gtk/browser_window_gtk.cc index a762c93..a0c1b50 100644 --- a/chrome/browser/ui/gtk/browser_window_gtk.cc +++ b/chrome/browser/ui/gtk/browser_window_gtk.cc @@ -72,6 +72,7 @@ #include "chrome/browser/ui/omnibox/omnibox_view.h" #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" #include "chrome/browser/ui/webui/bug_report_ui.h" +#include "chrome/browser/ui/webui/task_manager_dialog.h" #include "chrome/browser/ui/window_sizer.h" #include "chrome/browser/web_applications/web_app.h" #include "chrome/common/chrome_notification_types.h" @@ -958,11 +959,31 @@ void BrowserWindowGtk::ShowUpdateChromeDialog() { } void BrowserWindowGtk::ShowTaskManager() { - TaskManagerGtk::Show(false); +#if defined(WEBUI_TASK_MANAGER) + TaskManagerDialog::Show(); +#else + // Uses WebUI TaskManager when swiches is set. It is beta feature. + if (CommandLine::ForCurrentProcess() + ->HasSwitch(switches::kEnableWebUITaskManager)) { + TaskManagerDialog::Show(); + } else { + TaskManagerGtk::Show(false); + } +#endif // defined(WEBUI_TASK_MANAGER) } void BrowserWindowGtk::ShowBackgroundPages() { - TaskManagerGtk::Show(true); +#if defined(WEBUI_TASK_MANAGER) + TaskManagerDialog::ShowBackgroundPages(); +#else + // Uses WebUI TaskManager when swiches is set. It is beta feature. + if (CommandLine::ForCurrentProcess() + ->HasSwitch(switches::kEnableWebUITaskManager)) { + TaskManagerDialog::ShowBackgroundPages(); + } else { + TaskManagerGtk::Show(true); + } +#endif // defined(WEBUI_TASK_MANAGER) } void BrowserWindowGtk::ShowBookmarkBubble(const GURL& url, diff --git a/chrome/browser/ui/panels/panel_browser_view.cc b/chrome/browser/ui/panels/panel_browser_view.cc index 3d918da..da233f3 100644 --- a/chrome/browser/ui/panels/panel_browser_view.cc +++ b/chrome/browser/ui/panels/panel_browser_view.cc @@ -4,11 +4,14 @@ #include "chrome/browser/ui/panels/panel_browser_view.h" +#include "base/command_line.h" #include "base/logging.h" #include "chrome/browser/ui/panels/panel.h" #include "chrome/browser/ui/panels/panel_browser_frame_view.h" #include "chrome/browser/ui/panels/panel_manager.h" #include "chrome/browser/ui/views/frame/browser_frame.h" +#include "chrome/browser/ui/webui/task_manager_dialog.h" +#include "chrome/common/chrome_switches.h" #include "grit/chromium_strings.h" #include "ui/base/animation/slide_animation.h" #include "ui/base/l10n/l10n_util.h" @@ -227,7 +230,17 @@ void PanelBrowserView::UpdatePanelLoadingAnimations(bool should_animate) { } void PanelBrowserView::ShowTaskManagerForPanel() { - ShowTaskManager(); +#if defined(WEBUI_TASK_MANAGER) + TaskManagerDialog::Show(); +#else + // Uses WebUI TaskManager when swiches is set. It is beta feature. + if (CommandLine::ForCurrentProcess() + ->HasSwitch(switches::kEnableWebUITaskManager)) { + TaskManagerDialog::Show(); + } else { + ShowTaskManager(); + } +#endif // defined(WEBUI_TASK_MANAGER) } FindBar* PanelBrowserView::CreatePanelFindBar() { diff --git a/chrome/browser/ui/webui/task_manager_dialog.cc b/chrome/browser/ui/webui/task_manager_dialog.cc index b6ca3d4..39578f2 100644 --- a/chrome/browser/ui/webui/task_manager_dialog.cc +++ b/chrome/browser/ui/webui/task_manager_dialog.cc @@ -41,8 +41,12 @@ class TaskManagerDialogImpl : public HtmlDialogUIDelegate { } virtual GURL GetDialogContentURL() const OVERRIDE { std::string url_string(chrome::kChromeUITaskManagerURL); + url_string += "?"; +#if defined(OS_CHROMEOS) + url_string += "showclose=1&showtitle=1&"; +#endif // defined(OS_CHROMEOS) if (is_background_page_mode_) - url_string += "#bg"; + url_string += "background=1"; return GURL(url_string); } virtual void GetWebUIMessageHandlers( |