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

Side by Side Diff: chrome/browser/task_management/task_manager_tester.cc

Issue 2148243004: chrome::ShowTaskManager: refine return type to eliminate a downcast. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@triple_click_tm
Patch Set: Fix mac compile. Created 4 years, 5 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/browser/ui/browser_dialogs.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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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_management/task_manager_tester.h" 5 #include "chrome/browser/task_management/task_manager_tester.h"
6 6
7 #include "base/memory/ptr_util.h" 7 #include "base/memory/ptr_util.h"
8 #include "chrome/browser/browser_process.h" 8 #include "chrome/browser/browser_process.h"
9 #include "chrome/browser/profiles/profile.h" 9 #include "chrome/browser/profiles/profile.h"
10 #include "chrome/browser/sessions/session_tab_helper.h" 10 #include "chrome/browser/sessions/session_tab_helper.h"
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 138
139 void Kill(int row) override { model_->KillTask(row); } 139 void Kill(int row) override { model_->KillTask(row); }
140 140
141 private: 141 private:
142 task_management::TaskManagerInterface* task_manager() { 142 task_management::TaskManagerInterface* task_manager() {
143 return model_->observed_task_manager(); 143 return model_->observed_task_manager();
144 } 144 }
145 145
146 // Returns the TaskManagerTableModel for the the visible NewTaskManagerView. 146 // Returns the TaskManagerTableModel for the the visible NewTaskManagerView.
147 static task_management::TaskManagerTableModel* GetRealModel() { 147 static task_management::TaskManagerTableModel* GetRealModel() {
148 // This downcast is safe, as long as the new task manager is enabled. 148 return chrome::ShowTaskManager(nullptr);
149 task_management::TaskManagerTableModel* result =
150 static_cast<task_management::TaskManagerTableModel*>(
151 chrome::ShowTaskManager(nullptr));
152 return result;
153 } 149 }
154 150
155 task_management::TaskManagerTableModel* model_; 151 task_management::TaskManagerTableModel* model_;
156 std::unique_ptr<ScopedInterceptTableModelObserver> interceptor_; 152 std::unique_ptr<ScopedInterceptTableModelObserver> interceptor_;
157 }; 153 };
158 154
159 // static 155 // static
160 std::unique_ptr<TaskManagerTester> TaskManagerTester::CreateDefault( 156 std::unique_ptr<TaskManagerTester> TaskManagerTester::CreateDefault(
161 const base::Closure& callback) { 157 const base::Closure& callback) {
162 return base::WrapUnique(new TaskManagerTesterImpl(callback)); 158 return base::WrapUnique(new TaskManagerTesterImpl(callback));
163 } 159 }
164 160
165 } // namespace task_management 161 } // namespace task_management
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/browser_dialogs.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698