| 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" | |
| 25 #include "chrome/browser/ui/gtk/gtk_tree.h" | 24 #include "chrome/browser/ui/gtk/gtk_tree.h" |
| 26 #include "chrome/browser/ui/gtk/gtk_util.h" | 25 #include "chrome/browser/ui/gtk/gtk_util.h" |
| 26 #include "chrome/browser/ui/gtk/theme_service_gtk.h" |
| 27 #include "chrome/common/chrome_switches.h" | 27 #include "chrome/common/chrome_switches.h" |
| 28 #include "chrome/common/pref_names.h" | 28 #include "chrome/common/pref_names.h" |
| 29 #include "grit/chromium_strings.h" | 29 #include "grit/chromium_strings.h" |
| 30 #include "grit/ui_resources.h" | 30 #include "grit/ui_resources.h" |
| 31 #include "third_party/skia/include/core/SkBitmap.h" | 31 #include "third_party/skia/include/core/SkBitmap.h" |
| 32 #include "ui/base/gtk/gtk_hig_constants.h" | 32 #include "ui/base/gtk/gtk_hig_constants.h" |
| 33 #include "ui/base/l10n/l10n_util.h" | 33 #include "ui/base/l10n/l10n_util.h" |
| 34 #include "ui/base/models/simple_menu_model.h" | 34 #include "ui/base/models/simple_menu_model.h" |
| 35 #include "ui/base/resource/resource_bundle.h" | 35 #include "ui/base/resource/resource_bundle.h" |
| 36 #include "ui/gfx/gtk_util.h" | 36 #include "ui/gfx/gtk_util.h" |
| (...skipping 703 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 740 return std::string(); | 740 return std::string(); |
| 741 } | 741 } |
| 742 } | 742 } |
| 743 | 743 |
| 744 GdkPixbuf* TaskManagerGtk::GetModelIcon(int row) { | 744 GdkPixbuf* TaskManagerGtk::GetModelIcon(int row) { |
| 745 SkBitmap icon = model_->GetResourceIcon(row); | 745 SkBitmap icon = model_->GetResourceIcon(row); |
| 746 if (icon.pixelRef() == | 746 if (icon.pixelRef() == |
| 747 ui::ResourceBundle::GetSharedInstance().GetBitmapNamed( | 747 ui::ResourceBundle::GetSharedInstance().GetBitmapNamed( |
| 748 IDR_DEFAULT_FAVICON)->pixelRef()) { | 748 IDR_DEFAULT_FAVICON)->pixelRef()) { |
| 749 return static_cast<GdkPixbuf*>(g_object_ref( | 749 return static_cast<GdkPixbuf*>(g_object_ref( |
| 750 GtkThemeService::GetDefaultFavicon(true)->ToGdkPixbuf())); | 750 ThemeServiceGtk::GetDefaultFavicon(true)->ToGdkPixbuf())); |
| 751 } | 751 } |
| 752 | 752 |
| 753 return gfx::GdkPixbufFromSkBitmap(&icon); | 753 return gfx::GdkPixbufFromSkBitmap(&icon); |
| 754 } | 754 } |
| 755 | 755 |
| 756 void TaskManagerGtk::SetRowDataFromModel(int row, GtkTreeIter* iter) { | 756 void TaskManagerGtk::SetRowDataFromModel(int row, GtkTreeIter* iter) { |
| 757 GdkPixbuf* icon = GetModelIcon(row); | 757 GdkPixbuf* icon = GetModelIcon(row); |
| 758 std::string page = GetModelText(row, IDS_TASK_MANAGER_PAGE_COLUMN); | 758 std::string page = GetModelText(row, IDS_TASK_MANAGER_PAGE_COLUMN); |
| 759 std::string profile_name = | 759 std::string profile_name = |
| 760 GetModelText(row, IDS_TASK_MANAGER_PROFILE_NAME_COLUMN); | 760 GetModelText(row, IDS_TASK_MANAGER_PROFILE_NAME_COLUMN); |
| (...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 993 guint keyval, | 993 guint keyval, |
| 994 GdkModifierType modifier) { | 994 GdkModifierType modifier) { |
| 995 if (keyval == GDK_w && modifier == GDK_CONTROL_MASK) { | 995 if (keyval == GDK_w && modifier == GDK_CONTROL_MASK) { |
| 996 // The GTK_RESPONSE_DELETE_EVENT response must be sent before the widget | 996 // The GTK_RESPONSE_DELETE_EVENT response must be sent before the widget |
| 997 // is destroyed. The deleted object will receive gtk signals otherwise. | 997 // is destroyed. The deleted object will receive gtk signals otherwise. |
| 998 gtk_dialog_response(GTK_DIALOG(dialog_), GTK_RESPONSE_DELETE_EVENT); | 998 gtk_dialog_response(GTK_DIALOG(dialog_), GTK_RESPONSE_DELETE_EVENT); |
| 999 } | 999 } |
| 1000 | 1000 |
| 1001 return TRUE; | 1001 return TRUE; |
| 1002 } | 1002 } |
| OLD | NEW |