Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(23)

Side by Side Diff: chrome/browser/ui/cocoa/task_manager_mac.mm

Issue 2724923004: cocoa: add --use-views-task-manager (Closed)
Patch Set: Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | chrome/common/chrome_switches.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/cocoa/task_manager_mac.h" 5 #include "chrome/browser/ui/cocoa/task_manager_mac.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <vector> 10 #include <vector>
11 11
12 #include "base/command_line.h"
12 #include "base/mac/bundle_locations.h" 13 #include "base/mac/bundle_locations.h"
13 #include "base/macros.h" 14 #include "base/macros.h"
14 #include "base/strings/sys_string_conversions.h" 15 #include "base/strings/sys_string_conversions.h"
15 #include "chrome/browser/browser_process.h" 16 #include "chrome/browser/browser_process.h"
16 #include "chrome/browser/chrome_notification_types.h" 17 #include "chrome/browser/chrome_notification_types.h"
17 #include "chrome/browser/task_manager/task_manager_interface.h" 18 #include "chrome/browser/task_manager/task_manager_interface.h"
18 #include "chrome/browser/ui/browser.h" 19 #include "chrome/browser/ui/browser.h"
19 #include "chrome/browser/ui/browser_dialogs.h" 20 #include "chrome/browser/ui/browser_dialogs.h"
20 #import "chrome/browser/ui/cocoa/window_size_autosaver.h" 21 #import "chrome/browser/ui/cocoa/window_size_autosaver.h"
21 #include "chrome/browser/ui/task_manager/task_manager_columns.h" 22 #include "chrome/browser/ui/task_manager/task_manager_columns.h"
23 #include "chrome/common/chrome_switches.h"
tapted 2017/03/02 22:44:39 I think base/feature_list.h is the shiny new way t
shrike 2017/03/02 23:58:05 We do need a chrome://flag entry. I look at MacVie
tapted 2017/03/07 22:52:26 Per ^^^, is there a reason to not want to use base
22 #include "chrome/common/pref_names.h" 24 #include "chrome/common/pref_names.h"
23 #include "chrome/grit/generated_resources.h" 25 #include "chrome/grit/generated_resources.h"
24 #include "components/prefs/pref_service.h" 26 #include "components/prefs/pref_service.h"
25 #include "content/public/browser/notification_service.h" 27 #include "content/public/browser/notification_service.h"
26 #include "content/public/browser/notification_source.h" 28 #include "content/public/browser/notification_source.h"
27 #include "third_party/skia/include/core/SkBitmap.h" 29 #include "third_party/skia/include/core/SkBitmap.h"
28 #include "ui/base/l10n/l10n_util_mac.h" 30 #include "ui/base/l10n/l10n_util_mac.h"
29 #include "ui/gfx/image/image_skia.h" 31 #include "ui/gfx/image/image_skia.h"
30 #include "ui/gfx/image/image_skia_util_mac.h" 32 #include "ui/gfx/image/image_skia_util_mac.h"
31 33
32 namespace { 34 namespace {
33 35
34 NSString* ColumnIdentifier(int id) { 36 NSString* ColumnIdentifier(int id) {
35 return [NSString stringWithFormat:@"%d", id]; 37 return [NSString stringWithFormat:@"%d", id];
36 } 38 }
37 39
40 bool ShouldUseViewsTaskManager() {
41 return base::CommandLine::ForCurrentProcess()->HasSwitch(
42 switches::kUseViewsTaskManager);
43 }
44
38 } // namespace 45 } // namespace
39 46
40 @interface TaskManagerWindowController (Private) 47 @interface TaskManagerWindowController (Private)
41 - (NSTableColumn*)addColumnWithData: 48 - (NSTableColumn*)addColumnWithData:
42 (const task_manager::TableColumnData&)columnData; 49 (const task_manager::TableColumnData&)columnData;
43 - (void)setUpTableColumns; 50 - (void)setUpTableColumns;
44 - (void)setUpTableHeaderContextMenu; 51 - (void)setUpTableHeaderContextMenu;
45 - (void)toggleColumn:(id)sender; 52 - (void)toggleColumn:(id)sender;
46 - (void)adjustSelectionAndEndProcessButton; 53 - (void)adjustSelectionAndEndProcessButton;
47 - (void)deselectRows; 54 - (void)deselectRows;
(...skipping 584 matching lines...) Expand 10 before | Expand all | Expand 10 after
632 if (instance_) 639 if (instance_)
633 [instance_->window_controller_ close]; 640 [instance_->window_controller_ close];
634 } 641 }
635 642
636 } // namespace task_manager 643 } // namespace task_manager
637 644
638 namespace chrome { 645 namespace chrome {
639 646
640 // Declared in browser_dialogs.h. 647 // Declared in browser_dialogs.h.
641 task_manager::TaskManagerTableModel* ShowTaskManager(Browser* browser) { 648 task_manager::TaskManagerTableModel* ShowTaskManager(Browser* browser) {
649 if (ShouldUseViewsTaskManager())
650 return chrome::ShowTaskManagerViews(browser);
642 return task_manager::TaskManagerMac::Show(); 651 return task_manager::TaskManagerMac::Show();
643 } 652 }
644 653
645 void HideTaskManager() { 654 void HideTaskManager() {
655 if (ShouldUseViewsTaskManager())
656 return chrome::HideTaskManagerViews();
646 task_manager::TaskManagerMac::Hide(); 657 task_manager::TaskManagerMac::Hide();
647 } 658 }
648 659
649 } // namespace chrome 660 } // namespace chrome
OLDNEW
« no previous file with comments | « no previous file | chrome/common/chrome_switches.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698