| OLD | NEW |
| 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/gtk/task_manager_gtk.h" | 5 #include "chrome/browser/ui/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 <set> | 10 #include <set> |
| 11 #include <utility> | 11 #include <utility> |
| 12 #include <vector> | 12 #include <vector> |
| 13 | 13 |
| 14 #include "base/auto_reset.h" | 14 #include "base/auto_reset.h" |
| 15 #include "base/command_line.h" | 15 #include "base/command_line.h" |
| 16 #include "base/logging.h" | 16 #include "base/logging.h" |
| 17 #include "base/utf_string_conversions.h" | 17 #include "base/utf_string_conversions.h" |
| 18 #include "chrome/browser/browser_process.h" | 18 #include "chrome/browser/browser_process.h" |
| 19 #include "chrome/browser/defaults.h" | 19 #include "chrome/browser/defaults.h" |
| 20 #include "chrome/browser/memory_purger.h" | 20 #include "chrome/browser/memory_purger.h" |
| 21 #include "chrome/browser/prefs/pref_service.h" | 21 #include "chrome/browser/prefs/pref_service.h" |
| 22 #include "chrome/browser/prefs/scoped_user_pref_update.h" | 22 #include "chrome/browser/prefs/scoped_user_pref_update.h" |
| 23 #include "chrome/browser/ui/gtk/gtk_chrome_link_button.h" | 23 #include "chrome/browser/ui/gtk/gtk_chrome_link_button.h" |
| 24 #include "chrome/browser/ui/gtk/gtk_theme_service.h" | 24 #include "chrome/browser/ui/gtk/gtk_theme_service.h" |
| 25 #include "chrome/browser/ui/gtk/gtk_theme_service.h" |
| 25 #include "chrome/browser/ui/gtk/gtk_tree.h" | 26 #include "chrome/browser/ui/gtk/gtk_tree.h" |
| 26 #include "chrome/browser/ui/gtk/gtk_util.h" | 27 #include "chrome/browser/ui/gtk/gtk_util.h" |
| 27 #include "chrome/browser/ui/gtk/gtk_theme_service.h" | |
| 28 #include "chrome/browser/ui/gtk/menu_gtk.h" | 28 #include "chrome/browser/ui/gtk/menu_gtk.h" |
| 29 #include "chrome/common/chrome_switches.h" | 29 #include "chrome/common/chrome_switches.h" |
| 30 #include "chrome/common/pref_names.h" | 30 #include "chrome/common/pref_names.h" |
| 31 #include "grit/chromium_strings.h" | 31 #include "grit/chromium_strings.h" |
| 32 #include "grit/ui_resources.h" | 32 #include "grit/ui_resources.h" |
| 33 #include "third_party/skia/include/core/SkBitmap.h" | 33 #include "third_party/skia/include/core/SkBitmap.h" |
| 34 #include "ui/base/gtk/gtk_hig_constants.h" | 34 #include "ui/base/gtk/gtk_hig_constants.h" |
| 35 #include "ui/base/gtk/menu_label_accelerator_util.h" |
| 35 #include "ui/base/l10n/l10n_util.h" | 36 #include "ui/base/l10n/l10n_util.h" |
| 36 #include "ui/base/models/simple_menu_model.h" | 37 #include "ui/base/models/simple_menu_model.h" |
| 37 #include "ui/base/resource/resource_bundle.h" | 38 #include "ui/base/resource/resource_bundle.h" |
| 38 #include "ui/gfx/gtk_util.h" | 39 #include "ui/gfx/gtk_util.h" |
| 39 #include "ui/gfx/image/image.h" | 40 #include "ui/gfx/image/image.h" |
| 40 #include "ui/gfx/linux_util.h" | |
| 41 | 41 |
| 42 namespace { | 42 namespace { |
| 43 | 43 |
| 44 // The task manager window default size. | 44 // The task manager window default size. |
| 45 const int kDefaultWidth = 460; | 45 const int kDefaultWidth = 460; |
| 46 const int kDefaultHeight = 270; | 46 const int kDefaultHeight = 270; |
| 47 | 47 |
| 48 // The resource id for the 'End process' button. | 48 // The resource id for the 'End process' button. |
| 49 const gint kTaskManagerResponseKill = 1; | 49 const gint kTaskManagerResponseKill = 1; |
| 50 | 50 |
| (...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 446 kTaskManagerPurgeMemory); | 446 kTaskManagerPurgeMemory); |
| 447 } | 447 } |
| 448 | 448 |
| 449 if (browser_defaults::kShowCancelButtonInTaskManager) { | 449 if (browser_defaults::kShowCancelButtonInTaskManager) { |
| 450 gtk_dialog_add_button(GTK_DIALOG(dialog_), | 450 gtk_dialog_add_button(GTK_DIALOG(dialog_), |
| 451 l10n_util::GetStringUTF8(IDS_CLOSE).c_str(), | 451 l10n_util::GetStringUTF8(IDS_CLOSE).c_str(), |
| 452 GTK_RESPONSE_DELETE_EVENT); | 452 GTK_RESPONSE_DELETE_EVENT); |
| 453 } | 453 } |
| 454 | 454 |
| 455 gtk_dialog_add_button(GTK_DIALOG(dialog_), | 455 gtk_dialog_add_button(GTK_DIALOG(dialog_), |
| 456 gfx::ConvertAcceleratorsFromWindowsStyle( | 456 ui::ConvertAcceleratorsFromWindowsStyle( |
| 457 l10n_util::GetStringUTF8(IDS_TASK_MANAGER_KILL)).c_str(), | 457 l10n_util::GetStringUTF8(IDS_TASK_MANAGER_KILL)).c_str(), |
| 458 kTaskManagerResponseKill); | 458 kTaskManagerResponseKill); |
| 459 | 459 |
| 460 // The response button should not be sensitive when the dialog is first opened | 460 // The response button should not be sensitive when the dialog is first opened |
| 461 // because the selection is initially empty. | 461 // because the selection is initially empty. |
| 462 gtk_dialog_set_response_sensitive(GTK_DIALOG(dialog_), | 462 gtk_dialog_set_response_sensitive(GTK_DIALOG(dialog_), |
| 463 kTaskManagerResponseKill, FALSE); | 463 kTaskManagerResponseKill, FALSE); |
| 464 | 464 |
| 465 GtkWidget* link = gtk_chrome_link_button_new( | 465 GtkWidget* link = gtk_chrome_link_button_new( |
| 466 l10n_util::GetStringUTF8(IDS_TASK_MANAGER_ABOUT_MEMORY_LINK).c_str()); | 466 l10n_util::GetStringUTF8(IDS_TASK_MANAGER_ABOUT_MEMORY_LINK).c_str()); |
| (...skipping 500 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 967 guint keyval, | 967 guint keyval, |
| 968 GdkModifierType modifier) { | 968 GdkModifierType modifier) { |
| 969 if (keyval == GDK_w && modifier == GDK_CONTROL_MASK) { | 969 if (keyval == GDK_w && modifier == GDK_CONTROL_MASK) { |
| 970 // The GTK_RESPONSE_DELETE_EVENT response must be sent before the widget | 970 // The GTK_RESPONSE_DELETE_EVENT response must be sent before the widget |
| 971 // is destroyed. The deleted object will receive gtk signals otherwise. | 971 // is destroyed. The deleted object will receive gtk signals otherwise. |
| 972 gtk_dialog_response(GTK_DIALOG(dialog_), GTK_RESPONSE_DELETE_EVENT); | 972 gtk_dialog_response(GTK_DIALOG(dialog_), GTK_RESPONSE_DELETE_EVENT); |
| 973 } | 973 } |
| 974 | 974 |
| 975 return TRUE; | 975 return TRUE; |
| 976 } | 976 } |
| OLD | NEW |