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

Unified Diff: chrome/browser/gtk/task_manager_gtk.cc

Issue 159616: gtk: Add the 'Stats for nerds' link to the task manager.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/gtk/task_manager_gtk.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/gtk/task_manager_gtk.cc
===================================================================
--- chrome/browser/gtk/task_manager_gtk.cc (revision 22016)
+++ chrome/browser/gtk/task_manager_gtk.cc (working copy)
@@ -6,12 +6,16 @@
#include <gdk/gdkkeysyms.h>
+#include <algorithm>
#include <vector>
#include "app/l10n_util.h"
#include "base/gfx/gtk_util.h"
#include "base/logging.h"
+#include "chrome/browser/browser_list.h"
#include "chrome/browser/browser_process.h"
+#include "chrome/browser/browser_window.h"
+#include "chrome/browser/gtk/gtk_chrome_link_button.h"
#include "chrome/browser/gtk/menu_gtk.h"
#include "chrome/common/gtk_util.h"
#include "chrome/common/pref_names.h"
@@ -28,6 +32,9 @@
// The resource id for the 'End process' button.
const gint kTaskManagerResponseKill = 1;
+// The resource id for the 'Stats for nerds' link button.
+const gint kTaskManagerAboutMemoryLink = 2;
+
enum TaskManagerColumn {
kTaskManagerIcon,
kTaskManagerPage,
@@ -318,6 +325,16 @@
kTaskManagerResponseKill,
NULL);
+ GtkWidget* link = gtk_chrome_link_button_new(
+ l10n_util::GetStringUTF8(IDS_TASK_MANAGER_ABOUT_MEMORY_LINK).c_str());
+ gtk_dialog_add_action_widget(GTK_DIALOG(dialog_), link,
+ kTaskManagerAboutMemoryLink);
+
+ // Setting the link widget to secondary positions the button on the left side
+ // of the action area (vice versa for RTL layout).
+ gtk_button_box_set_child_secondary(
+ GTK_BUTTON_BOX(GTK_DIALOG(dialog_)->action_area), link, TRUE);
+
ConnectAccelerators();
gtk_box_set_spacing(GTK_BOX(GTK_DIALOG(dialog_)->vbox),
@@ -534,6 +551,23 @@
task_manager_->ActivateProcess(row);
}
+void TaskManagerGtk::OnLinkActivated() {
+ Browser* browser = BrowserList::GetLastActive();
+ DCHECK(browser);
+ browser->OpenURL(GURL("about:memory"), GURL(), NEW_FOREGROUND_TAB,
+ PageTransition::LINK);
+ // In case the browser window is minimzed, show it. If this is an application
+ // or popup, we can only have one tab, hence we need to process this in a
+ // tabbed browser window. Currently, |browser| is pointing to the application,
+ // popup window. Therefore, we have to retrieve the last active tab again,
+ // since a new window has been used.
+ if (browser->type() & Browser::TYPE_APP_POPUP) {
+ browser = BrowserList::GetLastActive();
+ DCHECK(browser);
+ }
+ browser->window()->Show();
+}
+
// static
void TaskManagerGtk::OnResponse(GtkDialog* dialog, gint response_id,
TaskManagerGtk* task_manager) {
@@ -560,6 +594,8 @@
delete task_manager;
} else if (response_id == kTaskManagerResponseKill) {
task_manager->KillSelectedProcesses();
+ } else if (response_id == kTaskManagerAboutMemoryLink) {
+ task_manager->OnLinkActivated();
}
}
« no previous file with comments | « chrome/browser/gtk/task_manager_gtk.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698