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

Side by Side Diff: chrome/browser/ui/views/task_manager_view.cc

Issue 1336823003: Move chrome::HostDesktopType to ui::HostDesktopType (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@base_session_service_delegate_impl
Patch Set: Fix build on Mac and CrOS Created 5 years, 3 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
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/task_manager/task_manager.h" 5 #include "chrome/browser/task_manager/task_manager.h"
6 6
7 #include "base/compiler_specific.h" 7 #include "base/compiler_specific.h"
8 #include "base/prefs/pref_service.h" 8 #include "base/prefs/pref_service.h"
9 #include "base/prefs/scoped_user_pref_update.h" 9 #include "base/prefs/scoped_user_pref_update.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 } 143 }
144 144
145 // The Task Manager UI container. 145 // The Task Manager UI container.
146 class TaskManagerView : public views::ButtonListener, 146 class TaskManagerView : public views::ButtonListener,
147 public views::DialogDelegateView, 147 public views::DialogDelegateView,
148 public views::TableViewObserver, 148 public views::TableViewObserver,
149 public views::LinkListener, 149 public views::LinkListener,
150 public views::ContextMenuController, 150 public views::ContextMenuController,
151 public ui::SimpleMenuModel::Delegate { 151 public ui::SimpleMenuModel::Delegate {
152 public: 152 public:
153 explicit TaskManagerView(chrome::HostDesktopType desktop_type); 153 explicit TaskManagerView(ui::HostDesktopType desktop_type);
154 ~TaskManagerView() override; 154 ~TaskManagerView() override;
155 155
156 // Shows the Task Manager window, or re-activates an existing one. 156 // Shows the Task Manager window, or re-activates an existing one.
157 static void Show(Browser* browser); 157 static void Show(Browser* browser);
158 158
159 // Hides the Task Manager if it is showing. 159 // Hides the Task Manager if it is showing.
160 static void Hide(); 160 static void Hide();
161 161
162 // views::View: 162 // views::View:
163 void Layout() override; 163 void Layout() override;
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 224
225 // all possible columns, not necessarily visible 225 // all possible columns, not necessarily visible
226 std::vector<ui::TableColumn> columns_; 226 std::vector<ui::TableColumn> columns_;
227 227
228 scoped_ptr<TaskManagerTableModel> table_model_; 228 scoped_ptr<TaskManagerTableModel> table_model_;
229 229
230 // True when the Task Manager window should be shown on top of other windows. 230 // True when the Task Manager window should be shown on top of other windows.
231 bool is_always_on_top_; 231 bool is_always_on_top_;
232 232
233 // The host desktop type this task manager belongs to. 233 // The host desktop type this task manager belongs to.
234 const chrome::HostDesktopType desktop_type_; 234 const ui::HostDesktopType desktop_type_;
235 235
236 // We need to own the text of the menu, the Windows API does not copy it. 236 // We need to own the text of the menu, the Windows API does not copy it.
237 base::string16 always_on_top_menu_text_; 237 base::string16 always_on_top_menu_text_;
238 238
239 // An open Task manager window. There can only be one open at a time. This 239 // An open Task manager window. There can only be one open at a time. This
240 // is reset to NULL when the window is closed. 240 // is reset to NULL when the window is closed.
241 static TaskManagerView* instance_; 241 static TaskManagerView* instance_;
242 242
243 scoped_ptr<views::MenuRunner> menu_runner_; 243 scoped_ptr<views::MenuRunner> menu_runner_;
244 244
245 DISALLOW_COPY_AND_ASSIGN(TaskManagerView); 245 DISALLOW_COPY_AND_ASSIGN(TaskManagerView);
246 }; 246 };
247 247
248 // static 248 // static
249 TaskManagerView* TaskManagerView::instance_ = NULL; 249 TaskManagerView* TaskManagerView::instance_ = NULL;
250 250
251 251 TaskManagerView::TaskManagerView(ui::HostDesktopType desktop_type)
252 TaskManagerView::TaskManagerView(chrome::HostDesktopType desktop_type)
253 : kill_button_(NULL), 252 : kill_button_(NULL),
254 about_memory_link_(NULL), 253 about_memory_link_(NULL),
255 tab_table_(NULL), 254 tab_table_(NULL),
256 tab_table_parent_(NULL), 255 tab_table_parent_(NULL),
257 task_manager_(TaskManager::GetInstance()), 256 task_manager_(TaskManager::GetInstance()),
258 model_(TaskManager::GetInstance()->model()), 257 model_(TaskManager::GetInstance()->model()),
259 is_always_on_top_(false), 258 is_always_on_top_(false),
260 desktop_type_(desktop_type) { 259 desktop_type_(desktop_type) {
261 Init(); 260 Init();
262 } 261 }
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
442 DCHECK_EQ(ui::VKEY_W, accelerator.key_code()); 441 DCHECK_EQ(ui::VKEY_W, accelerator.key_code());
443 DCHECK_EQ(ui::EF_CONTROL_DOWN, accelerator.modifiers()); 442 DCHECK_EQ(ui::EF_CONTROL_DOWN, accelerator.modifiers());
444 GetWidget()->Close(); 443 GetWidget()->Close();
445 return true; 444 return true;
446 } 445 }
447 446
448 // static 447 // static
449 void TaskManagerView::Show(Browser* browser) { 448 void TaskManagerView::Show(Browser* browser) {
450 // In ash we can come here through the ChromeShellDelegate. If there is no 449 // In ash we can come here through the ChromeShellDelegate. If there is no
451 // browser window at that time of the call, browser could be passed as NULL. 450 // browser window at that time of the call, browser could be passed as NULL.
452 const chrome::HostDesktopType desktop_type = 451 const ui::HostDesktopType desktop_type =
453 browser ? browser->host_desktop_type() : chrome::HOST_DESKTOP_TYPE_ASH; 452 browser ? browser->host_desktop_type() : ui::HOST_DESKTOP_TYPE_ASH;
454 453
455 if (instance_) { 454 if (instance_) {
456 // If there's a Task manager window open already, just activate it. 455 // If there's a Task manager window open already, just activate it.
457 instance_->GetWidget()->Activate(); 456 instance_->GetWidget()->Activate();
458 return; 457 return;
459 } 458 }
460 instance_ = new TaskManagerView(desktop_type); 459 instance_ = new TaskManagerView(desktop_type);
461 gfx::NativeWindow window = 460 gfx::NativeWindow window =
462 browser ? browser->window()->GetNativeWindow() : NULL; 461 browser ? browser->window()->GetNativeWindow() : NULL;
463 #if defined(USE_ASH) 462 #if defined(USE_ASH)
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
658 void HideTaskManager() { 657 void HideTaskManager() {
659 if (switches::NewTaskManagerEnabled()) { 658 if (switches::NewTaskManagerEnabled()) {
660 task_management::NewTaskManagerView::Hide(); 659 task_management::NewTaskManagerView::Hide();
661 return; 660 return;
662 } 661 }
663 662
664 TaskManagerView::Hide(); 663 TaskManagerView::Hide();
665 } 664 }
666 665
667 } // namespace chrome 666 } // namespace chrome
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698