| 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_tree.h" | 25 #include "chrome/browser/ui/gtk/gtk_tree.h" |
| 25 #include "chrome/browser/ui/gtk/gtk_util.h" | 26 #include "chrome/browser/ui/gtk/gtk_util.h" |
| 27 #include "chrome/browser/ui/gtk/gtk_theme_service.h" |
| 26 #include "chrome/browser/ui/gtk/menu_gtk.h" | 28 #include "chrome/browser/ui/gtk/menu_gtk.h" |
| 27 #include "chrome/browser/ui/gtk/theme_service_gtk.h" | |
| 28 #include "chrome/common/chrome_switches.h" | 29 #include "chrome/common/chrome_switches.h" |
| 29 #include "chrome/common/pref_names.h" | 30 #include "chrome/common/pref_names.h" |
| 30 #include "grit/chromium_strings.h" | 31 #include "grit/chromium_strings.h" |
| 31 #include "grit/ui_resources.h" | 32 #include "grit/ui_resources.h" |
| 32 #include "third_party/skia/include/core/SkBitmap.h" | 33 #include "third_party/skia/include/core/SkBitmap.h" |
| 33 #include "ui/base/gtk/gtk_hig_constants.h" | 34 #include "ui/base/gtk/gtk_hig_constants.h" |
| 34 #include "ui/base/l10n/l10n_util.h" | 35 #include "ui/base/l10n/l10n_util.h" |
| 35 #include "ui/base/models/simple_menu_model.h" | 36 #include "ui/base/models/simple_menu_model.h" |
| 36 #include "ui/base/resource/resource_bundle.h" | 37 #include "ui/base/resource/resource_bundle.h" |
| 37 #include "ui/gfx/gtk_util.h" | 38 #include "ui/gfx/gtk_util.h" |
| (...skipping 673 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 711 return std::string(); | 712 return std::string(); |
| 712 } | 713 } |
| 713 } | 714 } |
| 714 | 715 |
| 715 GdkPixbuf* TaskManagerGtk::GetModelIcon(int row) { | 716 GdkPixbuf* TaskManagerGtk::GetModelIcon(int row) { |
| 716 SkBitmap icon = model_->GetResourceIcon(row); | 717 SkBitmap icon = model_->GetResourceIcon(row); |
| 717 if (icon.pixelRef() == | 718 if (icon.pixelRef() == |
| 718 ui::ResourceBundle::GetSharedInstance().GetBitmapNamed( | 719 ui::ResourceBundle::GetSharedInstance().GetBitmapNamed( |
| 719 IDR_DEFAULT_FAVICON)->pixelRef()) { | 720 IDR_DEFAULT_FAVICON)->pixelRef()) { |
| 720 return static_cast<GdkPixbuf*>(g_object_ref( | 721 return static_cast<GdkPixbuf*>(g_object_ref( |
| 721 ThemeServiceGtk::GetDefaultFavicon(true)->ToGdkPixbuf())); | 722 GtkThemeService::GetDefaultFavicon(true)->ToGdkPixbuf())); |
| 722 } | 723 } |
| 723 | 724 |
| 724 return gfx::GdkPixbufFromSkBitmap(&icon); | 725 return gfx::GdkPixbufFromSkBitmap(&icon); |
| 725 } | 726 } |
| 726 | 727 |
| 727 void TaskManagerGtk::SetRowDataFromModel(int row, GtkTreeIter* iter) { | 728 void TaskManagerGtk::SetRowDataFromModel(int row, GtkTreeIter* iter) { |
| 728 GdkPixbuf* icon = GetModelIcon(row); | 729 GdkPixbuf* icon = GetModelIcon(row); |
| 729 std::string task = GetModelText(row, IDS_TASK_MANAGER_TASK_COLUMN); | 730 std::string task = GetModelText(row, IDS_TASK_MANAGER_TASK_COLUMN); |
| 730 std::string profile_name = | 731 std::string profile_name = |
| 731 GetModelText(row, IDS_TASK_MANAGER_PROFILE_NAME_COLUMN); | 732 GetModelText(row, IDS_TASK_MANAGER_PROFILE_NAME_COLUMN); |
| (...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 966 guint keyval, | 967 guint keyval, |
| 967 GdkModifierType modifier) { | 968 GdkModifierType modifier) { |
| 968 if (keyval == GDK_w && modifier == GDK_CONTROL_MASK) { | 969 if (keyval == GDK_w && modifier == GDK_CONTROL_MASK) { |
| 969 // 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 |
| 970 // is destroyed. The deleted object will receive gtk signals otherwise. | 971 // is destroyed. The deleted object will receive gtk signals otherwise. |
| 971 gtk_dialog_response(GTK_DIALOG(dialog_), GTK_RESPONSE_DELETE_EVENT); | 972 gtk_dialog_response(GTK_DIALOG(dialog_), GTK_RESPONSE_DELETE_EVENT); |
| 972 } | 973 } |
| 973 | 974 |
| 974 return TRUE; | 975 return TRUE; |
| 975 } | 976 } |
| OLD | NEW |