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" |
11 #include "chrome/app/chrome_command_ids.h" | 11 #include "chrome/app/chrome_command_ids.h" |
12 #include "chrome/browser/browser_list.h" | 12 #include "chrome/browser/browser_list.h" |
13 #include "chrome/browser/browser_process.h" | 13 #include "chrome/browser/browser_process.h" |
14 #include "chrome/browser/browser_window.h" | 14 #include "chrome/browser/browser_window.h" |
15 #include "chrome/browser/memory_purger.h" | 15 #include "chrome/browser/memory_purger.h" |
16 #include "chrome/browser/prefs/pref_service.h" | 16 #include "chrome/browser/prefs/pref_service.h" |
| 17 #include "chrome/browser/prefs/scoped_user_pref_update.h" |
17 #include "chrome/browser/ui/views/browser_dialogs.h" | 18 #include "chrome/browser/ui/views/browser_dialogs.h" |
18 #include "chrome/common/chrome_switches.h" | 19 #include "chrome/common/chrome_switches.h" |
19 #include "chrome/common/pref_names.h" | 20 #include "chrome/common/pref_names.h" |
20 #include "grit/chromium_strings.h" | 21 #include "grit/chromium_strings.h" |
21 #include "grit/generated_resources.h" | 22 #include "grit/generated_resources.h" |
22 #include "grit/theme_resources.h" | 23 #include "grit/theme_resources.h" |
23 #include "ui/base/l10n/l10n_util.h" | 24 #include "ui/base/l10n/l10n_util.h" |
24 #include "ui/base/models/table_model_observer.h" | 25 #include "ui/base/models/table_model_observer.h" |
25 #include "views/accelerator.h" | 26 #include "views/accelerator.h" |
26 #include "views/background.h" | 27 #include "views/background.h" |
(...skipping 588 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
615 menu_info.fMask = MIIM_STATE; | 616 menu_info.fMask = MIIM_STATE; |
616 if (is_always_on_top_) | 617 if (is_always_on_top_) |
617 menu_info.fState = MFS_CHECKED; | 618 menu_info.fState = MFS_CHECKED; |
618 r = SetMenuItemInfo(system_menu, IDC_ALWAYS_ON_TOP, FALSE, &menu_info); | 619 r = SetMenuItemInfo(system_menu, IDC_ALWAYS_ON_TOP, FALSE, &menu_info); |
619 | 620 |
620 // Now change the actual window's behavior. | 621 // Now change the actual window's behavior. |
621 window()->SetIsAlwaysOnTop(is_always_on_top_); | 622 window()->SetIsAlwaysOnTop(is_always_on_top_); |
622 | 623 |
623 // Save the state. | 624 // Save the state. |
624 if (g_browser_process->local_state()) { | 625 if (g_browser_process->local_state()) { |
625 DictionaryValue* window_preferences = | 626 DictionaryPrefUpdate update(g_browser_process->local_state(), |
626 g_browser_process->local_state()->GetMutableDictionary( | 627 WideToUTF8(GetWindowName()).c_str()); |
627 WideToUTF8(GetWindowName()).c_str()); | 628 DictionaryValue* window_preferences = update.Get(); |
628 window_preferences->SetBoolean("always_on_top", is_always_on_top_); | 629 window_preferences->SetBoolean("always_on_top", is_always_on_top_); |
629 } | 630 } |
630 return true; | 631 return true; |
631 } | 632 } |
632 return false; | 633 return false; |
633 } | 634 } |
634 | 635 |
635 std::wstring TaskManagerView::GetWindowTitle() const { | 636 std::wstring TaskManagerView::GetWindowTitle() const { |
636 return UTF16ToWide(l10n_util::GetStringUTF16(IDS_TASK_MANAGER_TITLE)); | 637 return UTF16ToWide(l10n_util::GetStringUTF16(IDS_TASK_MANAGER_TITLE)); |
637 } | 638 } |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
772 // Declared in browser_dialogs.h so others don't need to depend on our header. | 773 // Declared in browser_dialogs.h so others don't need to depend on our header. |
773 void ShowTaskManager() { | 774 void ShowTaskManager() { |
774 TaskManagerView::Show(false); | 775 TaskManagerView::Show(false); |
775 } | 776 } |
776 | 777 |
777 void ShowBackgroundPages() { | 778 void ShowBackgroundPages() { |
778 TaskManagerView::Show(true); | 779 TaskManagerView::Show(true); |
779 } | 780 } |
780 | 781 |
781 } // namespace browser | 782 } // namespace browser |
OLD | NEW |