OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/task_manager/task_manager.h" | 5 #include "chrome/browser/task_manager/task_manager.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
9 #include "base/metrics/stats_table.h" | 9 #include "base/metrics/stats_table.h" |
10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
(...skipping 595 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
606 | 606 |
607 bool TaskManagerView::CanMaximize() const { | 607 bool TaskManagerView::CanMaximize() const { |
608 return true; | 608 return true; |
609 } | 609 } |
610 | 610 |
611 bool TaskManagerView::ExecuteWindowsCommand(int command_id) { | 611 bool TaskManagerView::ExecuteWindowsCommand(int command_id) { |
612 if (command_id == IDC_ALWAYS_ON_TOP) { | 612 if (command_id == IDC_ALWAYS_ON_TOP) { |
613 is_always_on_top_ = !is_always_on_top_; | 613 is_always_on_top_ = !is_always_on_top_; |
614 | 614 |
615 // Change the menu check state. | 615 // Change the menu check state. |
616 HMENU system_menu = GetSystemMenu(GetWindow()->GetNativeWindow(), FALSE); | 616 HMENU system_menu = GetSystemMenu(GetWidget()->GetNativeWindow(), FALSE); |
617 MENUITEMINFO menu_info; | 617 MENUITEMINFO menu_info; |
618 memset(&menu_info, 0, sizeof(MENUITEMINFO)); | 618 memset(&menu_info, 0, sizeof(MENUITEMINFO)); |
619 menu_info.cbSize = sizeof(MENUITEMINFO); | 619 menu_info.cbSize = sizeof(MENUITEMINFO); |
620 BOOL r = GetMenuItemInfo(system_menu, IDC_ALWAYS_ON_TOP, | 620 BOOL r = GetMenuItemInfo(system_menu, IDC_ALWAYS_ON_TOP, |
621 FALSE, &menu_info); | 621 FALSE, &menu_info); |
622 DCHECK(r); | 622 DCHECK(r); |
623 menu_info.fMask = MIIM_STATE; | 623 menu_info.fMask = MIIM_STATE; |
624 if (is_always_on_top_) | 624 if (is_always_on_top_) |
625 menu_info.fState = MFS_CHECKED; | 625 menu_info.fState = MFS_CHECKED; |
626 r = SetMenuItemInfo(system_menu, IDC_ALWAYS_ON_TOP, FALSE, &menu_info); | 626 r = SetMenuItemInfo(system_menu, IDC_ALWAYS_ON_TOP, FALSE, &menu_info); |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
731 } | 731 } |
732 } | 732 } |
733 } | 733 } |
734 | 734 |
735 void TaskManagerView::AddAlwaysOnTopSystemMenuItem() { | 735 void TaskManagerView::AddAlwaysOnTopSystemMenuItem() { |
736 // The Win32 API requires that we own the text. | 736 // The Win32 API requires that we own the text. |
737 always_on_top_menu_text_ = | 737 always_on_top_menu_text_ = |
738 UTF16ToWide(l10n_util::GetStringUTF16(IDS_ALWAYS_ON_TOP)); | 738 UTF16ToWide(l10n_util::GetStringUTF16(IDS_ALWAYS_ON_TOP)); |
739 | 739 |
740 // Let's insert a menu to the window. | 740 // Let's insert a menu to the window. |
741 HMENU system_menu = ::GetSystemMenu(GetWindow()->GetNativeWindow(), FALSE); | 741 HMENU system_menu = ::GetSystemMenu(GetWidget()->GetNativeWindow(), FALSE); |
742 int index = ::GetMenuItemCount(system_menu) - 1; | 742 int index = ::GetMenuItemCount(system_menu) - 1; |
743 if (index < 0) { | 743 if (index < 0) { |
744 // Paranoia check. | 744 // Paranoia check. |
745 NOTREACHED(); | 745 NOTREACHED(); |
746 index = 0; | 746 index = 0; |
747 } | 747 } |
748 // First we add the separator. | 748 // First we add the separator. |
749 MENUITEMINFO menu_info; | 749 MENUITEMINFO menu_info; |
750 memset(&menu_info, 0, sizeof(MENUITEMINFO)); | 750 memset(&menu_info, 0, sizeof(MENUITEMINFO)); |
751 menu_info.cbSize = sizeof(MENUITEMINFO); | 751 menu_info.cbSize = sizeof(MENUITEMINFO); |
(...skipping 30 matching lines...) Expand all Loading... |
782 // Declared in browser_dialogs.h so others don't need to depend on our header. | 782 // Declared in browser_dialogs.h so others don't need to depend on our header. |
783 void ShowTaskManager() { | 783 void ShowTaskManager() { |
784 TaskManagerView::Show(false); | 784 TaskManagerView::Show(false); |
785 } | 785 } |
786 | 786 |
787 void ShowBackgroundPages() { | 787 void ShowBackgroundPages() { |
788 TaskManagerView::Show(true); | 788 TaskManagerView::Show(true); |
789 } | 789 } |
790 | 790 |
791 } // namespace browser | 791 } // namespace browser |
OLD | NEW |