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

Side by Side Diff: chrome/browser/ui/task_manager/task_manager_table_model.cc

Issue 2146273002: TaskManager: when shown or activated, select the last active tab. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@triple_click_tm
Patch Set: Fix compile. Created 4 years, 4 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/task_manager/task_manager_table_model.h" 5 #include "chrome/browser/ui/task_manager/task_manager_table_model.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/i18n/number_formatting.h" 10 #include "base/i18n/number_formatting.h"
(...skipping 779 matching lines...) Expand 10 before | Expand all | Expand 10 after
790 } 790 }
791 } 791 }
792 792
793 void TaskManagerTableModel::ToggleColumnVisibility(int column_id) { 793 void TaskManagerTableModel::ToggleColumnVisibility(int column_id) {
794 bool new_visibility = !table_view_delegate_->IsColumnVisible(column_id); 794 bool new_visibility = !table_view_delegate_->IsColumnVisible(column_id);
795 table_view_delegate_->SetColumnVisibility(column_id, new_visibility); 795 table_view_delegate_->SetColumnVisibility(column_id, new_visibility);
796 columns_settings_->SetBoolean(GetColumnIdAsString(column_id), new_visibility); 796 columns_settings_->SetBoolean(GetColumnIdAsString(column_id), new_visibility);
797 UpdateRefreshTypes(column_id, new_visibility); 797 UpdateRefreshTypes(column_id, new_visibility);
798 } 798 }
799 799
800 int TaskManagerTableModel::GetRowForWebContents(
801 content::WebContents* web_contents) {
802 TaskId task_id =
803 observed_task_manager()->GetTaskIdForWebContents(web_contents);
804 auto index = std::find(tasks_.begin(), tasks_.end(), task_id);
805 if (index == tasks_.end())
806 return -1;
807 return static_cast<int>(index - tasks_.begin());
808 }
809
800 void TaskManagerTableModel::StartUpdating() { 810 void TaskManagerTableModel::StartUpdating() {
801 TaskManagerInterface::GetTaskManager()->AddObserver(this); 811 TaskManagerInterface::GetTaskManager()->AddObserver(this);
802 tasks_ = observed_task_manager()->GetTaskIdsList(); 812 tasks_ = observed_task_manager()->GetTaskIdsList();
803 OnRefresh(); 813 OnRefresh();
804 814
805 // In order for the scrollbar of the TableView to work properly on startup of 815 // In order for the scrollbar of the TableView to work properly on startup of
806 // the task manager, we must invoke TableModelObserver::OnModelChanged() which 816 // the task manager, we must invoke TableModelObserver::OnModelChanged() which
807 // in turn will invoke TableView::NumRowsChanged(). This will adjust the 817 // in turn will invoke TableView::NumRowsChanged(). This will adjust the
808 // vertical scrollbar correctly. crbug.com/570966. 818 // vertical scrollbar correctly. crbug.com/570966.
809 if (table_model_observer_) 819 if (table_model_observer_)
(...skipping 12 matching lines...) Expand all
822 bool TaskManagerTableModel::IsTaskFirstInGroup(int row_index) const { 832 bool TaskManagerTableModel::IsTaskFirstInGroup(int row_index) const {
823 if (row_index == 0) 833 if (row_index == 0)
824 return true; 834 return true;
825 835
826 return observed_task_manager()->GetProcessId(tasks_[row_index - 1]) != 836 return observed_task_manager()->GetProcessId(tasks_[row_index - 1]) !=
827 observed_task_manager()->GetProcessId(tasks_[row_index]); 837 observed_task_manager()->GetProcessId(tasks_[row_index]);
828 } 838 }
829 839
830 840
831 } // namespace task_management 841 } // namespace task_management
OLDNEW
« no previous file with comments | « chrome/browser/ui/task_manager/task_manager_table_model.h ('k') | chrome/browser/ui/views/new_task_manager_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698