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/bind.h" | 7 #include "base/bind.h" |
8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
9 #include "base/i18n/number_formatting.h" | 9 #include "base/i18n/number_formatting.h" |
10 #include "base/i18n/rtl.h" | 10 #include "base/i18n/rtl.h" |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 | 118 |
119 void TaskManagerModel::RemoveObserver(TaskManagerModelObserver* observer) { | 119 void TaskManagerModel::RemoveObserver(TaskManagerModelObserver* observer) { |
120 observer_list_.RemoveObserver(observer); | 120 observer_list_.RemoveObserver(observer); |
121 } | 121 } |
122 | 122 |
123 int TaskManagerModel::GetResourceUniqueId(int index) const { | 123 int TaskManagerModel::GetResourceUniqueId(int index) const { |
124 CHECK_LT(index, ResourceCount()); | 124 CHECK_LT(index, ResourceCount()); |
125 return resources_[index]->get_unique_id(); | 125 return resources_[index]->get_unique_id(); |
126 } | 126 } |
127 | 127 |
| 128 int TaskManagerModel::GetResourceIndexByUniqueId(const int unique_id) const { |
| 129 for (int resource_index = 0; resource_index < ResourceCount(); |
| 130 ++resource_index) { |
| 131 if (GetResourceUniqueId(resource_index) == unique_id) |
| 132 return resource_index; |
| 133 } |
| 134 return -1; |
| 135 } |
| 136 |
128 string16 TaskManagerModel::GetResourceTitle(int index) const { | 137 string16 TaskManagerModel::GetResourceTitle(int index) const { |
129 CHECK_LT(index, ResourceCount()); | 138 CHECK_LT(index, ResourceCount()); |
130 return resources_[index]->GetTitle(); | 139 return resources_[index]->GetTitle(); |
131 } | 140 } |
132 | 141 |
133 string16 TaskManagerModel::GetResourceProfileName(int index) const { | 142 string16 TaskManagerModel::GetResourceProfileName(int index) const { |
134 CHECK_LT(index, ResourceCount()); | 143 CHECK_LT(index, ResourceCount()); |
135 return resources_[index]->GetProfileName(); | 144 return resources_[index]->GetProfileName(); |
136 } | 145 } |
137 | 146 |
(...skipping 1000 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1138 // Count the number of extensions with background pages (including | 1147 // Count the number of extensions with background pages (including |
1139 // incognito). | 1148 // incognito). |
1140 count += CountExtensionBackgroundPagesForProfile(profile); | 1149 count += CountExtensionBackgroundPagesForProfile(profile); |
1141 if (profile->HasOffTheRecordProfile()) { | 1150 if (profile->HasOffTheRecordProfile()) { |
1142 count += CountExtensionBackgroundPagesForProfile( | 1151 count += CountExtensionBackgroundPagesForProfile( |
1143 profile->GetOffTheRecordProfile()); | 1152 profile->GetOffTheRecordProfile()); |
1144 } | 1153 } |
1145 } | 1154 } |
1146 return count; | 1155 return count; |
1147 } | 1156 } |
OLD | NEW |