OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/gtk/task_manager_gtk.h" | 5 #include "chrome/browser/gtk/task_manager_gtk.h" |
6 | 6 |
7 #include <gdk/gdkkeysyms.h> | 7 #include <gdk/gdkkeysyms.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "app/l10n_util.h" | 12 #include "app/l10n_util.h" |
13 #include "app/resource_bundle.h" | 13 #include "app/resource_bundle.h" |
14 #include "base/gfx/gtk_util.h" | 14 #include "base/gfx/gtk_util.h" |
15 #include "base/logging.h" | 15 #include "base/logging.h" |
16 #include "chrome/browser/browser_list.h" | 16 #include "chrome/browser/browser_list.h" |
17 #include "chrome/browser/browser_process.h" | 17 #include "chrome/browser/browser_process.h" |
18 #include "chrome/browser/browser_window.h" | 18 #include "chrome/browser/browser_window.h" |
19 #include "chrome/browser/gtk/gtk_theme_provider.h" | 19 #include "chrome/browser/gtk/gtk_theme_provider.h" |
20 #include "chrome/browser/gtk/gtk_chrome_link_button.h" | 20 #include "chrome/browser/gtk/gtk_chrome_link_button.h" |
21 #include "chrome/browser/gtk/gtk_theme_provider.h" | 21 #include "chrome/browser/gtk/gtk_theme_provider.h" |
22 #include "chrome/browser/gtk/menu_gtk.h" | 22 #include "chrome/browser/gtk/menu_gtk.h" |
23 #include "chrome/common/gtk_tree.h" | 23 #include "chrome/common/gtk_tree.h" |
24 #include "chrome/common/gtk_util.h" | 24 #include "chrome/common/gtk_util.h" |
25 #include "chrome/common/pref_names.h" | 25 #include "chrome/common/pref_names.h" |
26 #include "chrome/common/pref_service.h" | 26 #include "chrome/common/pref_service.h" |
| 27 #include "chrome/common/url_constants.h" |
27 #include "grit/app_resources.h" | 28 #include "grit/app_resources.h" |
28 #include "grit/chromium_strings.h" | 29 #include "grit/chromium_strings.h" |
29 | 30 |
30 namespace { | 31 namespace { |
31 | 32 |
32 // The task manager window default size. | 33 // The task manager window default size. |
33 const int kDefaultWidth = 460; | 34 const int kDefaultWidth = 460; |
34 const int kDefaultHeight = 270; | 35 const int kDefaultHeight = 270; |
35 | 36 |
36 // The resource id for the 'End process' button. | 37 // The resource id for the 'End process' button. |
(...skipping 573 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
610 if (selected) { | 611 if (selected) { |
611 int row = gtk_tree::GetRowNumForPath( | 612 int row = gtk_tree::GetRowNumForPath( |
612 reinterpret_cast<GtkTreePath*>(selected->data)); | 613 reinterpret_cast<GtkTreePath*>(selected->data)); |
613 task_manager_->ActivateProcess(row); | 614 task_manager_->ActivateProcess(row); |
614 } | 615 } |
615 } | 616 } |
616 | 617 |
617 void TaskManagerGtk::OnLinkActivated() { | 618 void TaskManagerGtk::OnLinkActivated() { |
618 Browser* browser = BrowserList::GetLastActive(); | 619 Browser* browser = BrowserList::GetLastActive(); |
619 DCHECK(browser); | 620 DCHECK(browser); |
620 browser->OpenURL(GURL("about:memory"), GURL(), NEW_FOREGROUND_TAB, | 621 browser->OpenURL(GURL(chrome::kAboutMemoryURL), GURL(), NEW_FOREGROUND_TAB, |
621 PageTransition::LINK); | 622 PageTransition::LINK); |
622 // In case the browser window is minimzed, show it. If this is an application | 623 // In case the browser window is minimzed, show it. If this is an application |
623 // or popup, we can only have one tab, hence we need to process this in a | 624 // or popup, we can only have one tab, hence we need to process this in a |
624 // tabbed browser window. Currently, |browser| is pointing to the application, | 625 // tabbed browser window. Currently, |browser| is pointing to the application, |
625 // popup window. Therefore, we have to retrieve the last active tab again, | 626 // popup window. Therefore, we have to retrieve the last active tab again, |
626 // since a new window has been used. | 627 // since a new window has been used. |
627 if (browser->type() & Browser::TYPE_APP_POPUP) { | 628 if (browser->type() & Browser::TYPE_APP_POPUP) { |
628 browser = BrowserList::GetLastActive(); | 629 browser = BrowserList::GetLastActive(); |
629 DCHECK(browser); | 630 DCHECK(browser); |
630 } | 631 } |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
754 TaskManagerGtk* task_manager) { | 755 TaskManagerGtk* task_manager) { |
755 if (keyval == GDK_w && modifier == GDK_CONTROL_MASK) { | 756 if (keyval == GDK_w && modifier == GDK_CONTROL_MASK) { |
756 // The GTK_RESPONSE_DELETE_EVENT response must be sent before the widget | 757 // The GTK_RESPONSE_DELETE_EVENT response must be sent before the widget |
757 // is destroyed. The deleted object will receive gtk signals otherwise. | 758 // is destroyed. The deleted object will receive gtk signals otherwise. |
758 gtk_dialog_response(GTK_DIALOG(task_manager->dialog_), | 759 gtk_dialog_response(GTK_DIALOG(task_manager->dialog_), |
759 GTK_RESPONSE_DELETE_EVENT); | 760 GTK_RESPONSE_DELETE_EVENT); |
760 } | 761 } |
761 | 762 |
762 return TRUE; | 763 return TRUE; |
763 } | 764 } |
OLD | NEW |