| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/child_process_resource_provider.h" | 5 #include "chrome/browser/task_manager/child_process_resource_provider.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <utility> | 8 #include <utility> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 } | 152 } |
| 153 | 153 |
| 154 int ChildProcessResource::GetUniqueChildProcessId() const { | 154 int ChildProcessResource::GetUniqueChildProcessId() const { |
| 155 return unique_process_id_; | 155 return unique_process_id_; |
| 156 } | 156 } |
| 157 | 157 |
| 158 Resource::Type ChildProcessResource::GetType() const { | 158 Resource::Type ChildProcessResource::GetType() const { |
| 159 // Translate types to Resource::Type, since ChildProcessData's type | 159 // Translate types to Resource::Type, since ChildProcessData's type |
| 160 // is not available for all TaskManager resources. | 160 // is not available for all TaskManager resources. |
| 161 switch (process_type_) { | 161 switch (process_type_) { |
| 162 case content::PROCESS_TYPE_PLUGIN: | |
| 163 case content::PROCESS_TYPE_PPAPI_PLUGIN: | 162 case content::PROCESS_TYPE_PPAPI_PLUGIN: |
| 164 case content::PROCESS_TYPE_PPAPI_BROKER: | 163 case content::PROCESS_TYPE_PPAPI_BROKER: |
| 165 return Resource::PLUGIN; | 164 return Resource::PLUGIN; |
| 166 case content::PROCESS_TYPE_UTILITY: | 165 case content::PROCESS_TYPE_UTILITY: |
| 167 return Resource::UTILITY; | 166 return Resource::UTILITY; |
| 168 case content::PROCESS_TYPE_ZYGOTE: | 167 case content::PROCESS_TYPE_ZYGOTE: |
| 169 return Resource::ZYGOTE; | 168 return Resource::ZYGOTE; |
| 170 case content::PROCESS_TYPE_SANDBOX_HELPER: | 169 case content::PROCESS_TYPE_SANDBOX_HELPER: |
| 171 return Resource::SANDBOX_HELPER; | 170 return Resource::SANDBOX_HELPER; |
| 172 case content::PROCESS_TYPE_GPU: | 171 case content::PROCESS_TYPE_GPU: |
| (...skipping 11 matching lines...) Expand all Loading... |
| 184 } | 183 } |
| 185 | 184 |
| 186 void ChildProcessResource::SetSupportNetworkUsage() { | 185 void ChildProcessResource::SetSupportNetworkUsage() { |
| 187 network_usage_support_ = true; | 186 network_usage_support_ = true; |
| 188 } | 187 } |
| 189 | 188 |
| 190 base::string16 ChildProcessResource::GetLocalizedTitle() const { | 189 base::string16 ChildProcessResource::GetLocalizedTitle() const { |
| 191 base::string16 title = name_; | 190 base::string16 title = name_; |
| 192 if (title.empty()) { | 191 if (title.empty()) { |
| 193 switch (process_type_) { | 192 switch (process_type_) { |
| 194 case content::PROCESS_TYPE_PLUGIN: | |
| 195 case content::PROCESS_TYPE_PPAPI_PLUGIN: | 193 case content::PROCESS_TYPE_PPAPI_PLUGIN: |
| 196 case content::PROCESS_TYPE_PPAPI_BROKER: | 194 case content::PROCESS_TYPE_PPAPI_BROKER: |
| 197 title = l10n_util::GetStringUTF16(IDS_TASK_MANAGER_UNKNOWN_PLUGIN_NAME); | 195 title = l10n_util::GetStringUTF16(IDS_TASK_MANAGER_UNKNOWN_PLUGIN_NAME); |
| 198 break; | 196 break; |
| 199 default: | 197 default: |
| 200 // Nothing to do for non-plugin processes. | 198 // Nothing to do for non-plugin processes. |
| 201 break; | 199 break; |
| 202 } | 200 } |
| 203 } | 201 } |
| 204 | 202 |
| 205 // Explicitly mark name as LTR if there is no strong RTL character, | 203 // Explicitly mark name as LTR if there is no strong RTL character, |
| 206 // to avoid the wrong concatenation result similar to "!Yahoo Mail: the | 204 // to avoid the wrong concatenation result similar to "!Yahoo Mail: the |
| 207 // best web-based Email: NIGULP", in which "NIGULP" stands for the Hebrew | 205 // best web-based Email: NIGULP", in which "NIGULP" stands for the Hebrew |
| 208 // or Arabic word for "plugin". | 206 // or Arabic word for "plugin". |
| 209 base::i18n::AdjustStringForLocaleDirection(&title); | 207 base::i18n::AdjustStringForLocaleDirection(&title); |
| 210 | 208 |
| 211 switch (process_type_) { | 209 switch (process_type_) { |
| 212 case content::PROCESS_TYPE_UTILITY: | 210 case content::PROCESS_TYPE_UTILITY: |
| 213 return l10n_util::GetStringFUTF16(IDS_TASK_MANAGER_UTILITY_PREFIX, title); | 211 return l10n_util::GetStringFUTF16(IDS_TASK_MANAGER_UTILITY_PREFIX, title); |
| 214 case content::PROCESS_TYPE_GPU: | 212 case content::PROCESS_TYPE_GPU: |
| 215 return l10n_util::GetStringUTF16(IDS_TASK_MANAGER_GPU_PREFIX); | 213 return l10n_util::GetStringUTF16(IDS_TASK_MANAGER_GPU_PREFIX); |
| 216 case content::PROCESS_TYPE_PLUGIN: | |
| 217 case content::PROCESS_TYPE_PPAPI_PLUGIN: | 214 case content::PROCESS_TYPE_PPAPI_PLUGIN: |
| 218 return l10n_util::GetStringFUTF16(IDS_TASK_MANAGER_PLUGIN_PREFIX, title); | 215 return l10n_util::GetStringFUTF16(IDS_TASK_MANAGER_PLUGIN_PREFIX, title); |
| 219 case content::PROCESS_TYPE_PPAPI_BROKER: | 216 case content::PROCESS_TYPE_PPAPI_BROKER: |
| 220 return l10n_util::GetStringFUTF16(IDS_TASK_MANAGER_PLUGIN_BROKER_PREFIX, | 217 return l10n_util::GetStringFUTF16(IDS_TASK_MANAGER_PLUGIN_BROKER_PREFIX, |
| 221 title); | 218 title); |
| 222 case PROCESS_TYPE_NACL_BROKER: | 219 case PROCESS_TYPE_NACL_BROKER: |
| 223 return l10n_util::GetStringUTF16(IDS_TASK_MANAGER_NACL_BROKER_PREFIX); | 220 return l10n_util::GetStringUTF16(IDS_TASK_MANAGER_NACL_BROKER_PREFIX); |
| 224 case PROCESS_TYPE_NACL_LOADER: | 221 case PROCESS_TYPE_NACL_LOADER: |
| 225 return l10n_util::GetStringFUTF16(IDS_TASK_MANAGER_NACL_PREFIX, title); | 222 return l10n_util::GetStringFUTF16(IDS_TASK_MANAGER_NACL_PREFIX, title); |
| 226 // These types don't need display names or get them from elsewhere. | 223 // These types don't need display names or get them from elsewhere. |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 388 // This is called on the UI thread. | 385 // This is called on the UI thread. |
| 389 void ChildProcessResourceProvider::ChildProcessDataRetreived( | 386 void ChildProcessResourceProvider::ChildProcessDataRetreived( |
| 390 const std::vector<content::ChildProcessData>& child_processes) { | 387 const std::vector<content::ChildProcessData>& child_processes) { |
| 391 for (size_t i = 0; i < child_processes.size(); ++i) | 388 for (size_t i = 0; i < child_processes.size(); ++i) |
| 392 AddToTaskManager(child_processes[i]); | 389 AddToTaskManager(child_processes[i]); |
| 393 | 390 |
| 394 task_manager_->model()->NotifyDataReady(); | 391 task_manager_->model()->NotifyDataReady(); |
| 395 } | 392 } |
| 396 | 393 |
| 397 } // namespace task_manager | 394 } // namespace task_manager |
| OLD | NEW |